PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 39ms app.codeStats 0ms

/wheels/tests/view/assets/imagetag.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 98 lines | 87 code | 11 blank | 0 comment | 0 complexity | 9b650e387e69b6c4eb6c659f241383a4 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.source = "../wheels/tests/_assets/files/cfwheels-logo.png">
 7		<cfset loc.args.alt = "wheelstestlogo">
 8		<cfset loc.args.class = "wheelstestlogoclass">
 9		<cfset loc.args.id = "wheelstestlogoid">
10		<cfset loc.imagePath = application.wheels.webPath & application.wheels.imagePath>
11	</cffunction>
12
13	<cffunction name="test_just_source">
14		<cfset structdelete(loc.args, "alt")>
15		<cfset structdelete(loc.args, "class")>
16		<cfset structdelete(loc.args, "id")>
17		<cfset loc.r = '<img alt="Cfwheels logo" height="121" src="#loc.imagePath#/#loc.args.source#" width="93" />'>
18		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
19		<cfset assert("loc.e eq loc.r")>
20	</cffunction>
21
22	<cffunction name="test_supplying_an_alt">
23		<cfset structdelete(loc.args, "class")>
24		<cfset structdelete(loc.args, "id")>
25		<cfset loc.r = '<img alt="#loc.args.alt#" height="121" src="#loc.imagePath#/#loc.args.source#" width="93" />'>
26		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
27		<cfset assert("loc.e eq loc.r")>
28	</cffunction>
29
30	<cffunction name="test_supplying_an_id_when_caching_is_on">
31		<cfset loc.cacheImages = application.wheels.cacheImages>
32		<cfset application.wheels.cacheImages = true>
33		<cfset StructDelete(loc.args, "alt")>
34		<cfset StructDelete(loc.args, "class")>
35		<cfset loc.r = '<img alt="Cfwheels logo" height="121" src="#loc.imagePath#/#loc.args.source#" id="#loc.args.id#" width="93" />'>
36		<cfset loc.e = loc.controller.imageTag(argumentCollection=loc.args)>
37		<cfset assert("loc.e eq loc.r")>
38		<cfset application.wheels.cacheImages = loc.cacheImages>
39	</cffunction>
40
41	<cffunction name="test_supplying_class_and_id">
42		<cfset loc.r = '<img alt="#loc.args.alt#" class="#loc.args.class#" height="121" src="#loc.imagePath#/#loc.args.source#" id="#loc.args.id#" width="93" />'>
43		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
44		<cfset assert("loc.e eq loc.r")>
45	</cffunction>
46
47	<cffunction name="test_grabbing_from_http">
48		<cfset structdelete(loc.args, "alt")>
49		<cfset structdelete(loc.args, "class")>
50		<cfset structdelete(loc.args, "id")>
51		<cfset loc.args.source = "http://www.cfwheels.org/images/cfwheels-logo.png">
52		<cfset loc.r = '<img alt="Cfwheels logo" src="#loc.args.source#" />'>
53		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
54		<cfset assert("loc.e eq loc.r")>
55	</cffunction>
56
57	<cffunction name="test_grabbing_from_https">
58		<cfset structdelete(loc.args, "alt")>
59		<cfset structdelete(loc.args, "class")>
60		<cfset structdelete(loc.args, "id")>
61		<cfset loc.args.source = "https://www.cfwheels.org/images/cfwheels-logo.png">
62		<cfset loc.r = '<img alt="Cfwheels logo" src="#loc.args.source#" />'>
63		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
64		<cfset assert("loc.e eq loc.r")>
65	</cffunction>
66
67	<cffunction name="test_specifying_height_and_width">
68		<cfset structdelete(loc.args, "alt")>
69		<cfset structdelete(loc.args, "class")>
70		<cfset structdelete(loc.args, "id")>
71		<cfset loc.args.height = 25>
72		<cfset loc.args.width = 25>
73		<cfset loc.r = '<img alt="Cfwheels logo" height="25" src="#loc.imagePath#/#loc.args.source#" width="25" />'>
74		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
75		<cfset assert("loc.e eq loc.r")>
76	</cffunction>
77
78	<cffunction name="test_height_only">
79		<cfset structdelete(loc.args, "alt")>
80		<cfset structdelete(loc.args, "class")>
81		<cfset structdelete(loc.args, "id")>
82		<cfset loc.args.height = 25>
83		<cfset loc.r = '<img alt="Cfwheels logo" height="25" src="#loc.imagePath#/#loc.args.source#" width="93" />'>
84		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
85		<cfset assert("loc.e eq loc.r")>
86	</cffunction>
87
88	<cffunction name="test_width_only">
89		<cfset structdelete(loc.args, "alt")>
90		<cfset structdelete(loc.args, "class")>
91		<cfset structdelete(loc.args, "id")>
92		<cfset loc.args.width = 25>
93		<cfset loc.r = '<img alt="Cfwheels logo" height="121" src="#loc.imagePath#/#loc.args.source#" width="25" />'>
94		<cfset loc.e = loc.controller.imageTag(argumentcollection=loc.args)>
95		<cfset assert("loc.e eq loc.r")>
96	</cffunction>
97
98</cfcomponent>