PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/controller/rendering/includecontent.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 38 lines | 32 code | 6 blank | 0 comment | 0 complexity | 253bdc98f34da646a01278a052fc5db3 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset loc.params = {controller="dummy", action="dummy"}>
  4. <cfset loc.controller = controller("dummy", loc.params)>
  5. </cffunction>
  6. <cffunction name="test_contentFor_and_includeContent_assigning_section">
  7. <cfset loc.a = ["head1", "head2", "head3"]>
  8. <cfloop array="#loc.a#" index="loc.i">
  9. <cfset loc.controller.contentFor(head=loc.i)>
  10. </cfloop>
  11. <cfset loc.e = ArrayToList(loc.a, chr(10))>
  12. <cfset loc.r = loc.controller.includeContent("head")>
  13. <cfset assert('loc.e eq loc.r')>
  14. </cffunction>
  15. <cffunction name="test_contentFor_and_includeContent_default_section">
  16. <cfset loc.a = ["layout1", "layout2", "layout3"]>
  17. <cfloop array="#loc.a#" index="loc.i">
  18. <cfset loc.controller.contentFor(body=loc.i)>
  19. </cfloop>
  20. <cfset loc.e = ArrayToList(loc.a, chr(10))>
  21. <cfset loc.r = loc.controller.includeContent()>
  22. <cfset assert('loc.e eq loc.r')>
  23. </cffunction>
  24. <cffunction name="test_includeContent_invalid_section_returns_blank">
  25. <cfset loc.r = loc.controller.includeContent("somethingstupid")>
  26. <cfset assert('loc.r eq ""')>
  27. </cffunction>
  28. <cffunction name="test_includeContent_returns_default">
  29. <cfset loc.r = loc.controller.includeContent("somethingstupid", "my default value")>
  30. <cfset assert('loc.r eq "my default value"')>
  31. </cffunction>
  32. </cfcomponent>