window.onload = function() {
// textCleanup
test( "textCleanup", function() {
var source = "Some\nValue\n\n\nTest"
var should = "Some\nValue\n\nTest"
var result = App.Utils.textCleanup( source )
equal( result, should, source )
source = "Some\nValue\n\n \n\n\nTest"
should = "Some\nValue\n\nTest"
result = App.Utils.textCleanup( source )
equal( result, should, source )
source = "Some\n\rValue\n\r\n\r\n\rTest"
should = "Some\nValue\n\nTest"
result = App.Utils.textCleanup( source )
equal( result, should, source )
source = "Some\n\rValue\n\r\n\r\n\rTest\r"
should = "Some\nValue\n\nTest"
result = App.Utils.textCleanup( source )
equal( result, should, source )
source = "Some\r\nValue\r\n\r\n\r\nTest\r\n"
should = "Some\nValue\n\nTest"
result = App.Utils.textCleanup( source )
equal( result, should, source )
source = "Some\r\nValue\r\n\r\n\r\n\r\n\r\n\r\nTest\r\n"
should = "Some\nValue\n\nTest"
result = App.Utils.textCleanup( source )
equal( result, should, source )
});
// htmlEscape
test( "htmlEscape", function() {
var source = "<"
var should = "<"
var result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = ">"
should = ">"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "&"
should = "&"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "&"
should = "&"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "& ;"
should = "& ;"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "& amp;"
should = "& amp;"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "'test'"
should = "'test'"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = '"test"'
should = ""test""
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "<>"
should = "<>"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
source = "<<>"
should = "<<>"
result = App.Utils.htmlEscape( source )
equal( result, should, source )
});
// text2html
test( "text2html", function() {
var source = "Some\nValue\n\n\nTest"
var should = "Some
Value
Test"
var result = App.Utils.text2html( source )
equal( result, should, source )
source = "Some\nValue\n"
should = "Some
Value"
result = App.Utils.text2html( source )
equal( result, should, source )
source = "Some\nValue\n"
should = "Some
<b>Value</b>"
result = App.Utils.text2html( source )
equal( result, should, source )
});
// linkify
test( "linkify", function() {
var source = "http://example.com"
var should = 'http://example.com'
var result = App.Utils.linkify( source )
equal( result, should, source )
source = "http://example.com?some_param=lalala"
should = 'http://example.com?some_param=lalala'
result = App.Utils.linkify( source )
equal( result, should, source )
source = "example.com"
should = 'example.com'
result = App.Utils.linkify( source )
equal( result, should, source )
source = "some text example.com"
should = 'some text example.com'
result = App.Utils.linkify( source )
equal( result, should, source )
source = "example.com some text"
should = 'example.com some text'
result = App.Utils.linkify( source )
equal( result, should, source )
/*
source = "example.com"
should = 'http://example.com'
result = App.Utils.linkify( source )
equal( result, should, source )
*/
});
}