diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index de84df457..4a84032a8 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -551,9 +551,13 @@ class App.Utils # format decimal @decimal: (data, positions = 2) -> - data = data.toString() - # input validation + return '' if data is undefined + return '' if data is null + + if data.toString + data = data.toString() + return data if data is '' return data if data.match(/[A-z]/) @@ -566,17 +570,25 @@ class App.Utils # add .00 if !result || !result[2] - return "#{data}." + format(0, positions) + return "#{data}.#{format(0, positions)}" length = result[2].length diff = positions - length # check length, add .00 - return "#{result[1]}." + format(result[2], positions) if diff > 0 + return "#{result[1]}.#{format(result[2], positions)}" if diff > 0 # check length, remove longer positions "#{result[1]}.#{result[2].substr(0,positions)}" @formatTime: (num, digits) -> - while num.toString().length < digits + + # input validation + return '' if num is undefined + return '' if num is null + + if num.toString + num = num.toString() + + while num.length < digits num = '0' + num num diff --git a/public/assets/tests/html-utils.js b/public/assets/tests/html-utils.js index dee4507f2..bfc650a85 100644 --- a/public/assets/tests/html-utils.js +++ b/public/assets/tests/html-utils.js @@ -1,728 +1,728 @@ window.onload = function() { // textCleanup -test( "textCleanup", function() { +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 ) + 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 ) + 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 ) + 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 ) + 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 ) + 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 ) + result = App.Utils.textCleanup(source) + equal(result, should, source) source = "> Welcome!\n> \n> Thank you for installing Zammad.\n> \n> You will find ..." should = "> Welcome!\n>\n> Thank you for installing Zammad.\n>\n> You will find ..." - result = App.Utils.textCleanup( source ) - equal( result, should, source ) + result = App.Utils.textCleanup(source) + equal(result, should, source) }); // text2html -test( "text2html", function() { +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 ) + 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 ) + 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 ) + result = App.Utils.text2html(source) + equal(result, should, source) source = "> Welcome!\n> \n> Thank you for installing Zammad.\n> \n> You will find ..." should = "
> Welcome!
>
> Thank you for installing Zammad.
>
> You will find ...
" - result = App.Utils.text2html( source ) - equal( result, should, source ) + result = App.Utils.text2html(source) + equal(result, should, source) }); // html2text -test( "html2text", function() { +test("html2text", function() { var source = "
Some
Value

Test
" var should = "Some\nValue\n\nTest" - var result = App.Utils.html2text( source ) - equal( result, should, source ) + var result = App.Utils.html2text(source) + equal(result, should, source) source = "
Some
Value
" should = "Some\nValue" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "
Some
Value
" should = "Some\nValue" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "
Some
<b>Value</b>
" should = "Some\nValue" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "
> Welcome!
>
> Thank you for installing Zammad.
>
> You will find ...
" should = "> Welcome!\n>\n> Thank you for installing Zammad.\n>\n> You will find ..." - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "
test 123










--
Bob Smith
" should = "test 123 \n\n--\nBob Smith" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "test 123










--
Bob Smith" should = "test 123 \n\n--\nBob Smith" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "
1









Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
" should = "1\n\nVon: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nGesendet: Donnerstag, 2. April 2015 11:32" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) source = "
test 123
lalala

--

