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

/wheels/tests/view/text/simpleformat.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 113 lines | 107 code | 6 blank | 0 comment | 0 complexity | ed563827d9160d6c6c936f02b19a9ccc MD5 | raw file
  1<cfcomponent extends="wheelsMapping.Test">
  2
  3	<cffunction name="setup">
  4		<cfset loc.controller = controller(name="dummy")>
  5		<cfset loc.testText = "Lobortis, erat feugiat jus autem
  6
  7vel obruo dolor luptatum, os in interdico ex. Sit typicus
  8
  9conventio consequat aptent huic dolore in, tego,
 10sagacitertedistineo tristique nonummy diam. Qui, nostrud
 11cogo vero exputo, wisi indoles duis suscipit veniam populus
 12te gilvus vel quia. Luptatum regula tego imputo nonummy blandit
 13luptatum valetudo ne, venio vero regula letalis valde vicis.
 14
 15Utrum blandit bene refero ut eum eligo cogo duis bene aptent distineo duis quis.
 16Hendrerit nostrud abigo vicis
 17augue validus cui lucidus.">
 18		<cfset loc.testTextWithHtml = "Lobortis, erat feugiat jus autem
 19
 20vel obruo dolor luptatum, os in interdico ex. Sit typicus
 21
 22>>> conventio consequat aptent huic dolore in, tego,
 23>>> sagacitertedistineo tristique nonummy diam. Qui, nostrud
 24>>> cogo vero exputo, wisi indoles duis suscipit veniam populus
 25>>> te gilvus vel quia. Luptatum regula tego imputo nonummy blandit
 26>>> luptatum valetudo ne, venio vero regula letalis valde vicis.
 27
 28Utrum blandit bene refero ut eum eligo cogo duis bene aptent distineo duis quis.
 29Hendrerit nostrud abigo vicis
 30augue validus cui lucidus.">
 31	</cffunction>
 32
 33	<cffunction name="test_text_should_format_with_line_breaks_only">
 34		<cfset loc.e = loc.controller.simpleFormat(text=loc.testText)>
 35		<cfset debug(expression='loc.e', display=false, format="text")>
 36		<cfset loc.r = "<p>Lobortis, erat feugiat jus autem</p>
 37
 38<p>vel obruo dolor luptatum, os in interdico ex. Sit typicus</p>
 39
 40<p>conventio consequat aptent huic dolore in, tego,<br />
 41sagacitertedistineo tristique nonummy diam. Qui, nostrud<br />
 42cogo vero exputo, wisi indoles duis suscipit veniam populus<br />
 43te gilvus vel quia. Luptatum regula tego imputo nonummy blandit<br />
 44luptatum valetudo ne, venio vero regula letalis valde vicis.</p>
 45
 46<p>Utrum blandit bene refero ut eum eligo cogo duis bene aptent distineo duis quis.<br />
 47Hendrerit nostrud abigo vicis<br />
 48augue validus cui lucidus.</p>">
 49		<cfset loc.r = Replace(loc.r, "#Chr(13)#", "", "all")>
 50		<cfset assert("HtmlEditFormat(loc.e) eq HtmlEditFormat(loc.r)")>
 51	</cffunction>
 52	
 53	<cffunction name="test_text_with_html_should_format_with_line_breaks_only">
 54		<cfset loc.e = loc.controller.simpleFormat(text=loc.testTextWithHtml)>
 55		<cfset debug(expression='loc.e', display=false, format="text")>
 56		<cfset loc.r = "<p>Lobortis, erat feugiat jus autem</p>
 57
 58<p>vel obruo dolor luptatum, os in interdico ex. Sit typicus</p>
 59
 60<p>>>> conventio consequat aptent huic dolore in, tego,<br />
 61>>> sagacitertedistineo tristique nonummy diam. Qui, nostrud<br />
 62>>> cogo vero exputo, wisi indoles duis suscipit veniam populus<br />
 63>>> te gilvus vel quia. Luptatum regula tego imputo nonummy blandit<br />
 64>>> luptatum valetudo ne, venio vero regula letalis valde vicis.</p>
 65
 66<p>Utrum blandit bene refero ut eum eligo cogo duis bene aptent distineo duis quis.<br />
 67Hendrerit nostrud abigo vicis<br />
 68augue validus cui lucidus.</p>">
 69		<cfset loc.r = Replace(loc.r, "#Chr(13)#", "", "all")>
 70		<cfset assert("HtmlEditFormat(loc.e) eq HtmlEditFormat(loc.r)")>
 71	</cffunction>
 72	
 73	<cffunction name="test_text_should_format_with_line_breaks_and_escaped_html">
 74		<cfset loc.e = loc.controller.simpleFormat(text=loc.testText)>
 75		<cfset debug(expression='loc.e', display=false, format="text")>
 76		<cfset loc.r = "<p>Lobortis, erat feugiat jus autem</p>
 77
 78<p>vel obruo dolor luptatum, os in interdico ex. Sit typicus</p>
 79
 80<p>conventio consequat aptent huic dolore in, tego,<br />
 81sagacitertedistineo tristique nonummy diam. Qui, nostrud<br />
 82cogo vero exputo, wisi indoles duis suscipit veniam populus<br />
 83te gilvus vel quia. Luptatum regula tego imputo nonummy blandit<br />
 84luptatum valetudo ne, venio vero regula letalis valde vicis.</p>
 85
 86<p>Utrum blandit bene refero ut eum eligo cogo duis bene aptent distineo duis quis.<br />
 87Hendrerit nostrud abigo vicis<br />
 88augue validus cui lucidus.</p>">
 89		<cfset loc.r = Replace(loc.r, "#Chr(13)#", "", "all")>
 90		<cfset assert("HtmlEditFormat(loc.e) eq HtmlEditFormat(loc.r)")>
 91	</cffunction>
 92	
 93	<cffunction name="test_text_with_html_should_format_with_line_breaks_and_escaped_html">
 94		<cfset loc.e = loc.controller.simpleFormat(text=loc.testTextWithHtml)>
 95		<cfset debug(expression='loc.e', display=false, format="text")>
 96		<cfset loc.r = "<p>Lobortis, erat feugiat jus autem</p>
 97
 98<p>vel obruo dolor luptatum, os in interdico ex. Sit typicus</p>
 99
100<p>>>> conventio consequat aptent huic dolore in, tego,<br />
101>>> sagacitertedistineo tristique nonummy diam. Qui, nostrud<br />
102>>> cogo vero exputo, wisi indoles duis suscipit veniam populus<br />
103>>> te gilvus vel quia. Luptatum regula tego imputo nonummy blandit<br />
104>>> luptatum valetudo ne, venio vero regula letalis valde vicis.</p>
105
106<p>Utrum blandit bene refero ut eum eligo cogo duis bene aptent distineo duis quis.<br />
107Hendrerit nostrud abigo vicis<br />
108augue validus cui lucidus.</p>">
109		<cfset loc.r = Replace(loc.r, "#Chr(13)#", "", "all")>
110		<cfset assert("HtmlEditFormat(loc.e) eq HtmlEditFormat(loc.r)")>
111	</cffunction>
112
113</cfcomponent>