/wheels/tests/view/miscellaneous/contentFor.cfc
ColdFusion CFScript | 53 lines | 47 code | 6 blank | 0 comment | 0 complexity | ca8fe96053ccbac050a8e2c18e83e867 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
1<cfcomponent extends="wheelsMapping.Test"> 2 3 <cffunction name="setup"> 4 <cfset loc.params = {controller="dummy", action="dummy"}> 5 <cfset loc.controller = controller("dummy", loc.params)> 6 </cffunction> 7 8 <cffunction name="test_specfying_positions_overwrite_false"> 9 <cfset loc.controller.contentFor(testing="A")> 10 <cfset loc.controller.contentFor(testing="B")> 11 <cfset loc.controller.contentFor(testing="C", position="first")> 12 <cfset loc.controller.contentFor(testing="D", position="2")> 13 <cfset loc.r = loc.controller.includeContent("testing")> 14 <cfset loc.e = "C#chr(10)#D#chr(10)#A#chr(10)#B"> 15 <cfset assert('loc.e eq loc.r')> 16 </cffunction> 17 18 <cffunction name="test_specfying_positions_overwrite_true"> 19 <cfset loc.controller.contentFor(testing="A")> 20 <cfset loc.controller.contentFor(testing="B")> 21 <cfset loc.controller.contentFor(testing="C", position="first", overwrite="true")> 22 <cfset loc.controller.contentFor(testing="D", position="2", overwrite="true")> 23 <cfset loc.r = loc.controller.includeContent("testing")> 24 <cfset loc.e = "C#chr(10)#D"> 25 <cfset assert('loc.e eq loc.r')> 26 </cffunction> 27 28 <cffunction name="test_overwrite_all"> 29 <cfset loc.controller.contentFor(testing="A")> 30 <cfset loc.controller.contentFor(testing="B")> 31 <cfset loc.controller.contentFor(testing="C", overwrite="all")> 32 <cfset loc.r = loc.controller.includeContent("testing")> 33 <cfset loc.e = "C"> 34 <cfset assert('loc.e eq loc.r')> 35 </cffunction> 36 37 <cffunction name="test_specify_position_outside_of_size_should_not_error"> 38 <cfset loc.controller.contentFor(testing="A")> 39 <cfset loc.controller.contentFor(testing="B")> 40 <cfset loc.controller.contentFor(testing="C")> 41 <cfset loc.controller.contentFor(testing="D", position="6")> 42 <cfset loc.r = loc.controller.includeContent("testing")> 43 <cfset loc.e = ["A","B","C","D"]> 44 <cfset loc.e = ArrayToList(loc.e, chr(10))> 45 <cfset assert('loc.e eq loc.r')> 46 <cfset loc.controller.contentFor(testing="D", position="-5")> 47 <cfset loc.r = loc.controller.includeContent("testing")> 48 <cfset loc.e = ["D","A","B","C","D"]> 49 <cfset loc.e = ArrayToList(loc.e, chr(10))> 50 <cfset assert('loc.e eq loc.r')> 51 </cffunction> 52 53</cfcomponent>