some test
" should = "test 123\nlalala\n--\nsome test" - result = App.Utils.html2text( source ) - equal( result, should, source ) + result = App.Utils.html2text(source) + equal(result, should, source) }); // linkify -test( "linkify", function() { +test("linkify", function() { var source = "http://example.com" var should = 'http://example.com' - var result = App.Utils.linkify( source ) - equal( result, should, source ) + 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 ) + result = App.Utils.linkify(source) + equal(result, should, source) source = "example.com" should = 'example.com' - result = App.Utils.linkify( source ) - equal( result, should, source ) + 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 ) + 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 ) + 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 ) + result = App.Utils.linkify(source) + equal(result, should, source) */ }); // htmlEscape -test( "htmlEscape", function() { +test("htmlEscape", function() { var source = "<" var should = "<" - var result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + var result = App.Utils.htmlEscape(source) + equal(result, should, source) source = ">" should = ">" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "&" should = "&" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "&" should = "&amp;" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "& ;" should = "&amp ;" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "& amp;" should = "& amp;" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "'test'" should = "'test'" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = '"test"' should = ""test"" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "<>" should = "<>" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) source = "<<>" should = "<&lt;>" - result = App.Utils.htmlEscape( source ) - equal( result, should, source ) + result = App.Utils.htmlEscape(source) + equal(result, should, source) }); // htmlRemoveTags -test( "htmlRemoveTags", function() { +test("htmlRemoveTags", function() { var source = "
test
" //var should = "
test
" var should = "test" - var result = App.Utils.htmlRemoveTags( $(source) ) - equal( result.html(), should, source ) + var result = App.Utils.htmlRemoveTags($(source)) + equal(result.html(), should, source) source = "
test
" //should = "
test
" should = "test" - result = App.Utils.htmlRemoveTags( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveTags($(source)) + equal(result.html(), should, source) source = "some link to somewhere" should = "some link to somewhere" - result = App.Utils.htmlRemoveTags( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveTags($(source)) + equal(result.html(), should, source) source = "
some link to somewhere
" //should = "
some link to somewhere
" should = "some link to somewhere" - result = App.Utils.htmlRemoveTags( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveTags($(source)) + equal(result.html(), should, source) source = "
some link to somewhere
" //should = "
some link to somewhere
" should = "some link to somewhere" - result = App.Utils.htmlRemoveTags( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveTags($(source)) + equal(result.html(), should, source) source = "
some link to somewhere

123
" //should = "
some link to somewhere 123
" should = "some link to somewhere 123 " - result = App.Utils.htmlRemoveTags( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveTags($(source)) + equal(result.html(), should, source) source = "
test 123
" //should = "
test 123
" should = "test 123" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
" //should = "
test 123
" should = "test 123" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
This is some text!
" //should = "
This is some text!
" should = "This is some text!" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) }); // htmlRemoveRichtext -test( "htmlRemoveRichtext", function() { +test("htmlRemoveRichtext", function() { var source = "
test
" //var should = "
test
" var should = "test" - var result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + var result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
1.1.1     Description
" //should = "
1.1.1     Description
" should = "1.1.1     Description" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "some link to somewhere" should = "some link to somewhere" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test
" //should = "
test
" should = " test " - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test
" //should = "
test
" should = " test " - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test
" //should = "
test
" should = "
test
" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test
" //should = "
test
" should = "
test
" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test
123
" //should = "
test
123
" should = "
test
123" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test
" //should = "
test
" should = "
test
" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
" //should = "
test
" should = " test " - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "

" //should = "

" should = "
" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "

" //should = "

" should = "

" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test 123
" //should = "
test 123
" should = "test 123" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
This is some text!
" //should = "
This is some text!
" should = "This is some text!" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) }); // htmlCleanup -test( "htmlCleanup", function() { +test("htmlCleanup", function() { var source = "
test
" //var should = "
test
" var should = "test" - var result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + var result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "some link to somewhere" should = "some link to somewhere" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "

some link to somewhere

" //should = "
some link to somewhere
" should = "
some link to somewhere
" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "
some link to somewhere" //should = "
some link to somewhere
" should = "some link to somewhere" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "
" //should = "
some link to somewhere
" should = "some link to somewhere" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "

some h1 for somewhere


" //should = "
some h1 for somewhere

" should = "
some h1 for somewhere

" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "

" //should = "

" should = "
" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) source = "

" //should = "

" should = "

" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test 123
" //should = "
test 123
" should = "test 123" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test 123
some other value
" //should = "
test 123 some other value
" should = "test 123 some other value" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
test 123
some other value
" //should = "
test 123 some other value
" should = "test 123 some other value" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "
This is some text!
" //should = "
This is some text!
" should = "This is some text!" - result = App.Utils.htmlRemoveRichtext( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlRemoveRichtext($(source)) + equal(result.html(), should, source) source = "

some link to somewhere from wordabc

" should = "

some link to somewhere from wordabc

