- <%- @article.html %>
+ <%- App.Utils.signatureIdentify( @article.html ) %>
diff --git a/public/assets/tests/html-utils.js b/public/assets/tests/html-utils.js
index 6879cdc64..a30c6ef7a 100644
--- a/public/assets/tests/html-utils.js
+++ b/public/assets/tests/html-utils.js
@@ -66,6 +66,41 @@ test( "text2html", function() {
});
+// html2text
+test( "html2text", function() {
+
+ var source = "
Some
Value
Test
"
+ var should = "Some\nValue\n\n\nTest"
+ 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 )
+
+ source = "
Some
Value
"
+ should = "Some\nValue"
+ result = App.Utils.html2text( source )
+ equal( result, should, source )
+
+ source = "
Some
<b>Value</b>
"
+ should = "Some\n
Value"
+ 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 )
+
+ source = "
test 123
--
Bob Smith
"
+ should = "test 123 \n\n\n\n\n\n\n\n\n\n\n--\nBob Smith"
+ result = App.Utils.html2text( source )
+ equal( result, should, source )
+
+});
+
// linkify
test( "linkify", function() {
@@ -451,6 +486,81 @@ test( "check signature", function() {
});
+// identify signature
+test( "identify signature", function() {
+
+ var message = "
test 123
"
+ var should = '
test 123
'
+ 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 )
+
+ message = "
test 123
--
Bob Smith
"
+ should = '
test 123
--
Bob Smith
'
+ 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 )
+ equal( result, should )
+
+ message = "
test 123
--no not match--
--
Bob Smith
"
+ should = '
test 123
--no not match--
--
Bob Smith
'
+ result = App.Utils.signatureIdentify( message )
+ 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 )
+ equal( result, should )
+
+ message = "
test 123
test 123
test 123
test 123
test 123
test 123
test 123
test 123
--
Bob Smith
"
+ should = "
test 123
test 123
test 123
test 123
test 123
test 123
test 123
test 123
--
Bob Smith
"
+ result = App.Utils.signatureIdentify( message )
+ equal( result, should )
+
+ message = "
test 123
test 123
test 123
test 123
test 123
test 123
test 123
test 123
--
Bob Smith
"
+ should = "
test 123
test 123
test 123
test 123
test 123
test 123
test 123
test 123
--
Bob Smith
"
+ result = App.Utils.signatureIdentify( message )
+
+ message = "
test 123
--no not match--
Bob Smith
On 01/04/15 10:55, Bob Smith wrote:
lalala
"
+ should = '
test 123
--no not match--
Bob Smith
On 01/04/15 10:55, Bob Smith wrote:
lalala
'
+ result = App.Utils.signatureIdentify( message )
+ equal( result, should )
+
+ message = "
test 123
--no not match--
Bob Smith
Am 01/04/15 10:55, Bob Smith schrieb:
lalala
"
+ should = '
test 123
--no not match--
Bob Smith
Am 01/04/15 10:55, Bob Smith schrieb:
lalala
'
+ result = App.Utils.signatureIdentify( message )
+ equal( result, should )
+
+ 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
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
lalala
'
+ result = App.Utils.signatureIdentify( message )
+ 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
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 )
+ equal( result, should )
+
+ 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 )
+ equal( result, should )
+
+ 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 )
+ equal( result, should )
+
+});
+
// replace tags
test( "check replace tags", function() {