PageRenderTime 81ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/wheels/tests/view/urls/linkTo.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 40 lines | 33 code | 7 blank | 0 comment | 0 complexity | 40811a26a77ded543067cb50166dbf88 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset loc.controller = controller(name="dummy")>
 5		<cfset oldURLRewriting = application.wheels.URLRewriting>
 6		<cfset application.wheels.URLRewriting = "On">
 7		<cfset oldScriptName = request.cgi.script_name>
 8		<cfset request.cgi.script_name = "/rewrite.cfm">
 9	</cffunction>
10
11	<cffunction name="teardown">
12		<cfset application.wheels.URLRewriting = oldURLRewriting>
13		<cfset request.cgi.script_name = oldScriptName>
14	</cffunction>
15
16	<cffunction name="test_controller_action_only">
17		<cfset loc.e = '<a href="#application.wheels.webpath#account/logout">Log Out</a>'>
18		<cfset loc.r = loc.controller.linkTo(text="Log Out", controller="account", action="logout")>
19		<cfset assert('loc.e eq loc.r')>
20	</cffunction>
21
22	<cffunction name="test_confirm_is_escaped">
23		<cfset loc.e = '<a data-confirm="Mark as: \''Completed\''?" href="#application.wheels.webpath#">#application.wheels.webpath#</a>'>
24		<cfset loc.r = loc.controller.linkTo(confirm="Mark as: 'Completed'?")>
25		<cfset assert('loc.e eq loc.r')>
26	</cffunction>
27
28	<cffunction name="test_external_links">
29		<cfset loc.e = '<a href="http://www.cfwheels.com">CFWheels</a>'>
30		<cfset loc.r = loc.controller.linkTo(href="http://www.cfwheels.com", text="CFWheels")>
31		<cfset assert('loc.e eq loc.r')>
32	</cffunction>
33	
34	<cffunction name="test_remote_links">
35		<cfset loc.e = '<a data-remote="true" href="#application.wheels.webpath#account/logout">Log Out</a>'>
36		<cfset loc.r = loc.controller.linkTo(text="Log Out", controller="account", action="logout", remote="true")>
37		<cfset assert('loc.e eq loc.r')>
38	</cffunction>
39
40</cfcomponent>