" - result = App.Utils.htmlCleanup( $(source) ) - equal( result.html(), should, source ) + result = App.Utils.htmlCleanup($(source)) + equal(result.html(), should, source) }); // wrap -test( "wrap", function() { +test("wrap", function() { var source = "some text" var should = 'some text' - var result = App.Utils.wrap( source ) - equal( result, should, source ) + var result = App.Utils.wrap(source) + equal(result, should, source) source = "some text\nsome other text\n" should = "some text\nsome other text\n" - result = App.Utils.wrap( source ) - equal( result, should, source ) + result = App.Utils.wrap(source) + equal(result, should, source) source = "some text with some line to wrap" should = "some text with\nsome line to\nwrap" - result = App.Utils.wrap( source, 14 ) - equal( result, should, source ) + result = App.Utils.wrap(source, 14) + equal(result, should, source) source = "some text\nsome other text\n" should = "some text\nsome other text\n" - result = App.Utils.wrap( source ) - equal( result, should, source ) + result = App.Utils.wrap(source) + equal(result, should, source) source = "1234567890 1234567890 1234567890 1234567890" should = "1234567890 1234567890 1234567890 1234567890" - result = App.Utils.wrap( source ) - equal( result, should, source ) + result = App.Utils.wrap(source) + equal(result, should, source) source = "123456789012 123456789012 123456789012" should = "123456789012\n123456789012\n123456789012" - result = App.Utils.wrap( source, 14 ) - equal( result, should, source ) + result = App.Utils.wrap(source, 14) + equal(result, should, source) }); // quote -test( "quote", function() { +test("quote", function() { var source = "some text" var should = '> some text' - var result = App.Utils.quote( source ) - equal( result, should, source ) + var result = App.Utils.quote(source) + equal(result, should, source) source = "some text\nsome other text\n" should = "> some text\n> some other text" - result = App.Utils.quote( source ) - equal( result, should, source ) + result = App.Utils.quote(source) + equal(result, should, source) source = "\n\nsome text\nsome other text\n \n" should = "> some text\n> some other text" - result = App.Utils.quote( source ) - equal( result, should, source ) + result = App.Utils.quote(source) + equal(result, should, source) source = "Welcome!\n\nThank you for installing Zammad.\n\nYou will find ..." should = "> Welcome!\n>\n> Thank you for installing Zammad.\n>\n> You will find ..." - result = App.Utils.quote( source ) - equal( result, should, source ) + result = App.Utils.quote(source) + equal(result, should, source) source = "Welcome! Thank you for installing Zammad. You will find ..." should = "> Welcome! Thank you\n> for installing\n> Zammad. You will\n> find ..." - result = App.Utils.quote( source, 20 ) - equal( result, should, source ) + result = App.Utils.quote(source, 20) + equal(result, should, source) }); // check signature -test( "check signature", function() { +test("check signature", function() { var message = "
test 123
" var signature = '
--
Some Signature
some department
' - var result = App.Utils.signatureCheck( message, signature ) - equal( result, true ) + var result = App.Utils.signatureCheck(message, signature) + equal(result, true) message = "
test 123
--
Some Signature
some department\n
" signature = '
--
Some Signature
some department
' - result = App.Utils.signatureCheck( message, signature ) - equal( result, false ) + result = App.Utils.signatureCheck(message, signature) + equal(result, false) message = "
test 123
--
Some Signature\n
some department\n
" signature = '
--
Some Signature
some department
' - result = App.Utils.signatureCheck( message, signature ) - equal( result, false ) + result = App.Utils.signatureCheck(message, signature) + equal(result, false) message = "
test 123
--

Some Signature

\n

some department
\n

\n
" signature = '
--
Some Signature
some department
' - result = App.Utils.signatureCheck( message, signature ) - equal( result, false ) + result = App.Utils.signatureCheck(message, signature) + equal(result, false) message = "" signature = '
--
Some Signature
some department
' - result = App.Utils.signatureCheck( message, signature ) - equal( result, true ) + result = App.Utils.signatureCheck(message, signature) + equal(result, true) message = "" signature = "--\nSome Signature\nsome department" - result = App.Utils.signatureCheck( message, signature ) - equal( result, true ) + result = App.Utils.signatureCheck(message, signature) + equal(result, true) }); // identify signature -test( "identify signature", function() { +test("identify signature", function() { var message = "
test 123
" var should = '
test 123
' - var result = App.Utils.signatureIdentify( message ) - equal( result, should ) + var result = App.Utils.signatureIdentify(message) + equal(result, should) message = "
test 123
--
Bob Smith
" should = '
test 123
--
Bob Smith
' - result = App.Utils.signatureIdentify( message ) - equal( result, should ) + result = App.Utils.signatureIdentify(message) + equal(result, should) message = "
test 123
1
2
3
4
5
6
7
8
9

--
Bob Smith
" should = '
test 123
1
2
3
4
5
6
7
8
9

--
Bob Smith
' - result = App.Utils.signatureIdentify( message ) - equal( result, should ) + result = App.Utils.signatureIdentify(message) + equal(result, should) message = "
test 123

--no not match--
--
Bob Smith
" should = '
test 123

--no not match--
--
Bob Smith
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--no not match--
--
Bob Smith
" should = '
test 123

