PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/view/text/truncate.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 31 lines | 26 code | 5 blank | 0 comment | 0 complexity | 60b74810386bc50a2b972cb4ff383315 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset loc.controller = controller(name="dummy")>
 5		<cfset loc.args = {}>
 6		<cfset loc.args.text = "this is a test to see if this works or not.">
 7		<cfset loc.args.length = "20">
 8		<cfset loc.args.truncateString = "[more]">
 9	</cffunction>
10
11	<cffunction name="test_phrase_should_truncate">
12		<cfset loc.e = loc.controller.truncate(argumentcollection=loc.args)>
13		<cfset loc.r = "this is a test[more]">
14		<cfset assert("loc.e eq loc.r")>
15	</cffunction>
16
17	<cffunction name="test_phrase_is_blank">
18		<cfset loc.args.text = "">
19		<cfset loc.e = loc.controller.truncate(argumentcollection=loc.args)>
20		<cfset loc.r = "">
21		<cfset assert("loc.e eq loc.r")>
22	</cffunction>
23
24	<cffunction name="test_truncateString_argument_is_missing">
25		<cfset structdelete(loc.args, "truncateString")>
26		<cfset loc.e = loc.controller.truncate(argumentcollection=loc.args)>
27		<cfset loc.r = "this is a test to...">
28		<cfset assert("loc.e eq loc.r")>
29	</cffunction>
30
31</cfcomponent>