PageRenderTime 202ms CodeModel.GetById 80ms app.highlight 1ms RepoModel.GetById 120ms 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
 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_contentFor_and_includeContent_assigning_section">
 9		<cfset loc.a = ["head1", "head2", "head3"]>
10		<cfloop array="#loc.a#" index="loc.i">
11			<cfset loc.controller.contentFor(head=loc.i)>
12		</cfloop>
13		<cfset loc.e = ArrayToList(loc.a, chr(10))>
14		<cfset loc.r = loc.controller.includeContent("head")>
15		<cfset assert('loc.e eq loc.r')>
16	</cffunction>
17	
18	<cffunction name="test_contentFor_and_includeContent_default_section">
19		<cfset loc.a = ["layout1", "layout2", "layout3"]>
20		<cfloop array="#loc.a#" index="loc.i">
21			<cfset loc.controller.contentFor(body=loc.i)>
22		</cfloop>
23		<cfset loc.e = ArrayToList(loc.a, chr(10))>
24		<cfset loc.r = loc.controller.includeContent()>
25		<cfset assert('loc.e eq loc.r')>
26	</cffunction>
27	
28	<cffunction name="test_includeContent_invalid_section_returns_blank">
29		<cfset loc.r = loc.controller.includeContent("somethingstupid")>
30		<cfset assert('loc.r eq ""')>
31	</cffunction>
32	
33	<cffunction name="test_includeContent_returns_default">
34		<cfset loc.r = loc.controller.includeContent("somethingstupid", "my default value")>
35		<cfset assert('loc.r eq "my default value"')>
36	</cffunction>
37
38</cfcomponent>