--no not match--
--
Bob Smith
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--
Bob Smith




--
Bob Smith
" should = '
test 123

--
Bob Smith




--
Bob Smith
' //should = '
test 123










--
Bob Smith




--
Bob Smith
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123
test 123
--
Bob Smith
" should = "
test 123
test 123
--
Bob Smith
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "

test 123

test 123

--

Bob Smith

" should = "

test 123

test 123

--

Bob Smith

" - result = App.Utils.signatureIdentify( message, true ) + result = App.Utils.signatureIdentify(message, true) // apple // en message = "
test 123

--no not match--

Bob Smith
On 01/04/15 10:55, Bob Smith wrote:
lalala

--

some test
" should = '
test 123

--no not match--

Bob Smith
On 01/04/15 10:55, Bob Smith wrote:
lalala

--

some test
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
Am 03.04.2015 um 20:58 schrieb Bob Smith <bob@example.com>:
lalala
" should = '
test 123

--no not match--

Bob Smith
Am 03.04.2015 um 20:58 schrieb Bob Smith <bob@example.com>:
lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // ms // en message = "
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
lalala
" should = '
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
Subject: lalala
" should = '
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
Subject: lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
1
2
3
4
4
Subject: lalala
" should = '
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
1
2
3
4
4
Subject: lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Gesendet: Donnerstag, 2. April 2015 10:00
Betreff: lalala
" should = '
test 123

--no not match--

Bob Smith
Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Gesendet: Donnerstag, 2. April 2015 10:00
Betreff: lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
" should = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" should = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
1

Von: Martin Edenhofer via Znuny Support <mailto:support@znuny.inc>
\n
An: somebody
Datum: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" should = "
1

Von: Martin Edenhofer via Znuny Support <mailto:support@znuny.inc>
\n
An: somebody
Datum: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
Von: \"Johannes Nickel via Znuny Projects\" <projects@znuny.inc>
An: \"Lisa Smith\" <lisa.smith@example.com>
Gesendet: Donnerstag, 2. April 2015 10:11:12
Betreff: Angebot Redundanz / Paket mit Silver Subscription [Ticket#424242]

Hallo Frau Smith,
" should = "
Von: \"Johannes Nickel via Znuny Projects\" <projects@znuny.inc>
An: \"Lisa Smith\" <lisa.smith@example.com>
Gesendet: Donnerstag, 2. April 2015 10:11:12
Betreff: Angebot Redundanz / Paket mit Silver Subscription [Ticket#424242]

Hallo Frau Smith,
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // fr message = "
test 123

--no not match--

Bob Smith
De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Envoyé : mercredi 29 avril 2015 17:31
Objet : lalala
" should = '
test 123

--no not match--

Bob Smith
De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Envoyé : mercredi 29 avril 2015 17:31
Objet : lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // thunderbird // de message = "

Viele Grüße,
Christian

Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:
> Hallo Christian,
" should = "

Viele Grüße,
Christian

Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:
> Hallo Christian,
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // en - Thunderbird default - http://kb.mozillazine.org/Reply_header_settings message = "

Viele Grüße,
Christian

On 01-01-2007 11:00 AM, Alf Aardvark wrote:
> Hallo Christian,
" should = "

Viele Grüße,
Christian

On 01-01-2007 11:00 AM, Alf Aardvark wrote:
> Hallo Christian,
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // en - http://kb.mozillazine.org/Reply_header_settings message = "

Viele Grüße,
Christian

Alf Aardvark wrote, on 01-01-2007 11:00 AM:
> Hallo Christian,
" should = "

Viele Grüße,
Christian

Alf Aardvark wrote, on 01-01-2007 11:00 AM:
> Hallo Christian,
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // otrs // en message = "
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith wrote:
lalala
" should = '
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith wrote:
lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith schrieb:
lalala
" should = '
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith schrieb:
lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

24.02.2015 14:20 - Roy Kaldung via Znuny Sales schrieb:  
" should = "
test 123

24.02.2015 14:20 - Roy Kaldung via Znuny Sales schrieb:  
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // zammad message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // gmail message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) message = "
test 123

--no not match--

Bob Smith
Am 24. Dezember 2015 um 07:45 schrieb kathrine <kathrine@example.com>:
lalala
" should = "
test 123

--no not match--

Bob Smith
Am 24. Dezember 2015 um 07:45 schrieb kathrine <kathrine@example.com>:
lalala
" - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // word 14 // en message = "
test 123

--no not match--

Bob Smith
Bob Smith wrote:
lalala
" should = '
test 123

--no not match--

Bob Smith
Bob Smith wrote:
lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
Bob Smith schrieb:
lalala
" should = '
test 123

--no not match--

Bob Smith
Bob Smith schrieb:
lalala
' - result = App.Utils.signatureIdentify( message, true ) - equal( result, should ) + result = App.Utils.signatureIdentify(message, true) + equal(result, should) }); // replace tags -test( "check replace tags", function() { +test("check replace tags", function() { var message = "
#{user.firstname} #{user.lastname}
" var result = '
Bob Smith
' @@ -732,8 +732,8 @@ test( "check replace tags", function() { lastname: 'Smith', }, } - var verify = App.Utils.replaceTags( message, data ) - equal( verify, result ) + var verify = App.Utils.replaceTags(message, data) + equal(verify, result) message = "
#{user.firstname} #{user.lastname}
" result = '
Bob Smith
' @@ -743,8 +743,8 @@ test( "check replace tags", function() { lastname: function() { return 'Smith' }, }, } - verify = App.Utils.replaceTags( message, data ) - equal( verify, result ) + verify = App.Utils.replaceTags(message, data) + equal(verify, result) message = "
#{user.firstname} #{user.lastname}
" result = '
Bob
' @@ -753,129 +753,129 @@ test( "check replace tags", function() { firstname: 'Bob', }, } - verify = App.Utils.replaceTags( message, data ) - equal( verify, result ) + verify = App.Utils.replaceTags(message, data) + equal(verify, result) }); // check if last line is a empty line -test( "check if last line is a empty line", function() { +test("check if last line is a empty line", function() { var message = "123" var result = false - var verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + var verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
123
" result = false - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "

123

" result = false - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
" result = true - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
" result = true - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
" result = true - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
\n \n\t" result = true - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
\n \n\t" result = true - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) message = "
\n
\n \n\t" result = true - verify = App.Utils.lastLineEmpty( message ) - equal( verify, result, message ) + verify = App.Utils.lastLineEmpty(message) + equal(verify, result, message) }); // check attibute validation -test( "check attibute validation", function() { +test("check attibute validation", function() { var string = '123' - var result = '123' - var verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + var result = '123' + var verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '123!' - result = '123' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = '123' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '12 3!' - result = '123' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = '123' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '12-3!' - result = '12-3' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = '12-3' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '12_3!' - result = '12_3' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = '12_3' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '^12_3!' - result = '12_3' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = '12_3' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '^1\n 2_3!' - result = '12_3' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = '12_3' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = 'abc?' - result = 'abc' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = 'abc' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = 'abc."' - result = 'abc' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = 'abc' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = '#abc!^' - result = 'abc' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = 'abc' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = 'abc()=$' - result = 'abc' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = 'abc' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) string = "abc()=$\n123\rß" - result = 'abc123' - verify = App.Utils.htmlAttributeCleanup( string ) - equal( verify, result, string ) + result = 'abc123' + verify = App.Utils.htmlAttributeCleanup(string) + equal(verify, result, string) }); // check form diff -test( "check form diff", function() { +test("check form diff", function() { var dataNow = { owner_id: 1, @@ -886,8 +886,8 @@ test( "check form diff", function() { pending_date: '2015-01-28T09:39:00Z', } var diff = {} - var result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + var result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -899,8 +899,8 @@ test( "check form diff", function() { pending_date: '2015-01-28T09:39:00Z', } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -911,8 +911,8 @@ test( "check form diff", function() { pending_date: '2015-01-28T09:39:00Z', } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -925,8 +925,8 @@ test( "check form diff", function() { diff = { owner_id: '', } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -938,8 +938,8 @@ test( "check form diff", function() { owner_id: '', state_ids: ['1','5','6','7'], } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -951,8 +951,8 @@ test( "check form diff", function() { state_ids: [1,5,6,7], } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -966,8 +966,8 @@ test( "check form diff", function() { owner_id: '', state_ids: ['6'], } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -979,8 +979,8 @@ test( "check form diff", function() { state_ids: [1,5,6,7], } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -994,8 +994,8 @@ test( "check form diff", function() { diff = { owner_id: '' } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1010,8 +1010,8 @@ test( "check form diff", function() { state_id: '4', pending_time: '2015-01-28T11:34:00Z' } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1021,8 +1021,8 @@ test( "check form diff", function() { pending_time: null } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1036,8 +1036,8 @@ test( "check form diff", function() { }, } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1053,8 +1053,8 @@ test( "check form diff", function() { }, } diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1064,8 +1064,8 @@ test( "check form diff", function() { diff = { test: '123', } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1077,8 +1077,8 @@ test( "check form diff", function() { diff = { test: '123', } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1093,8 +1093,8 @@ test( "check form diff", function() { diff = { test: '123', } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1106,8 +1106,8 @@ test( "check form diff", function() { diff = { test: ['1','2','3','4'] } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1125,8 +1125,8 @@ test( "check form diff", function() { 2: '2', } } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { @@ -1143,23 +1143,23 @@ test( "check form diff", function() { diff = { test: '123', } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = undefined dataLast = undefined diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = {} dataLast = {"number":"10012","title":"some subject 123äöü","group_id":1,"owner_id":1,"customer_id":2,"state_id":3,"priority_id":2,"article":{"from":"Test Master Agent","to":"","cc":"","body":"dasdad","content_type":"text/html","ticket_id":12,"type_id":9,"sender_id":1,"internal":false,"form_id":"523405147"},"updated_at":"2015-01-29T09:22:23.000Z","pending_time":"2015-01-28T22:22:00.000Z","id":12} diff = {} - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') // do not compare content of data instances/objects no = function test_object() { @@ -1185,9 +1185,8 @@ test( "check form diff", function() { diff = { number:'10013', } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); - + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') dataNow = { number:'10013', @@ -1202,65 +1201,93 @@ test( "check form diff", function() { number:'10013', Article: ['2'], } - result = App.Utils.formDiff( dataNow, dataLast ) - deepEqual( result, diff, 'check form diff' ); - + result = App.Utils.formDiff(dataNow, dataLast) + deepEqual(result, diff, 'check form diff') }); // check decimal format -test( "check decimal format", function() { +test("check decimal format", function() { var string = '123' - var result = '123.00' - var verify = App.Utils.decimal( string ) - equal( verify, result, string ) + var result = '123.00' + var verify = App.Utils.decimal(string) + equal(verify, result, string) string = '0.6' - result = '0.60' - verify = App.Utils.decimal( string ) - equal( verify, result, string ) + result = '0.60' + verify = App.Utils.decimal(string) + equal(verify, result, string) string = '6' - result = '6.00' - verify = App.Utils.decimal( string ) - equal( verify, result, string ) + result = '6.00' + verify = App.Utils.decimal(string) + equal(verify, result, string) string = 6.5 - result = '6.50' - verify = App.Utils.decimal( string ) - equal( verify, result, string ) + result = '6.50' + verify = App.Utils.decimal(string) + equal(verify, result, string) string = '111111.6' - result = '111111.60' - verify = App.Utils.decimal( string ) - equal( verify, result, string ) + result = '111111.60' + verify = App.Utils.decimal(string) + equal(verify, result, string) string = '111111.622' - result = '111111.62' - verify = App.Utils.decimal( string ) - equal( verify, result, string ) + result = '111111.62' + verify = App.Utils.decimal(string) + equal(verify, result, string) string = 'abc.6' - result = 'abc.6' - verify = App.Utils.decimal( string ) - equal( verify, result, string ) + result = 'abc.6' + verify = App.Utils.decimal(string) + equal(verify, result, string) + + string = '' + result = '' + verify = App.Utils.decimal(string) + equal(verify, result, string) + + string = undefined + result = '' + verify = App.Utils.decimal(string) + equal(verify, result, string) + + string = null + result = '' + verify = App.Utils.decimal(string) + equal(verify, result, string) }); // check formatTime format -test( "check formatTime format", function() { +test("check formatTime format", function() { var string = '123' - var result = '123' - var verify = App.Utils.formatTime( string, 0 ) - equal( verify, result, string ) + var result = '123' + var verify = App.Utils.formatTime(string, 0) + equal(verify, result, string) string = '6' - result = '06' - verify = App.Utils.formatTime( string, 2 ) - equal( verify, result, string ) + result = '06' + verify = App.Utils.formatTime(string, 2) + equal(verify, result, string) + string = '' + result = '00' + verify = App.Utils.formatTime(string, 2) + equal(verify, result, string) + + string = undefined + result = '' + verify = App.Utils.formatTime(string, 2) + equal(verify, result, string) + + string = null + result = '' + verify = App.Utils.formatTime(string, 2) + equal(verify, result, string) }); } \ No newline at end of file