html_utils.js 160 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314
  1. window.onload = function() {
  2. // textCleanup
  3. test("textCleanup", function() {
  4. var source = "Some\nValue\n\n\nTest"
  5. var should = "Some\nValue\n\nTest"
  6. var result = App.Utils.textCleanup(source)
  7. equal(result, should, source)
  8. source = "Some\nValue\n\n \n\n\nTest"
  9. should = "Some\nValue\n\nTest"
  10. result = App.Utils.textCleanup(source)
  11. equal(result, should, source)
  12. source = "Some\n\rValue\n\r\n\r\n\rTest"
  13. should = "Some\nValue\n\nTest"
  14. result = App.Utils.textCleanup(source)
  15. equal(result, should, source)
  16. source = "Some\n\rValue\n\r\n\r\n\rTest\r"
  17. should = "Some\nValue\n\nTest"
  18. result = App.Utils.textCleanup(source)
  19. equal(result, should, source)
  20. source = "Some\r\nValue\r\n\r\n\r\nTest\r\n"
  21. should = "Some\nValue\n\nTest"
  22. result = App.Utils.textCleanup(source)
  23. equal(result, should, source)
  24. source = "Some\r\nValue\r\n\r\n\r\n\r\n\r\n\r\nTest\r\n"
  25. should = "Some\nValue\n\nTest"
  26. result = App.Utils.textCleanup(source)
  27. equal(result, should, source)
  28. source = "> Welcome!\n> \n> Thank you for installing Zammad.\n> \n> You will find ..."
  29. should = "> Welcome!\n>\n> Thank you for installing Zammad.\n>\n> You will find ..."
  30. result = App.Utils.textCleanup(source)
  31. equal(result, should, source)
  32. });
  33. // text2html
  34. test("text2html", function() {
  35. var source = "Some\nValue\n\n\nTest"
  36. var should = "<div>Some</div><div>Value</div><div><br></div><div>Test</div>"
  37. var result = App.Utils.text2html(source)
  38. equal(result, should, source)
  39. source = "Some\nValue\n"
  40. should = "<div>Some</div><div>Value</div>"
  41. result = App.Utils.text2html(source)
  42. equal(result, should, source)
  43. source = "Some\n<b>Value</b>\n"
  44. should = "<div>Some</div><div>&lt;b&gt;Value&lt;/b&gt;</div>"
  45. result = App.Utils.text2html(source)
  46. equal(result, should, source)
  47. source = "> Welcome!\n> \n> Thank you for installing Zammad.\n> \n> You will find ..."
  48. should = "<div>&gt; Welcome!</div><div>&gt;</div><div>&gt; Thank you for installing Zammad.</div><div>&gt;</div><div>&gt; You will find ...</div>"
  49. result = App.Utils.text2html(source)
  50. equal(result, should, source)
  51. });
  52. // htmlStrip
  53. test("htmlStrip", function() {
  54. var source = $('<div><br><b>lala</b></div>')
  55. var should = '<div><b>lala</b></div>'
  56. App.Utils.htmlStrip(source)
  57. equal(source.get(0).outerHTML, should)
  58. source = $('<div><br><br><br><b>lala</b></div>')
  59. should = '<div><b>lala</b></div>'
  60. App.Utils.htmlStrip(source)
  61. equal(source.get(0).outerHTML, should)
  62. source = $('<div><br><br><br><b>lala</b><br><br></div>')
  63. should = '<div><b>lala</b></div>'
  64. App.Utils.htmlStrip(source)
  65. equal(source.get(0).outerHTML, should)
  66. source = $('<div><br><br><div><br></div><b>lala</b><br><br></div>')
  67. should = '<div><div><br></div><b>lala</b></div>'
  68. App.Utils.htmlStrip(source)
  69. equal(source.get(0).outerHTML, should)
  70. });
  71. // lastLineEmpty
  72. test("htmlLastLineEmpty", function() {
  73. var source = $('<div><br><b>lala</b></div>')
  74. equal(App.Utils.htmlLastLineEmpty(source), false)
  75. source = $('<div><br><b>lala</b><br></div>')
  76. equal(App.Utils.htmlLastLineEmpty(source), true)
  77. });
  78. // html2text
  79. test("html2text", function() {
  80. var source = "<div>Some</div><div>Value</div><div><br></div><div>Test</div>"
  81. var should = "Some\nValue\n\nTest"
  82. var result = App.Utils.html2text(source)
  83. equal(result, should, source)
  84. source = "<div>Some</div><div>Value</div>"
  85. should = "Some\nValue"
  86. result = App.Utils.html2text(source)
  87. equal(result, should, source)
  88. source = "<div>Some<br/>Value</div>"
  89. should = "Some\nValue"
  90. result = App.Utils.html2text(source)
  91. equal(result, should, source)
  92. source = "<div>Some &amp; &lt;Value&gt;</div>"
  93. should = "Some & <Value>"
  94. result = App.Utils.html2text(source)
  95. equal(result, should, source)
  96. source = "<div>Some</div><div>&lt;b&gt;Value&lt;/b&gt;</div>"
  97. should = "Some\n<b>Value</b>"
  98. result = App.Utils.html2text(source)
  99. equal(result, should, source)
  100. source = "<div>&gt; Welcome!</div><div>&gt;</div><div>&gt; Thank you for installing Zammad.</div><div>&gt;</div><div>&gt; You will find ...</div>"
  101. should = "> Welcome!\n>\n> Thank you for installing Zammad.\n>\n> You will find ..."
  102. result = App.Utils.html2text(source)
  103. equal(result, should, source)
  104. source = "<div>test 123 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>--<br/>Bob Smith</div>"
  105. should = "test 123 \n\n--\nBob Smith"
  106. result = App.Utils.html2text(source)
  107. equal(result, should, source)
  108. source = "test 123 <br><br><br><br><br><br><br><br><br><br><br>--<br>Bob Smith"
  109. should = "test 123 \n\n--\nBob Smith"
  110. result = App.Utils.html2text(source)
  111. equal(result, should, source)
  112. source = "<div>1<br><br><br><br><br><br><br><br><br><br></div><div>Von: Martin Edenhofer via Znuny Support [<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>]</div>\n<div>Gesendet: Donnerstag, 2. April 2015 11:32</div>"
  113. should = "1\n\nVon: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nGesendet: Donnerstag, 2. April 2015 11:32"
  114. result = App.Utils.html2text(source)
  115. equal(result, should, source)
  116. source = "<div>test 123<br/>lalala<p>--</p>some test</div>"
  117. should = "test 123\nlalala\n--\nsome test"
  118. result = App.Utils.html2text(source)
  119. equal(result, should, source)
  120. source = "<p><span>Was\nsoll verbessert werden:</span></p>"
  121. should = "Was soll verbessert werden:"
  122. result = App.Utils.html2text(source)
  123. equal(result, should, source)
  124. // in raw format, without cleanup
  125. source = "<div>Some</div><div>1234</div>"
  126. should = "Some\n1234\n"
  127. result = App.Utils.html2text(source, true)
  128. equal(result, should, source)
  129. source = "<div>Some</div><div> 1234</div>"
  130. should = "Some\n 1234\n"
  131. result = App.Utils.html2text(source, true)
  132. equal(result, should, source)
  133. source = "\n\n<div>Some</div>\n<div> 1234</div>"
  134. should = "Some\n 1234\n"
  135. result = App.Utils.html2text(source, true)
  136. equal(result, should, source)
  137. source = "<div>Some</div><div> 1234</div>"
  138. should = "Some\n 1234\n"
  139. result = App.Utils.html2text(source, true)
  140. equal(result, should, source)
  141. source = "<div>Some</div>\n\n<div> 1234</div>\n"
  142. should = "Some\n 1234\n"
  143. result = App.Utils.html2text(source, true)
  144. equal(result, should, source)
  145. source = "<div>test<br>new line<br></div>"
  146. should = "test\nnew line\n\n"
  147. result = App.Utils.html2text(source, true)
  148. equal(result, should, source)
  149. source = "<p><span>Was\nsoll verbessert werden:</span></p>"
  150. should = "Was soll verbessert werden:\n"
  151. result = App.Utils.html2text(source, true)
  152. equal(result, should, source)
  153. });
  154. // phoneify
  155. test("phoneify", function() {
  156. var source = "+1 123 123 123-123"
  157. var should = 'tel:+1123123123123'
  158. var result = App.Utils.phoneify(source)
  159. equal(result, should, source)
  160. source = "+1 123 123 A 123-123<>"
  161. should = 'tel:+1123123123123'
  162. result = App.Utils.phoneify(source)
  163. equal(result, should, source)
  164. source = "+1 (123) 123 123-123"
  165. should = 'tel:+1123123123123'
  166. result = App.Utils.phoneify(source)
  167. equal(result, should, source)
  168. source = "+1 (123) 123 1#23-123"
  169. should = 'tel:+11231231#23123'
  170. result = App.Utils.phoneify(source)
  171. equal(result, should, source)
  172. source = "+1 (123) 12*3 1#23-123"
  173. should = 'tel:+112312*31#23123'
  174. result = App.Utils.phoneify(source)
  175. equal(result, should, source)
  176. source = "+1 (123) 12+3"
  177. should = 'tel:+1123123'
  178. result = App.Utils.phoneify(source)
  179. equal(result, should, source)
  180. source = "+1 (123) 123 "
  181. should = 'tel:+1123123'
  182. result = App.Utils.phoneify(source)
  183. equal(result, should, source)
  184. source = " +1 (123) 123 "
  185. should = 'tel:+1123123'
  186. result = App.Utils.phoneify(source)
  187. equal(result, should, source)
  188. })
  189. // linkify
  190. test("linkify", function() {
  191. var source = "http://example.com"
  192. var should = '<a href="http://example.com" title="http://example.com" target="_blank">http://example.com</a>'
  193. var result = App.Utils.linkify(source)
  194. equal(result, should, source)
  195. source = "http://example.com?some_param=lalala"
  196. should = '<a href="http://example.com?some_param=lalala" title="http://example.com?some_param=lalala" target="_blank">http://example.com?some_param=lalala</a>'
  197. result = App.Utils.linkify(source)
  198. equal(result, should, source)
  199. source = "example.com"
  200. should = '<a href="http://example.com" title="http://example.com" target="_blank">example.com</a>'
  201. result = App.Utils.linkify(source)
  202. equal(result, should, source)
  203. source = "some text example.com"
  204. should = 'some text <a href="http://example.com" title="http://example.com" target="_blank">example.com</a>'
  205. result = App.Utils.linkify(source)
  206. equal(result, should, source)
  207. source = "example.com some text"
  208. should = '<a href="http://example.com" title="http://example.com" target="_blank">example.com</a> some text'
  209. result = App.Utils.linkify(source)
  210. equal(result, should, source)
  211. source = "test@example.com some text"
  212. should = 'test@example.com some text'
  213. result = App.Utils.linkify(source)
  214. equal(result, should, source)
  215. source = "abc test@example.com some text"
  216. should = 'abc test@example.com some text'
  217. result = App.Utils.linkify(source)
  218. equal(result, should, source)
  219. /*
  220. source = "<b>example.com</b>"
  221. should = '<b><a href="http://example.com" title="http://example.com" target="_blank">http://example.com</a></b>'
  222. result = App.Utils.linkify(source)
  223. equal(result, should, source)
  224. */
  225. });
  226. // htmlEscape
  227. test("htmlEscape", function() {
  228. var source = "<"
  229. var should = "&lt;"
  230. var result = App.Utils.htmlEscape(source)
  231. equal(result, should, source)
  232. source = ">"
  233. should = "&gt;"
  234. result = App.Utils.htmlEscape(source)
  235. equal(result, should, source)
  236. source = "&"
  237. should = "&amp;"
  238. result = App.Utils.htmlEscape(source)
  239. equal(result, should, source)
  240. source = "&amp;"
  241. should = "&amp;amp;"
  242. result = App.Utils.htmlEscape(source)
  243. equal(result, should, source)
  244. source = "&amp ;"
  245. should = "&amp;amp ;"
  246. result = App.Utils.htmlEscape(source)
  247. equal(result, should, source)
  248. source = "& amp;"
  249. should = "&amp; amp;"
  250. result = App.Utils.htmlEscape(source)
  251. equal(result, should, source)
  252. source = "'test'"
  253. should = "&#39;test&#39;"
  254. result = App.Utils.htmlEscape(source)
  255. equal(result, should, source)
  256. source = '"test"'
  257. should = "&quot;test&quot;"
  258. result = App.Utils.htmlEscape(source)
  259. equal(result, should, source)
  260. source = "<>"
  261. should = "&lt;&gt;"
  262. result = App.Utils.htmlEscape(source)
  263. equal(result, should, source)
  264. source = "<&lt;>"
  265. should = "&lt;&amp;lt;&gt;"
  266. result = App.Utils.htmlEscape(source)
  267. equal(result, should, source)
  268. });
  269. // htmlRemoveTags
  270. test("htmlRemoveTags", function() {
  271. var source = "<div>test</div>"
  272. //var should = "<div>test</div>"
  273. var should = "test"
  274. var result = App.Utils.htmlRemoveTags($(source))
  275. equal(result.html(), should, source)
  276. source = "<div>test<!-- some comment --></div>"
  277. //should = "<div>test</div>"
  278. should = "test"
  279. result = App.Utils.htmlRemoveTags($(source))
  280. equal(result.html(), should, source)
  281. source = "<a href=\"some_link\">some link to somewhere</a>"
  282. should = "some link to somewhere"
  283. result = App.Utils.htmlRemoveTags($(source))
  284. equal(result.html(), should, source)
  285. source = "<div><a href=\"some_link\">some link to somewhere</a></div>"
  286. //should = "<div>some link to somewhere</div>"
  287. should = "some link to somewhere"
  288. result = App.Utils.htmlRemoveTags($(source))
  289. equal(result.html(), should, source)
  290. source = "<div><a href=\"some_link\">some link to somewhere</a><input value=\"should not be shown\"></div>"
  291. //should = "<div>some link to somewhere</div>"
  292. should = "some link to somewhere"
  293. result = App.Utils.htmlRemoveTags($(source))
  294. equal(result.html(), should, source)
  295. source = "<div><a href=\"some_link\">some link to somewhere</a> <div><hr></div> <span>123</span> <img src=\"some_image\"/></div>"
  296. //should = "<div>some link to somewhere 123 </div>"
  297. should = "some link to somewhere 123 "
  298. result = App.Utils.htmlRemoveTags($(source))
  299. equal(result.html(), should, source)
  300. });
  301. // htmlRemoveRichtext
  302. test("htmlRemoveRichtext", function() {
  303. source = "<div><form class=\"xxx\">test 123</form><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
  304. //should = "<div>test 123</div>"
  305. should = "test 123"
  306. result = App.Utils.htmlRemoveRichtext($(source))
  307. equal(result.html(), should, source)
  308. source = "<div><textarea class=\"xxx\">test 123</textarea></div>"
  309. //should = "<div>test 123</div>"
  310. should = "test 123"
  311. result = App.Utils.htmlRemoveRichtext($(source))
  312. equal(result.html(), should, source)
  313. source = "<div><p wrap=\"\">test 123</p></div>"
  314. should = "<p>test 123</p>"
  315. result = App.Utils.htmlRemoveRichtext($(source))
  316. equal(result.html(), should, source)
  317. source = "<div><font size=\"3\" color=\"red\">This is some text!</font></div>"
  318. should = "This is some text!"
  319. result = App.Utils.htmlRemoveRichtext($(source))
  320. equal(result.html(), should, source)
  321. should = "This is some text!"
  322. result = App.Utils.htmlRemoveRichtext(source)
  323. equal(result.html(), should, source)
  324. var source = "<div><!--test comment--><a href=\"test\">test</a></div>"
  325. //var should = "<div>test</div>"
  326. var should = "test"
  327. var result = App.Utils.htmlRemoveRichtext($(source))
  328. equal(result.html(), should, source)
  329. source = "<div><!--[if !supportLists]--><span lang=\"DE\">1.1.1<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><!--[endif]--><span lang=\"DE\">Description</span></div>"
  330. //should = "<div><span>1.1.1<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span>Description</span></div>"
  331. should = "<span>1.1.1<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span>Description</span>"
  332. //should = '1.1.1 Description'
  333. result = App.Utils.htmlRemoveRichtext($(source))
  334. equal(result.html(), should, source)
  335. source = "<a href=\"some_link\">some link to somewhere</a>"
  336. should = "some link to somewhere"
  337. result = App.Utils.htmlRemoveRichtext($(source))
  338. equal(result.html(), should, source)
  339. source = "<div><a href=\"some_link\"></a> test </div>"
  340. //should = "<div> test </div>"
  341. should = " test "
  342. result = App.Utils.htmlRemoveRichtext($(source))
  343. equal(result.html(), should, source)
  344. source = "<div><b></b> test </div>"
  345. //should = "<div> test </div>"
  346. should = " test "
  347. result = App.Utils.htmlRemoveRichtext($(source))
  348. equal(result.html(), should, source)
  349. source = "<div><div><b></b> test </div></div>"
  350. //should = "<div><div> test </div></div>"
  351. should = "<div> test </div>"
  352. result = App.Utils.htmlRemoveRichtext($(source))
  353. equal(result.html(), should, source)
  354. source = "<div><div><b></b> test <input value=\"should not be shown\"></div></div>"
  355. //should = "<div><div> test </div></div>"
  356. should = "<div> test </div>"
  357. result = App.Utils.htmlRemoveRichtext($(source))
  358. equal(result.html(), should, source)
  359. source = "<div><div><b></b> test </div><span>123</span></div>"
  360. //should = "<div><div> test </div><span>123</span></div>"
  361. should = "<div> test </div><span>123</span>"
  362. //should = '<div> test </div>123'
  363. result = App.Utils.htmlRemoveRichtext($(source))
  364. equal(result.html(), should, source)
  365. source = "<div><div class=\"xxx\" title=\"some title\" lang=\"en\"><b></b> test </div></div>"
  366. //should = "<div><div> test </div></div>"
  367. should = "<div> test </div>"
  368. result = App.Utils.htmlRemoveRichtext($(source))
  369. equal(result.html(), should, source)
  370. source = "<div><textarea class=\"xxx\"> test </textarea></div>"
  371. //should = "<div> test </div>"
  372. should = " test "
  373. result = App.Utils.htmlRemoveRichtext($(source))
  374. equal(result.html(), should, source)
  375. source = "<div><br></div>"
  376. //should = "<div><br></div>"
  377. should = "<br>"
  378. result = App.Utils.htmlRemoveRichtext($(source))
  379. equal(result.html(), should, source)
  380. source = "<div><div class=\"xxx\"><br></div></div>"
  381. //should = "<div><div><br></div></div>"
  382. should = "<div><br></div>"
  383. result = App.Utils.htmlRemoveRichtext($(source))
  384. equal(result.html(), should, source)
  385. source = "<div><form class=\"xxx\">test 123</form></div>"
  386. //should = "<div>test 123</div>"
  387. should = "test 123"
  388. result = App.Utils.htmlRemoveRichtext($(source))
  389. equal(result.html(), should, source)
  390. source = "<div><div><label for=\"Ticket_888344_group_id\">Gruppe <span>*</span></label></div><div><div></div></div><div><div><span></span><span></span></div></div><div><div><label for=\"Ticket_888344_owner_id\">Besitzer <span></span></label></div><div><div></div></div></div><div><div><div><svg><use xlink:href=\"http://localhost:3000/assets/images/icons.svg#icon-arrow-down\"></use></svg></div><span></span><span></span></div></div><div><div> <label for=\"Ticket_888344_state_id\">Status <span>*</span></label></div></div></div>\n"
  391. //should = "<div>test 123</div>"
  392. should = '<div>Gruppe <span>*</span></div><div><div></div></div><div><div><span></span><span></span></div></div><div><div>Besitzer <span></span></div><div><div></div></div></div><div><div><div></div><span></span><span></span></div></div><div><div> Status <span>*</span></div></div>'
  393. result = App.Utils.htmlRemoveRichtext(source)
  394. equal(result.html(), should, source)
  395. source = "<div><font size=\"3\" color=\"red\">This is some text!</font><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
  396. should = "This is some text!"
  397. result = App.Utils.htmlRemoveRichtext($(source))
  398. equal(result.html(), should, source)
  399. should = "This is some text!"
  400. result = App.Utils.htmlRemoveRichtext(source)
  401. equal(result.html(), should, source)
  402. var source = "<div><!--test comment--><a href=\"test\">test</a></div>"
  403. var should = "<div>test</div>"
  404. var result = App.Utils.htmlRemoveRichtext($(source))
  405. equal(result.get(0).outerHTML, should, source)
  406. source = "<div><small>some link to somewhere</small></a>"
  407. should = "<div>some link to somewhere</div>"
  408. result = App.Utils.htmlRemoveRichtext($(source))
  409. equal(result.get(0).outerHTML, should, source)
  410. source = "<div><div class=\"xxx\"><br></div></div>"
  411. should = "<div><div><br></div></div>"
  412. result = App.Utils.htmlRemoveRichtext($(source))
  413. equal(result.get(0).outerHTML, should, source)
  414. source = "<div><table bgcolor=\"green\" aaa=\"1\"><thead><tr><th>111</th><th colspan=\"2\" abc=\"a\">aaa</th></tr></thead><tbody><tr><td>key</td><td>value</td></tr></tbody></table></div>"
  415. should = "<div>111aaakeyvalue</div>"
  416. result = App.Utils.htmlRemoveRichtext(source, true)
  417. equal(result.get(0).outerHTML, should, source)
  418. });
  419. // htmlCleanup
  420. test("htmlCleanup", function() {
  421. var source = "<div><!--test comment--><a href=\"test\">test</a></div>"
  422. //var should = "<div>test</div>"
  423. var should = "<a href=\"test\">test</a>"
  424. var result = App.Utils.htmlCleanup($(source))
  425. equal(result.html(), should, source)
  426. source = "<div><!--test comment--><a href=\"test\">test</a></div>"
  427. should = "<a href=\"test\">test</a>"
  428. result = App.Utils.htmlCleanup(source)
  429. equal(result.html(), should, source)
  430. source = "some link to somewhere"
  431. should = "some link to somewhere"
  432. result = App.Utils.htmlCleanup(source)
  433. equal(result.html(), should, source)
  434. source = "<li>a</li><li>b</li>"
  435. should = "<li>a</li><li>b</li>"
  436. result = App.Utils.htmlCleanup(source)
  437. equal(result.html(), should, source)
  438. source = "<a href=\"some_link\">some link to somewhere</a>"
  439. should = "some link to somewhere"
  440. result = App.Utils.htmlCleanup($(source))
  441. equal(result.html(), should, source)
  442. source = "<p><a href=\"some_link\">some link to somewhere</a><p>"
  443. should = "<a href=\"some_link\">some link to somewhere</a>"
  444. result = App.Utils.htmlCleanup($(source))
  445. equal(result.html(), should, source)
  446. source = "<div><h1>some link to somewhere</h1></div>"
  447. should = "<h1>some link to somewhere</h1>"
  448. result = App.Utils.htmlCleanup($(source))
  449. equal(result.html(), should, source)
  450. source = "<div><p id=\"123\" data-id=\"abc\">some link to somewhere</p></div>"
  451. should = "<p>some link to somewhere</p>"
  452. result = App.Utils.htmlCleanup($(source))
  453. equal(result.html(), should, source)
  454. source = "<div><small>some link to somewhere</small></a>"
  455. //should = "<div>some link to somewhere</div>"
  456. should = "some link to somewhere"
  457. result = App.Utils.htmlCleanup($(source))
  458. equal(result.html(), should, source)
  459. source = "<div><time>some link to somewhere</time></a>"
  460. //should = "<div>some link to somewhere</div>"
  461. should = "some link to somewhere"
  462. result = App.Utils.htmlCleanup($(source))
  463. equal(result.html(), should, source)
  464. source = "<div><h1>some h1 for somewhere</h1><p><hr></p></div>"
  465. should = "<h1>some h1 for somewhere</h1><p></p><hr><p></p>"
  466. result = App.Utils.htmlCleanup($(source))
  467. equal(result.html(), should, source)
  468. source = "<div><br></div>"
  469. //should = "<div><br></div>"
  470. should = "<br>"
  471. result = App.Utils.htmlCleanup($(source))
  472. equal(result.html(), should, source)
  473. source = "<div><div class=\"xxx\"><br></div></div>"
  474. //should = "<div><div><br></div></div>"
  475. should = "<div><br></div>"
  476. result = App.Utils.htmlCleanup($(source))
  477. equal(result.html(), should, source)
  478. source = "<div><form class=\"xxx\">test 123</form></div>"
  479. //should = "<div>test 123<br></div>"
  480. should = "test 123"
  481. result = App.Utils.htmlCleanup($(source))
  482. equal(result.html(), should, source)
  483. source = "<div><form class=\"xxx\">test 123</form> some other value</div>"
  484. //should = "<div>test 123 some other value</div>"
  485. should = "test 123 some other value"
  486. result = App.Utils.htmlCleanup($(source))
  487. equal(result.html(), should, source)
  488. source = "<div><form class=\"xxx\">test 123</form> some other value<input value=\"should not be shown\"></div>"
  489. //should = "<div>test 123 some other value</div>"
  490. should = "test 123 some other value"
  491. result = App.Utils.htmlCleanup($(source))
  492. equal(result.html(), should, source)
  493. source = "<div><font size=\"3\" color=\"red\">This is some text!</font><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
  494. //should = "<div>This is some text!</div>"
  495. should = "This is some text!"
  496. result = App.Utils.htmlCleanup($(source))
  497. equal(result.html(), should, source)
  498. source = "<div><p>some link to somewhere from word<w:sdt>abc</w:sdt></p><o:p></o:p></a>"
  499. //should = "<div><p>some link to somewhere from wordabc</p></div>"
  500. should = '<p>some link to somewhere from wordabc</p>'
  501. result = App.Utils.htmlCleanup($(source))
  502. equal(result.html(), should, source)
  503. source = "<div><div><label for=\"Ticket_888344_group_id\">Gruppe <span>*</span></label></div><div><div></div></div><div><div><span></span><span></span></div></div><div><div><label for=\"Ticket_888344_owner_id\">Besitzer <span></span></label></div><div><div></div></div></div><div><div><div><svg><use xlink:href=\"http://localhost:3000/assets/images/icons.svg#icon-arrow-down\"></use></svg></div><span></span><span></span></div></div><div><div> <label for=\"Ticket_888344_state_id\">Status <span>*</span></label></div></div></div>\n"
  504. //should = "<div>test 123</div>"
  505. should = '<div>Gruppe <span>*</span></div><div><div></div></div><div><div><span></span><span></span></div></div><div><div>Besitzer <span></span></div><div><div></div></div></div><div><div><div></div><span></span><span></span></div></div><div><div> Status <span>*</span></div></div>'
  506. result = App.Utils.htmlCleanup(source)
  507. equal(result.html(), should, source)
  508. source = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"\nxmlns:w=\"urn:schemas-microsoft-com:office:word\"\nxmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\"\nxmlns=\"http://www.w3.org/TR/REC-html40\">\n\n<head>\n<meta name=Titel content=\"\">\n<meta name=Stichwörter content=\"\">\n<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">\n<meta name=ProgId content=Word.Document>\n<meta name=Generator content=\"Microsoft Word 15\">\n<meta name=Originator content=\"Microsoft Word 15\">\n<link rel=File-List\nhref=\"file://localhost/Users/johannes/Library/Group%20Containers/UBF8T346G9.Office/msoclip1/01/clip_filelist.xml\">\n<!--[if gte mso 9]><xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG/>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n</xml><![endif]-->\n<link rel=themeData\nhref=\"file://localhost/Users/johannes/Library/Group%20Containers/UBF8T346G9.Office/msoclip1/01/clip_themedata.thmx\">\n<!--[if gte mso 9]><xml>\n <w:WordDocument>\n <w:View>Normal</w:View>\n <w:Zoom>0</w:Zoom>\n <w:TrackMoves/>\n <w:TrackFormatting/>\n <w:HyphenationZone>21</w:HyphenationZone>\n <w:PunctuationKerning/>\n <w:ValidateAgainstSchemas/>\n <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>\n <w:IgnoreMixedContent>false</w:IgnoreMixedContent>\n <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>\n <w:DoNotPromoteQF/>\n <w:LidThemeOther>DE</w:LidThemeOther>\n <w:LidThemeAsian>X-NONE</w:LidThemeAsian>\n <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>\n <w:Compatibility>\n <w:BreakWrappedTables/>\n <w:SnapToGridInCell/>\n <w:WrapTextWithPunct/>\n <w:UseAsianBreakRules/>\n <w:DontGrowAutofit/>\n <w:SplitPgBreakAndParaMark/>\n <w:EnableOpenTypeKerning/>\n <w:DontFlipMirrorIndents/>\n <w:OverrideTableStyleHps/>\n </w:Compatibility>\n <m:mathPr>\n <m:mathFont m:val=\"Cambria Math\"/>\n <m:brkBin m:val=\"before\"/>\n <m:brkBinSub m:val=\"&#45;-\"/>\n <m:smallFrac m:val=\"off\"/>\n <m:dispDef/>\n <m:lMargin m:val=\"0\"/>\n <m:rMargin m:val=\"0\"/>\n <m:defJc m:val=\"centerGroup\"/>\n <m:wrapIndent m:val=\"1440\"/>\n <m:intLim m:val=\"subSup\"/>\n <m:naryLim m:val=\"undOvr\"/>\n </m:mathPr></w:WordDocument>\n</xml><![endif]--><!--[if gte mso 9]><xml>\n <w:LatentStyles DefLockedState=\"false\" DefUnhideWhenUsed=\"false\"\n DefSemiHidden=\"false\" DefQFormat=\"false\" DefPriority=\"99\"\n LatentStyleCount=\"380\">\n <w:LsdException Locked=\"false\" Priority=\"0\" QFormat=\"true\" Name=\"Normal\"/>\n <w:LsdException Locked=\"false\" Priority=\"0\" QFormat=\"true\" Name=\"heading 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"0\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"0\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"0\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"0\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"9\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"9\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 7\"/>\n <w:LsdException Locked=\"false\" Priority=\"9\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 8\"/>\n <w:LsdException Locked=\"false\" Priority=\"9\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"heading 9\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 6\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 7\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 8\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index 9\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 7\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 8\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"toc 9\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Normal Indent\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"footnote text\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"annotation text\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"header\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"footer\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"index heading\"/>\n <w:LsdException Locked=\"false\" Priority=\"35\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"caption\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"table of figures\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"envelope address\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"envelope return\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"footnote reference\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"annotation reference\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"line number\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"page number\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"endnote reference\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"endnote text\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"table of authorities\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"macro\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"toa heading\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Bullet\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Number\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Bullet 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Bullet 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Bullet 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Bullet 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Number 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Number 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Number 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Number 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"10\" QFormat=\"true\" Name=\"Title\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Closing\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Signature\"/>\n <w:LsdException Locked=\"false\" Priority=\"1\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"Default Paragraph Font\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text Indent\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Continue\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Continue 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Continue 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Continue 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"List Continue 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Message Header\"/>\n <w:LsdException Locked=\"false\" Priority=\"11\" QFormat=\"true\" Name=\"Subtitle\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Salutation\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Date\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text First Indent\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text First Indent 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Heading\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text Indent 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Body Text Indent 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Block Text\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Hyperlink\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"FollowedHyperlink\"/>\n <w:LsdException Locked=\"false\" Priority=\"22\" QFormat=\"true\" Name=\"Strong\"/>\n <w:LsdException Locked=\"false\" Priority=\"20\" QFormat=\"true\" Name=\"Emphasis\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Document Map\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Plain Text\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"E-mail Signature\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Top of Form\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Bottom of Form\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Normal (Web)\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Acronym\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Address\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Cite\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Code\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Definition\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Keyboard\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Preformatted\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Sample\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Typewriter\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"HTML Variable\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Normal Table\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"annotation subject\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"No List\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Outline List 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Outline List 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Outline List 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Simple 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Simple 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Simple 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Classic 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Classic 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Classic 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Classic 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Colorful 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Colorful 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Colorful 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Columns 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Columns 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Columns 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Columns 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Columns 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 6\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 7\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Grid 8\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 6\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 7\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table List 8\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table 3D effects 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table 3D effects 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table 3D effects 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Contemporary\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Elegant\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Professional\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Subtle 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Subtle 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Web 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Web 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Web 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Balloon Text\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" Name=\"Table Grid\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Table Theme\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 2\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 3\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 4\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 5\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 6\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 7\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 8\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" UnhideWhenUsed=\"true\"\n Name=\"Note Level 9\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" Name=\"Placeholder Text\"/>\n <w:LsdException Locked=\"false\" Priority=\"1\" QFormat=\"true\" Name=\"No Spacing\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1 Accent 1\"/>\n <w:LsdException Locked=\"false\" SemiHidden=\"true\" Name=\"Revision\"/>\n <w:LsdException Locked=\"false\" Priority=\"34\" QFormat=\"true\"\n Name=\"List Paragraph\"/>\n <w:LsdException Locked=\"false\" Priority=\"29\" QFormat=\"true\" Name=\"Quote\"/>\n <w:LsdException Locked=\"false\" Priority=\"30\" QFormat=\"true\"\n Name=\"Intense Quote\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"60\" Name=\"Light Shading Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"61\" Name=\"Light List Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"62\" Name=\"Light Grid Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"63\" Name=\"Medium Shading 1 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"64\" Name=\"Medium Shading 2 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"65\" Name=\"Medium List 1 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"66\" Name=\"Medium List 2 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"67\" Name=\"Medium Grid 1 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"68\" Name=\"Medium Grid 2 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"69\" Name=\"Medium Grid 3 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"70\" Name=\"Dark List Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"71\" Name=\"Colorful Shading Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"72\" Name=\"Colorful List Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"73\" Name=\"Colorful Grid Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"19\" QFormat=\"true\"\n Name=\"Subtle Emphasis\"/>\n <w:LsdException Locked=\"false\" Priority=\"21\" QFormat=\"true\"\n Name=\"Intense Emphasis\"/>\n <w:LsdException Locked=\"false\" Priority=\"31\" QFormat=\"true\"\n Name=\"Subtle Reference\"/>\n <w:LsdException Locked=\"false\" Priority=\"32\" QFormat=\"true\"\n Name=\"Intense Reference\"/>\n <w:LsdException Locked=\"false\" Priority=\"33\" QFormat=\"true\" Name=\"Book Title\"/>\n <w:LsdException Locked=\"false\" Priority=\"37\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" Name=\"Bibliography\"/>\n <w:LsdException Locked=\"false\" Priority=\"39\" SemiHidden=\"true\"\n UnhideWhenUsed=\"true\" QFormat=\"true\" Name=\"TOC Heading\"/>\n <w:LsdException Locked=\"false\" Priority=\"41\" Name=\"Plain Table 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"42\" Name=\"Plain Table 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"43\" Name=\"Plain Table 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"44\" Name=\"Plain Table 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"45\" Name=\"Plain Table 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"40\" Name=\"Grid Table Light\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\" Name=\"Grid Table 1 Light\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\" Name=\"Grid Table 6 Colorful\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\" Name=\"Grid Table 7 Colorful\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"Grid Table 1 Light Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"Grid Table 6 Colorful Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"Grid Table 7 Colorful Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"Grid Table 1 Light Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"Grid Table 6 Colorful Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"Grid Table 7 Colorful Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"Grid Table 1 Light Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"Grid Table 6 Colorful Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"Grid Table 7 Colorful Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"Grid Table 1 Light Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"Grid Table 6 Colorful Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"Grid Table 7 Colorful Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"Grid Table 1 Light Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"Grid Table 6 Colorful Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"Grid Table 7 Colorful Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"Grid Table 1 Light Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"Grid Table 2 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"Grid Table 3 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"Grid Table 4 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"Grid Table 5 Dark Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"Grid Table 6 Colorful Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"Grid Table 7 Colorful Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\" Name=\"List Table 1 Light\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\" Name=\"List Table 6 Colorful\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\" Name=\"List Table 7 Colorful\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"List Table 1 Light Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4 Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"List Table 6 Colorful Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"List Table 7 Colorful Accent 1\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"List Table 1 Light Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4 Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"List Table 6 Colorful Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"List Table 7 Colorful Accent 2\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"List Table 1 Light Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4 Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"List Table 6 Colorful Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"List Table 7 Colorful Accent 3\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"List Table 1 Light Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4 Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"List Table 6 Colorful Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"List Table 7 Colorful Accent 4\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"List Table 1 Light Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4 Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"List Table 6 Colorful Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"List Table 7 Colorful Accent 5\"/>\n <w:LsdException Locked=\"false\" Priority=\"46\"\n Name=\"List Table 1 Light Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"47\" Name=\"List Table 2 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"48\" Name=\"List Table 3 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"49\" Name=\"List Table 4 Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"50\" Name=\"List Table 5 Dark Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"51\"\n Name=\"List Table 6 Colorful Accent 6\"/>\n <w:LsdException Locked=\"false\" Priority=\"52\"\n Name=\"List Table 7 Colorful Accent 6\"/>\n </w:LatentStyles>\n</xml><![endif]-->\n<style>\n<!--\n /* Font Definitions */\n@font-face\n {font-family:\"Courier New\";\n panose-1:2 7 3 9 2 2 5 2 4 4;\n mso-font-charset:0;\n mso-generic-font-family:auto;\n mso-font-pitch:variable;\n mso-font-signature:-536859905 -1073711037 9 0 511 0;}\n@font-face\n {font-family:Wingdings;\n panose-1:5 0 0 0 0 0 0 0 0 0;\n mso-font-charset:2;\n mso-generic-font-family:auto;\n mso-font-pitch:variable;\n mso-font-signature:0 268435456 0 0 -2147483648 0;}\n@font-face\n {font-family:\"Cambria Math\";\n panose-1:2 4 5 3 5 4 6 3 2 4;\n mso-font-charset:0;\n mso-generic-font-family:auto;\n mso-font-pitch:variable;\n mso-font-signature:-536870145 1107305727 0 0 415 0;}\n@font-face\n {font-family:Calibri;\n panose-1:2 15 5 2 2 2 4 3 2 4;\n mso-font-charset:0;\n mso-generic-font-family:auto;\n mso-font-pitch:variable;\n mso-font-signature:-536870145 1073786111 1 0 415 0;}\n /* Style Definitions */\np.MsoNormal, li.MsoNormal, div.MsoNormal\n {mso-style-unhide:no;\n mso-style-qformat:yes;\n mso-style-parent:\"\";\n margin:0cm;\n margin-bottom:.0001pt;\n mso-pagination:widow-orphan;\n font-size:12.0pt;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-fareast-font-family:Calibri;\n mso-fareast-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-bidi-font-family:\"Times New Roman\";\n mso-bidi-theme-font:minor-bidi;\n mso-fareast-language:EN-US;}\np.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph\n {mso-style-priority:34;\n mso-style-unhide:no;\n mso-style-qformat:yes;\n margin-top:0cm;\n margin-right:0cm;\n margin-bottom:0cm;\n margin-left:36.0pt;\n margin-bottom:.0001pt;\n mso-add-space:auto;\n mso-pagination:widow-orphan;\n font-size:12.0pt;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-fareast-font-family:Calibri;\n mso-fareast-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-bidi-font-family:\"Times New Roman\";\n mso-bidi-theme-font:minor-bidi;\n mso-fareast-language:EN-US;}\np.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst\n {mso-style-priority:34;\n mso-style-unhide:no;\n mso-style-qformat:yes;\n mso-style-type:export-only;\n margin-top:0cm;\n margin-right:0cm;\n margin-bottom:0cm;\n margin-left:36.0pt;\n margin-bottom:.0001pt;\n mso-add-space:auto;\n mso-pagination:widow-orphan;\n font-size:12.0pt;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-fareast-font-family:Calibri;\n mso-fareast-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-bidi-font-family:\"Times New Roman\";\n mso-bidi-theme-font:minor-bidi;\n mso-fareast-language:EN-US;}\np.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle\n {mso-style-priority:34;\n mso-style-unhide:no;\n mso-style-qformat:yes;\n mso-style-type:export-only;\n margin-top:0cm;\n margin-right:0cm;\n margin-bottom:0cm;\n margin-left:36.0pt;\n margin-bottom:.0001pt;\n mso-add-space:auto;\n mso-pagination:widow-orphan;\n font-size:12.0pt;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-fareast-font-family:Calibri;\n mso-fareast-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-bidi-font-family:\"Times New Roman\";\n mso-bidi-theme-font:minor-bidi;\n mso-fareast-language:EN-US;}\np.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast\n {mso-style-priority:34;\n mso-style-unhide:no;\n mso-style-qformat:yes;\n mso-style-type:export-only;\n margin-top:0cm;\n margin-right:0cm;\n margin-bottom:0cm;\n margin-left:36.0pt;\n margin-bottom:.0001pt;\n mso-add-space:auto;\n mso-pagination:widow-orphan;\n font-size:12.0pt;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-fareast-font-family:Calibri;\n mso-fareast-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-bidi-font-family:\"Times New Roman\";\n mso-bidi-theme-font:minor-bidi;\n mso-fareast-language:EN-US;}\n.MsoChpDefault\n {mso-style-type:export-only;\n mso-default-props:yes;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-fareast-font-family:Calibri;\n mso-fareast-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-bidi-font-family:\"Times New Roman\";\n mso-bidi-theme-font:minor-bidi;\n mso-fareast-language:EN-US;}\n@page WordSection1\n {size:595.0pt 842.0pt;\n margin:70.85pt 70.85pt 2.0cm 70.85pt;\n mso-header-margin:35.4pt;\n mso-footer-margin:35.4pt;\n mso-paper-source:0;}\ndiv.WordSection1\n {page:WordSection1;}\n /* List Definitions */\n@list l0\n {mso-list-id:240799396;\n mso-list-type:hybrid;\n mso-list-template-ids:1377200210 67567617 67567619 67567621 67567617 67567619 67567621 67567617 67567619 67567621;}\n@list l0:level1\n {mso-level-number-format:bullet;\n mso-level-text:;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:Symbol;}\n@list l0:level2\n {mso-level-number-format:bullet;\n mso-level-text:o;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:\"Courier New\";}\n@list l0:level3\n {mso-level-number-format:bullet;\n mso-level-text:;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:Wingdings;}\n@list l0:level4\n {mso-level-number-format:bullet;\n mso-level-text:;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:Symbol;}\n@list l0:level5\n {mso-level-number-format:bullet;\n mso-level-text:o;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:\"Courier New\";}\n@list l0:level6\n {mso-level-number-format:bullet;\n mso-level-text:;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:Wingdings;}\n@list l0:level7\n {mso-level-number-format:bullet;\n mso-level-text:;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:Symbol;}\n@list l0:level8\n {mso-level-number-format:bullet;\n mso-level-text:o;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:\"Courier New\";}\n@list l0:level9\n {mso-level-number-format:bullet;\n mso-level-text:;\n mso-level-tab-stop:none;\n mso-level-number-position:left;\n text-indent:-18.0pt;\n font-family:Wingdings;}\nol\n {margin-bottom:0cm;}\nul\n {margin-bottom:0cm;}\n-->\n</style>\n<!--[if gte mso 10]>\n<style>\n /* Style Definitions */\ntable.MsoNormalTable\n {mso-style-name:\"Normale Tabelle\";\n mso-tstyle-rowband-size:0;\n mso-tstyle-colband-size:0;\n mso-style-noshow:yes;\n mso-style-priority:99;\n mso-style-parent:\"\";\n mso-padding-alt:0cm 5.4pt 0cm 5.4pt;\n mso-para-margin:0cm;\n mso-para-margin-bottom:.0001pt;\n mso-pagination:widow-orphan;\n font-size:12.0pt;\n font-family:Calibri;\n mso-ascii-font-family:Calibri;\n mso-ascii-theme-font:minor-latin;\n mso-hansi-font-family:Calibri;\n mso-hansi-theme-font:minor-latin;\n mso-fareast-language:EN-US;}\n</style>\n<![endif]-->\n</head>\n\n<body bgcolor=white lang=DE style='tab-interval:35.4pt'>\n<!--StartFragment-->\n\n<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span\nstyle='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:\nSymbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</span></span></span><![endif]>Test 1<o:p></o:p></p>\n\n<p class=MsoListParagraphCxSpMiddle style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span\nstyle='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:\nSymbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</span></span></span><![endif]>Test 2<o:p></o:p></p>\n\n<p class=MsoListParagraphCxSpMiddle style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span\nstyle='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:\nSymbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</span></span></span><![endif]><i style='mso-bidi-font-style:normal'>Test 3<o:p></o:p></i></p>\n\n<p class=MsoListParagraphCxSpMiddle style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span\nstyle='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:\nSymbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</span></span></span><![endif]>Test 4<o:p></o:p></p>\n\n<p class=MsoListParagraphCxSpLast style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span\nstyle='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:\nSymbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</span></span></span><![endif]><b style='mso-bidi-font-weight:normal'>Test5<o:p></o:p></b></p>\n\n<!--EndFragment-->\n</body>\n\n</html>"
  509. should = "<ul><li>Test 1</li><li>Test 2</li><li><i>Test 3</i></li><li>Test 4</li><li><b>Test5</b></li></ul>"
  510. result = App.Utils.htmlCleanup(source)
  511. equal(result.html().trim(), should, source)
  512. source = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<html>\n<head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n <title></title>\n <meta name=\"generator\" content=\"LibreOffice 4.4.7.2 (MacOSX)\"/>\n <style type=\"text/css\">\n @page { margin: 0.79in }\n p { margin-bottom: 0.1in; line-height: 120% }\n a:link { so-language: zxx }\n </style>\n</head>\n<body lang=\"en-US\" dir=\"ltr\">\n<p align=\"center\" style=\"margin-bottom: 0in; line-height: 100%\">1.\nGehe a<b>uf </b><b>https://www.pfe</b>rdiathek.ge</p>\n<p align=\"center\" style=\"margin-bottom: 0in; line-height: 100%\"><br/>\n\n</p>\n<p align=\"center\" style=\"margin-bottom: 0in; line-height: 100%\">2.\nMel<font color=\"#800000\">de Dich mit folgende</font> Zugangsdaten an:</p>\n<p align=\"center\" style=\"margin-bottom: 0in; line-height: 100%\">Benutzer:\nme@xxx.net</p>\n<p align=\"center\" style=\"margin-bottom: 0in; line-height: 100%\">Passwort:\nxxx.</p>\n</body>\n</html>"
  513. should = "\n\n\n \n \n \n \n\n\n<p>1.\nGehe a<b>uf </b><b>https://www.pfe</b>rdiathek.ge</p>\n<p><br>\n\n</p>\n<p>2.\nMelde Dich mit folgende Zugangsdaten an:</p>\n<p>Benutzer:\nme@xxx.net</p>\n<p>Passwort:\nxxx.</p>\n\n"
  514. result = App.Utils.htmlCleanup(source)
  515. equal(result.html(), should, source)
  516. source = "<table bgcolor=\"green\" aaa=\"1\"><thead><tr><th colspan=\"2\" abc=\"a\">aaa</th></tr></thead><tbody><tr><td>value</td></tr></tbody></table>"
  517. should = "<table bgcolor=\"green\"><thead><tr><th colspan=\"2\">aaa</th></tr></thead><tbody><tr><td>value</td></tr></tbody></table>"
  518. result = App.Utils.htmlCleanup(source)
  519. equal(result.get(0).outerHTML, should, source)
  520. // strip out browser-inserted (broken) link (see https://github.com/zammad/zammad/issues/2019)
  521. source = "<div><a href=\"https://example.com/#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}\">test</a></div>"
  522. should = "<a href=\"#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}\">test</a>"
  523. result = App.Utils.htmlCleanup(source)
  524. equal(result.html(), should, source)
  525. source = "<table bgcolor=\"green\" aaa=\"1\" style=\"color: red\"><thead><tr style=\"margin-top: 10px\"><th colspan=\"2\" abc=\"a\" style=\"margin-top: 12px\">aaa</th></tr></thead><tbody><tr><td>value</td></tr></tbody></table>"
  526. should = "<table bgcolor=\"green\" style=\"color:red;\"><thead><tr style=\"margin-top:10px;\"><th colspan=\"2\" style=\"margin-top:12px;\">aaa</th></tr></thead><tbody><tr><td>value</td></tr></tbody></table>"
  527. result = App.Utils.htmlCleanup(source)
  528. result.get(0).outerHTML
  529. //equal(result.get(0).outerHTML, should, source) / string order is different on browsers
  530. equal(result.first().attr('bgcolor'), 'green')
  531. equal(result.first().attr('style'), 'color:red;')
  532. equal(result.first().attr('aaa'), undefined)
  533. equal(result.find('tr').first().attr('style'), 'margin-top:10px;')
  534. equal(result.find('th').first().attr('colspan'), '2')
  535. equal(result.find('th').first().attr('abc'), undefined)
  536. equal(result.find('th').first().attr('style'), 'margin-top:12px;')
  537. source = "<table bgcolor=\"green\" aaa=\"1\" style=\"color:red; display: none;\"><thead><tr><th colspan=\"2\" abc=\"a\">aaa</th></tr></thead><tbody><tr><td>value</td></tr></tbody></table>"
  538. should = "<table bgcolor=\"green\" style=\"color:red;\"><thead><tr><th colspan=\"2\">aaa</th></tr></thead><tbody><tr><td>value</td></tr></tbody></table>"
  539. result = App.Utils.htmlCleanup(source)
  540. //equal(result.get(0).outerHTML, should, source) / string order is different on browsers
  541. equal(result.first().attr('bgcolor'), 'green')
  542. equal(result.first().attr('style'), 'color:red;')
  543. equal(result.first().attr('aaa'), undefined)
  544. equal(result.find('tr').first().attr('style'), undefined)
  545. equal(result.find('th').first().attr('colspan'), '2')
  546. equal(result.find('th').first().attr('abc'), undefined)
  547. equal(result.find('th').first().attr('style'), undefined)
  548. });
  549. // wrap
  550. test("wrap", function() {
  551. var source = "some text"
  552. var should = 'some text'
  553. var result = App.Utils.wrap(source)
  554. equal(result, should, source)
  555. source = "some text\nsome other text\n"
  556. should = "some text\nsome other text\n"
  557. result = App.Utils.wrap(source)
  558. equal(result, should, source)
  559. source = "some text with some line to wrap"
  560. should = "some text with\nsome line to\nwrap"
  561. result = App.Utils.wrap(source, 14)
  562. equal(result, should, source)
  563. source = "some text\nsome other text\n"
  564. should = "some text\nsome other text\n"
  565. result = App.Utils.wrap(source)
  566. equal(result, should, source)
  567. source = "1234567890 1234567890 1234567890 1234567890"
  568. should = "1234567890 1234567890 1234567890 1234567890"
  569. result = App.Utils.wrap(source)
  570. equal(result, should, source)
  571. source = "123456789012 123456789012 123456789012"
  572. should = "123456789012\n123456789012\n123456789012"
  573. result = App.Utils.wrap(source, 14)
  574. equal(result, should, source)
  575. });
  576. // remove empty lines
  577. test("remove empty lines", function() {
  578. var source = "\ntest 123\n"
  579. var should = "test 123\n"
  580. var result = App.Utils.removeEmptyLines(source)
  581. equal(result, should, source)
  582. source = "\ntest\n\n123\n"
  583. should = "test\n123\n"
  584. result = App.Utils.removeEmptyLines(source)
  585. equal(result, should, source)
  586. });
  587. // quote
  588. test("quote", function() {
  589. var source = "some text"
  590. var should = '> some text'
  591. var result = App.Utils.quote(source)
  592. equal(result, should, source)
  593. source = "some text\nsome other text\n"
  594. should = "> some text\n> some other text"
  595. result = App.Utils.quote(source)
  596. equal(result, should, source)
  597. source = "\n\nsome text\nsome other text\n \n"
  598. should = "> some text\n> some other text"
  599. result = App.Utils.quote(source)
  600. equal(result, should, source)
  601. source = "Welcome!\n\nThank you for installing Zammad.\n\nYou will find ..."
  602. should = "> Welcome!\n>\n> Thank you for installing Zammad.\n>\n> You will find ..."
  603. result = App.Utils.quote(source)
  604. equal(result, should, source)
  605. source = "Welcome! Thank you for installing Zammad. You will find ..."
  606. should = "> Welcome! Thank you\n> for installing\n> Zammad. You will\n> find ..."
  607. result = App.Utils.quote(source, 20)
  608. equal(result, should, source)
  609. });
  610. // check signature
  611. test("check signature", function() {
  612. var message = "<div>test 123 </div>"
  613. var signature = '<div>--<br>Some Signature<br>some department</div>'
  614. var result = App.Utils.signatureCheck(message, signature)
  615. equal(result, true)
  616. message = "<div>test 123 <div>--<br>Some Signature<br>some department\n</div></div>"
  617. signature = '<div>--<br>Some Signature<br>some department</div>'
  618. result = App.Utils.signatureCheck(message, signature)
  619. equal(result, false)
  620. message = "<div>test 123 <div>--<br>Some Signature\n<br>some department\n</div></div>"
  621. signature = '<div>--<br>Some Signature<br>some department</div>'
  622. result = App.Utils.signatureCheck(message, signature)
  623. equal(result, false)
  624. message = "<div>test 123 <div>--<p>Some Signature</p>\n<p><div>some department</div>\n</p>\n</div></div>"
  625. signature = '<div>--<br>Some Signature<br>some department</div>'
  626. result = App.Utils.signatureCheck(message, signature)
  627. equal(result, false)
  628. message = ""
  629. signature = '<div>--<br>Some Signature<br>some department</div>'
  630. result = App.Utils.signatureCheck(message, signature)
  631. equal(result, true)
  632. message = ""
  633. signature = "--\nSome Signature\nsome department"
  634. result = App.Utils.signatureCheck(message, signature)
  635. equal(result, true)
  636. });
  637. // identify signature
  638. test("identify signature by plaintext", function() {
  639. var message = "<div>test 123 </div>"
  640. var should = '<div>test 123 </div>'
  641. var result = App.Utils.signatureIdentifyByPlaintext(message)
  642. equal(result, should)
  643. message = "<div>test 123 <br/>--<br/>Bob Smith</div>"
  644. should = '<div>test 123 <br/>--<br/>Bob Smith</div>'
  645. result = App.Utils.signatureIdentifyByPlaintext(message)
  646. equal(result, should)
  647. message = "<div>test 123 <br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/><br/>--<br/>Bob Smith</div>"
  648. should = '<div>test 123 <br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/><br/><span class="js-signatureMarker"></span>--<br/>Bob Smith</div>'
  649. result = App.Utils.signatureIdentifyByPlaintext(message)
  650. equal(result, should)
  651. message = "<div>test 123 <br/><br/>--no not match--<br/>--<br/>Bob Smith</div>"
  652. should = '<div>test 123 <br/><br/>--no not match--<br/><span class="js-signatureMarker"></span>--<br/>Bob Smith</div>'
  653. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  654. equal(result, should)
  655. message = "<div>test 123 <br/><br/>--no not match--<br/> -- <br/>Bob Smith</div>"
  656. should = '<div>test 123 <br/><br/>--no not match--<br/><span class="js-signatureMarker"></span> -- <br/>Bob Smith</div>'
  657. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  658. equal(result, should)
  659. message = "<div>test 123 <br/><br/>--<br/>Bob Smith<br/><br/><br/><br/><br/>--<br/>Bob Smith</div>"
  660. should = '<div>test 123 <br/><br/><span class="js-signatureMarker"></span>--<br/>Bob Smith<br/><br/><br/><br/><br/>--<br/>Bob Smith</div>'
  661. //should = '<div>test 123 <br><br><br><br><br><br><br><br><br><br><br><span class="js-signatureMarker"></span>--<br>Bob Smith<br/><br/><br/><br/><br/>--<br/>Bob Smith</div>'
  662. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  663. equal(result, should)
  664. message = "<div>test 123</div><div>test 123</div><div>--</div><div>Bob Smith</div>"
  665. should = "<div>test 123</div><div>test 123</div><div><span class=\"js-signatureMarker\"></span>--</div><div>Bob Smith</div>"
  666. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  667. equal(result, should)
  668. message = "<p><span>test 123</span></p><p><span>test 123</span></p><p><span>--</span></p><p><span>Bob Smith</span></p><div></div>"
  669. should = "<p><span>test 123</span></p><p><span>test 123</span></p><p><span><span class=\"js-signatureMarker\"></span>--</span></p><p><span>Bob Smith</span></p><div></div>"
  670. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  671. equal(result, should)
  672. message = "Test reply to zammad<br><br>Am 24.10.2016 18:55 schrieb &quot;Android Support&quot; &lt;android-support@example.com&gt;:<br><br>&gt; <u></u><br>&gt; Sehr geehrte Damen"
  673. should = "Test reply to zammad<br><br><span class=\"js-signatureMarker\"></span>Am 24.10.2016 18:55 schrieb &quot;Android Support&quot; &lt;android-support@example.com&gt;:<br><br>&gt; <u></u><br>&gt; Sehr geehrte Damen"
  674. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  675. equal(result, should)
  676. message = "<br>&lt; On 20 Oct 2016, at 12:23, Martin Edenhofer via Zammad Helpdesk wrote:<br>"
  677. should = "<br><span class=\"js-signatureMarker\"></span>&lt; On 20 Oct 2016, at 12:23, Martin Edenhofer via Zammad Helpdesk wrote:<br>"
  678. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  679. equal(result, should)
  680. // apple
  681. // en
  682. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>On 01/04/15 10:55, Bob Smith wrote:<br/>lalala<p>--</p>some test</div>"
  683. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>On 01/04/15 10:55, Bob Smith wrote:<br/>lalala<p>--</p>some test</div>'
  684. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  685. equal(result, should)
  686. // de
  687. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Am 03.04.2015 um 20:58 schrieb Bob Smith &lt;bob@example.com&gt;:<br/>lalala</div>"
  688. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>Am 03.04.2015 um 20:58 schrieb Bob Smith &lt;bob@example.com&gt;:<br/>lalala</div>'
  689. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  690. equal(result, should)
  691. // ms
  692. // en
  693. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Sent: Donnerstag, 2. April 2015 10:00<br/>lalala</div>"
  694. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Sent: Donnerstag, 2. April 2015 10:00<br/>lalala</div>'
  695. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  696. equal(result, should)
  697. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Sent: Donnerstag, 2. April 2015 10:00<br/>Subject: lalala</div>"
  698. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Sent: Donnerstag, 2. April 2015 10:00<br/>Subject: lalala</div>'
  699. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  700. equal(result, should)
  701. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Sent: Donnerstag, 2. April 2015 10:00<br/>1<br/>2<br/>3<br/>4<br/>4<br/>Subject: lalala</div>"
  702. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Sent: Donnerstag, 2. April 2015 10:00<br/>1<br/>2<br/>3<br/>4<br/>4<br/>Subject: lalala</div>'
  703. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  704. equal(result, should)
  705. // de
  706. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Gesendet: Donnerstag, 2. April 2015 10:00<br/>Betreff: lalala</div>"
  707. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Gesendet: Donnerstag, 2. April 2015 10:00<br/>Betreff: lalala</div>'
  708. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  709. equal(result, should)
  710. message = "<div>1<br><br></div><div>Von: Martin Edenhofer via Znuny Support [<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>]</div>\n<div>Gesendet: Donnerstag, 2. April 2015 11:32</div>"
  711. should = "<div>1<br><br></div><div>Von: Martin Edenhofer via Znuny Support [<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>]</div>\n<div>Gesendet: Donnerstag, 2. April 2015 11:32</div>"
  712. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  713. equal(result, should)
  714. message = "<div>1<br><br></div><div>Von: Martin Edenhofer via Znuny Support [<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>]</div>\n<div>Gesendet: Donnerstag, 2. April 2015 11:32</div><div>Betreff: lalala</div>"
  715. should = "<div>1<br><br></div><div><span class=\"js-signatureMarker\"></span>Von: Martin Edenhofer via Znuny Support [<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>]</div>\n<div>Gesendet: Donnerstag, 2. April 2015 11:32</div><div>Betreff: lalala</div>"
  716. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  717. equal(result, should)
  718. message = "<div>1<br><br></div><div>Von: Martin Edenhofer via Znuny Support &lt;<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>&gt;</div>\n<div>An: somebody</div><div>Datum: Donnerstag, 2. April 2015 11:32</div><div>Betreff: lalala</div>"
  719. should = "<div>1<br><br></div><div><span class=\"js-signatureMarker\"></span>Von: Martin Edenhofer via Znuny Support &lt;<a href=\"mailto:support@znuny.inc\" title=\"mailto:support@znuny.inc\" target=\"_blank\">mailto:support@znuny.inc</a>&gt;</div>\n<div>An: somebody</div><div>Datum: Donnerstag, 2. April 2015 11:32</div><div>Betreff: lalala</div>"
  720. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  721. equal(result, should)
  722. message = "<div>Von: &quot;Johannes Nickel via Znuny Projects&quot; &lt;<a href=\"mailto:projects@znuny.inc\" title=\"mailto:projects@znuny.inc\">projects@znuny.inc</a>&gt;</div><div>An: \"Lisa Smith\" &lt;<a href=\"mailto:lisa.smith@example.com\" title=\"mailto:lisa.smith@example.com\">lisa.smith@example.com</a>&gt;</div><div>Gesendet: Donnerstag, 2. April 2015 10:11:12</div><div>Betreff: Angebot Redundanz / Paket mit Silver Subscription [Ticket#424242]</div><div><br></div><div>Hallo Frau Smith,</div>"
  723. should = "<div><span class=\"js-signatureMarker\"></span>Von: &quot;Johannes Nickel via Znuny Projects&quot; &lt;<a href=\"mailto:projects@znuny.inc\" title=\"mailto:projects@znuny.inc\">projects@znuny.inc</a>&gt;</div><div>An: \"Lisa Smith\" &lt;<a href=\"mailto:lisa.smith@example.com\" title=\"mailto:lisa.smith@example.com\">lisa.smith@example.com</a>&gt;</div><div>Gesendet: Donnerstag, 2. April 2015 10:11:12</div><div>Betreff: Angebot Redundanz / Paket mit Silver Subscription [Ticket#424242]</div><div><br></div><div>Hallo Frau Smith,</div>"
  724. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  725. equal(result, should)
  726. message = "<div>Hi Johannes,</div><div><br></div><div>das Angebot für den halben Tag bitte an uns.</div><div>Der Termin hat sich jetzt auf 10-12 Uhr verschoben, hab ich dir weitergeleitet.</div><div><br></div><div>Viele Grüße</div><div>Max</div><div><br></div><div>&gt; On 07 Oct 2015, at 11:55, Johannes Smith &lt;<a href=mailto:smith@example.com title=mailto:smith@example.com target=_blank>smith@example.com</a> &lt;<a href=mailto:smith@example.com title=mailto:smith@example.com target=_blank>mailto:smith@example.com</a>&gt;&gt; wrote:</div><div>&gt;</div><div>&gt; Hi,</div><div>&gt;</div><div>&gt; OK. Wer kriegt das Angebot? Ist das wirklich nur ein halber Tag?</div></div>"
  727. should = "<div>Hi Johannes,</div><div><br></div><div>das Angebot für den halben Tag bitte an uns.</div><div>Der Termin hat sich jetzt auf 10-12 Uhr verschoben, hab ich dir weitergeleitet.</div><div><br></div><div>Viele Grüße</div><div>Max</div><div><br></div><div><span class=\"js-signatureMarker\"></span>&gt; On 07 Oct 2015, at 11:55, Johannes Smith &lt;<a href=mailto:smith@example.com title=mailto:smith@example.com target=_blank>smith@example.com</a> &lt;<a href=mailto:smith@example.com title=mailto:smith@example.com target=_blank>mailto:smith@example.com</a>&gt;&gt; wrote:</div><div>&gt;</div><div>&gt; Hi,</div><div>&gt;</div><div>&gt; OK. Wer kriegt das Angebot? Ist das wirklich nur ein halber Tag?</div></div>"
  728. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  729. equal(result, should)
  730. message = "Dear Mr. Smith,<div><br></div><div>it seems to be, dass Sie den AutoIncrement Nummerngenerator für Ihre ITSMChangeManagement Installation verwenden. Seit ABC 3.2 wird führend vor der sich in der Datei&nbsp;<span style=\"line-height: 1.45; background-color: initial;\">&lt;ABC_CONFIG_Home&gt;/war/log/ITSMChangeCounter.log &nbsp;befindenden Zahl die SystemID (SysConfig) geschrieben. Dies ist ein Standardverhalten, dass auch bei der Ticketnummer verwendet wird.<br><br>Please ask me if you have questions.</span></div><div><span style=\"line-height: 1.45; background-color: initial;\"><br></span></div><div><span style=\"line-height: 1.45; background-color: initial;\">Viele Grüße,</span></div><div><div data-signature=\"true\" data-signature-id=\"1\">&nbsp; Thorsten Smith\n<br>\n<br>--\n<br>Enterprise Services for ABC\n<br>\n<br>Znuny GmbH // Marienstraße 11 // 10117 Berlin // Germany\n<br>\n<br>P: +49 (0) 30 111 111 111-0\n<br>F: +49 (0) 30 111 111 111-8\n<br>W: http://znuny.com \n<br>\n<br>Location: Berlin - HRB 12345678 B Amtsgericht Berlin-Charlottenburg\n<br>Managing Director: Martin Edenhofer\n<br></div></div>"
  731. should = "Dear Mr. Smith,<div><br></div><div>it seems to be, dass Sie den AutoIncrement Nummerngenerator für Ihre ITSMChangeManagement Installation verwenden. Seit ABC 3.2 wird führend vor der sich in der Datei&nbsp;<span style=\"line-height: 1.45; background-color: initial;\">&lt;ABC_CONFIG_Home&gt;/war/log/ITSMChangeCounter.log &nbsp;befindenden Zahl die SystemID (SysConfig) geschrieben. Dies ist ein Standardverhalten, dass auch bei der Ticketnummer verwendet wird.<br><br>Please ask me if you have questions.</span></div><div><span style=\"line-height: 1.45; background-color: initial;\"><br></span></div><div><span style=\"line-height: 1.45; background-color: initial;\">Viele Grüße,</span></div><div><span class=\"js-signatureMarker\"></span><div data-signature=\"true\" data-signature-id=\"1\">&nbsp; Thorsten Smith\n<br>\n<br>--\n<br>Enterprise Services for ABC\n<br>\n<br>Znuny GmbH // Marienstraße 11 // 10117 Berlin // Germany\n<br>\n<br>P: +49 (0) 30 111 111 111-0\n<br>F: +49 (0) 30 111 111 111-8\n<br>W: http://znuny.com \n<br>\n<br>Location: Berlin - HRB 12345678 B Amtsgericht Berlin-Charlottenburg\n<br>Managing Director: Martin Edenhofer\n<br></div></div>"
  732. result = App.Utils.signatureIdentifyByPlaintext(message, true, true)
  733. equal(result, should)
  734. message = "Dear Mr. Smith, nice to read you,<div><div data-signature=\"true\" data-signature-id=\"1\">&nbsp; Thorsten Smith\n<br>\n<br>--\n</div></div>"
  735. should = "Dear Mr. Smith, nice to read you,<div><span class=\"js-signatureMarker\"></span><div data-signature=\"true\" data-signature-id=\"1\">&nbsp; Thorsten Smith\n<br>\n<br>--\n</div></div>"
  736. result = App.Utils.signatureIdentifyByPlaintext(message, true, true)
  737. equal(result, should)
  738. message = "Dear Mr. Smith, nice to read you,<div><div data-signature=\"true\" data-signature-id=\"9999\">&nbsp; Thorsten Smith\n<br>\n<br>--\n</div></div>"
  739. should = "Dear Mr. Smith, nice to read you,<div><div data-signature=\"true\" data-signature-id=\"9999\">&nbsp; Thorsten Smith\n<br>\n<br>--\n</div></div>"
  740. result = App.Utils.signatureIdentifyByPlaintext(message, false, true)
  741. equal(result, should)
  742. // fr
  743. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Envoyé : mercredi 29 avril 2015 17:31<br/>Objet : lalala</div>"
  744. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Envoyé : mercredi 29 avril 2015 17:31<br/>Objet : lalala</div>'
  745. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  746. equal(result, should)
  747. // thunderbird
  748. // de
  749. message = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div>Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:</div><div>&gt; Hallo Christian,</div>"
  750. should = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div><span class=\"js-signatureMarker\"></span>Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:</div><div>&gt; Hallo Christian,</div>"
  751. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  752. equal(result, should)
  753. // en - Thunderbird default - http://kb.mozillazine.org/Reply_header_settings
  754. message = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div>On 01-01-2007 11:00 AM, Alf Aardvark wrote:</div><div>&gt; Hallo Christian,</div>"
  755. should = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div><span class=\"js-signatureMarker\"></span>On 01-01-2007 11:00 AM, Alf Aardvark wrote:</div><div>&gt; Hallo Christian,</div>"
  756. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  757. equal(result, should)
  758. // en - http://kb.mozillazine.org/Reply_header_settings
  759. message = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div>Alf Aardvark wrote, on 01-01-2007 11:00 AM:</div><div>&gt; Hallo Christian,</div>"
  760. should = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div><span class=\"js-signatureMarker\"></span>Alf Aardvark wrote, on 01-01-2007 11:00 AM:</div><div>&gt; Hallo Christian,</div>"
  761. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  762. equal(result, should)
  763. // otrs
  764. // en
  765. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>01/04/15 10:55 - Bob Smith wrote:<br/>lalala</div>"
  766. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>01/04/15 10:55 - Bob Smith wrote:<br/>lalala</div>'
  767. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  768. equal(result, should)
  769. // de
  770. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>01/04/15 10:55 - Bob Smith schrieb:<br/>lalala</div>"
  771. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>01/04/15 10:55 - Bob Smith schrieb:<br/>lalala</div>'
  772. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  773. equal(result, should)
  774. message = "<div>test 123 <br/><br/></div><div>24.02.2015 14:20 - Roy Kaldung via Znuny Sales schrieb: &nbsp;</div>"
  775. should = "<div>test 123 <br/><br/></div><div><span class=\"js-signatureMarker\"></span>24.02.2015 14:20 - Roy Kaldung via Znuny Sales schrieb: &nbsp;</div>"
  776. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  777. equal(result, should)
  778. // zammad
  779. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><div data-signature=\"true\" data-signature-id=\"5\">lalala</div></div>"
  780. should = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span><div data-signature=\"true\" data-signature-id=\"5\">lalala</div></div>"
  781. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  782. equal(result, should)
  783. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><blockquote type=\"cite\">lalala</blockquote></div>"
  784. should = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span><blockquote type=\"cite\">lalala</blockquote></div>"
  785. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  786. equal(result, should)
  787. // gmail
  788. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><blockquote class=\"ecxgmail_quote\">lalala</blockquote></div>"
  789. should = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span><blockquote class=\"ecxgmail_quote\">lalala</blockquote></div>"
  790. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  791. equal(result, should)
  792. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><blockquote class=\"gmail_quote\">lalala</blockquote></div>"
  793. should = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span><blockquote class=\"gmail_quote\">lalala</blockquote></div>"
  794. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  795. equal(result, should)
  796. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Am 24. Dezember 2015 um 07:45 schrieb kathrine &lt;kathrine@example.com&gt;:<br/>lalala</div>"
  797. should = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class=\"js-signatureMarker\"></span>Am 24. Dezember 2015 um 07:45 schrieb kathrine &lt;kathrine@example.com&gt;:<br/>lalala</div>"
  798. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  799. equal(result, should)
  800. // word 14
  801. // en
  802. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Bob Smith wrote:<br/>lalala</div>"
  803. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>Bob Smith wrote:<br/>lalala</div>'
  804. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  805. equal(result, should)
  806. // de
  807. message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Bob Smith schrieb:<br/>lalala</div>"
  808. should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>Bob Smith schrieb:<br/>lalala</div>'
  809. result = App.Utils.signatureIdentifyByPlaintext(message, true)
  810. equal(result, should)
  811. });
  812. test("identify signature by HTML", function() {
  813. var message = "<div>test 123 </div>"
  814. var should = message
  815. var result = App.Utils.signatureIdentifyByHtml(message)
  816. equal(result, should)
  817. // simple case 1
  818. message = '<div>actual content</div><blockquote>quoted content</blockquote>'
  819. should = '<div>actual content</div><span class="js-signatureMarker"></span><blockquote>quoted content</blockquote>'
  820. result = App.Utils.signatureIdentifyByHtml(message)
  821. equal(result, should)
  822. // simple case 2
  823. message = '<div>actual content</div><blockquote>quoted content</blockquote><br><div><br></div><div><br> </div>'
  824. should = '<div>actual content</div><span class="js-signatureMarker"></span><blockquote>quoted content</blockquote><br><div><br></div><div><br> </div>'
  825. result = App.Utils.signatureIdentifyByHtml(message)
  826. equal(result, should)
  827. // simple case 3
  828. message = '<div>actual content</div><blockquote>quoted content</blockquote><br><div>actual content 2</div>'
  829. should = message
  830. result = App.Utils.signatureIdentifyByHtml(message)
  831. equal(result, should)
  832. // simple case 4
  833. message = ' content 0 <div>content 1</div> content 2 <blockquote>quoted content</blockquote><br><div><br></div><div><br> </div>'
  834. should = ' content 0 <div>content 1</div> content 2 <span class="js-signatureMarker"></span><blockquote>quoted content</blockquote><br><div><br></div><div><br> </div>'
  835. result = App.Utils.signatureIdentifyByHtml(message)
  836. equal(result, should)
  837. // Gmail via Safari on MacOS 10.12
  838. message = '<div dir="ltr">Reply with <b>gmail</b> via Safari on MacOS 10.12</div><br>\
  839. <div>\
  840. <div dir="ltr">Am Mi., 5. Sep. 2018 um 09:22 Uhr schrieb Billy Zhou &lt;bz@zammad.com&gt;:<br>\
  841. </div>\
  842. <blockquote>test email content<br>\
  843. <br>\
  844. </blockquote>\
  845. </div>'
  846. should = '<div dir="ltr">Reply with <b>gmail</b> via Safari on MacOS 10.12</div><br>\
  847. <span class=\"js-signatureMarker\"></span><div>\
  848. <div dir="ltr">Am Mi., 5. Sep. 2018 um 09:22 Uhr schrieb Billy Zhou &lt;bz@zammad.com&gt;:<br>\
  849. </div>\
  850. <blockquote>test email content<br>\
  851. <br>\
  852. </blockquote>\
  853. </div>'
  854. result = App.Utils.signatureIdentifyByHtml(message)
  855. equal(result, should)
  856. // Yahoo Mail via Safari on MacOS 10.12
  857. message = '<div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1536132243868_2594"><span id="yui_3_16_0_ym19_1_1536132243868_2593">Reply with <b id="yui_3_16_0_ym19_1_1536132243868_2597">Yahoo Mail</b> via Safari on MacOS 10.12</span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> Billy Zhou &lt;bz@zammad.com&gt; schrieb am 9:08 Mittwoch, 5.September 2018:<br></font></div> <br><br> <div class="y_msg_container"><div dir="ltr">test email content<br></div><div dir="ltr"><br></div><br><br></div> </div> </div> </div></div>'
  858. should = '<div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1536132243868_2594"><span id="yui_3_16_0_ym19_1_1536132243868_2593">Reply with <b id="yui_3_16_0_ym19_1_1536132243868_2597">Yahoo Mail</b> via Safari on MacOS 10.12</span></div> <div class="qtdSeparateBR"><br><br></div><span class="js-signatureMarker"></span><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> Billy Zhou &lt;bz@zammad.com&gt; schrieb am 9:08 Mittwoch, 5.September 2018:<br></font></div> <br><br> <div class="y_msg_container"><div dir="ltr">test email content<br></div><div dir="ltr"><br></div><br><br></div> </div> </div> </div></div>'
  859. result = App.Utils.signatureIdentifyByHtml(message)
  860. equal(result, should)
  861. // Thunderbird 52 on MacOS 10.12
  862. message = 'Reply with <b>Thunderbird 52</b> on MacOS 10.12<br>\
  863. <br>\
  864. <div class="moz-cite-prefix">Am 04.09.18 um 15:32 schrieb Billy\
  865. Zhou:<br>\
  866. </div>\
  867. <blockquote type="cite"\
  868. cite="mid:da18ed01-b187-a383-bfe7-72663cf82a83@zammad.com">test\
  869. email content\
  870. <br>\
  871. <br>\
  872. </blockquote>\
  873. <br>'
  874. should = 'Reply with <b>Thunderbird 52</b> on MacOS 10.12<br>\
  875. <br>\
  876. <div class="moz-cite-prefix">Am 04.09.18 um 15:32 schrieb Billy\
  877. Zhou:<br>\
  878. </div>\
  879. <span class=\"js-signatureMarker\"></span><blockquote type="cite" cite="mid:da18ed01-b187-a383-bfe7-72663cf82a83@zammad.com">test\
  880. email content\
  881. <br>\
  882. <br>\
  883. </blockquote>\
  884. <br>'
  885. result = App.Utils.signatureIdentifyByHtml(message)
  886. equal(result, should)
  887. // Apple Mail on MacOS 10
  888. message = '<div class="">Reply by <b class="">Apple Mail</b> on MacOS 10.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 4. Sep 2018, at 15:32, Billy Zhou &lt;<a href="mailto:bz@zammad.com" class="">bz@zammad.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">test email content<br class=""><br class=""></div></div></blockquote></div><br class="">'
  889. should = '<div class="">Reply by <b class="">Apple Mail</b> on MacOS 10.</div><div class=""><br class=""></div><br class=""><span class=\"js-signatureMarker\"></span><div><blockquote type="cite" class=""><div class="">On 4. Sep 2018, at 15:32, Billy Zhou &lt;<a href="mailto:bz@zammad.com" class="">bz@zammad.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">test email content<br class=""><br class=""></div></div></blockquote></div><br class="">'
  890. result = App.Utils.signatureIdentifyByHtml(message)
  891. equal(result, should)
  892. // Office 365 (10325.20118) on Windows 10 Build 1803
  893. // With German marker: -----Ursprüngliche Nachricht-----
  894. // Using fallback to signatureIdentifyByPlaintext
  895. message = '<div>\
  896. <p>Reply with Office 365 (10325.20118) on Windows 10 Build 1803</p>\
  897. <p> </p>\
  898. <p><b>fett</b></p>\
  899. <p> </p>\
  900. <span class="js-signatureMarker"></span><p>--</p>\
  901. <p>Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany</p>\
  902. <p> </p>\
  903. <p>P: +49 (0) 30 55 57 160-0</p>\
  904. <p>F: +49 (0) 30 55 57 160-99</p>\
  905. <p>W: <a href="https://zammad.com" rel="nofollow noreferrer noopener" target="_blank">https://zammad.com</a></p>\
  906. <p> </p>\
  907. <p>Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg</p>\
  908. <p>Managing Director: Martin Edenhofer</p>\
  909. <p> </p>\
  910. <p>-----Ursprüngliche Nachricht-----<br>Von: Billy Zhou &lt;bz@zammad.com&gt; <br>Gesendet: Dienstag, 4. September 2018 15:33<br>An: me@zammad.com<br>Betreff: test email title</p>\
  911. <p> </p>\
  912. <p>test email content</p>\
  913. <p> </p>\
  914. </div>'
  915. should = '<div>\
  916. <p>Reply with Office 365 (10325.20118) on Windows 10 Build 1803</p>\
  917. <p> </p>\
  918. <p><b>fett</b></p>\
  919. <p> </p>\
  920. <span class="js-signatureMarker"></span><p><span class=\"js-signatureMarker\"></span>--</p>\
  921. <p>Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany</p>\
  922. <p> </p>\
  923. <p>P: +49 (0) 30 55 57 160-0</p>\
  924. <p>F: +49 (0) 30 55 57 160-99</p>\
  925. <p>W: <a href="https://zammad.com" rel="nofollow noreferrer noopener" target="_blank">https://zammad.com</a></p>\
  926. <p> </p>\
  927. <p>Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg</p>\
  928. <p>Managing Director: Martin Edenhofer</p>\
  929. <p> </p>\
  930. <p>-----Ursprüngliche Nachricht-----<br>Von: Billy Zhou &lt;bz@zammad.com&gt; <br>Gesendet: Dienstag, 4. September 2018 15:33<br>An: me@zammad.com<br>Betreff: test email title</p>\
  931. <p> </p>\
  932. <p>test email content</p>\
  933. <p> </p>\
  934. </div>'
  935. result = App.Utils.signatureIdentifyByHtml(message)
  936. equal(result, should)
  937. // Office 365 (10325.20118) on Windows 10 Build 1803
  938. // With English marker: -----Original Message-----
  939. // Using fallback to signatureIdentifyByPlaintext
  940. message = '<div>\
  941. <p>Reply with Office 365 (10325.20118) on Windows 10 Build 1803</p>\
  942. <p> </p>\
  943. <p><b>fett</b></p>\
  944. <p> </p>\
  945. <span class="js-signatureMarker"></span><p>--</p>\
  946. <p>Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany</p>\
  947. <p> </p>\
  948. <p>P: +49 (0) 30 55 57 160-0</p>\
  949. <p>F: +49 (0) 30 55 57 160-99</p>\
  950. <p>W: <a href="https://zammad.com" rel="nofollow noreferrer noopener" target="_blank">https://zammad.com</a></p>\
  951. <p> </p>\
  952. <p>Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg</p>\
  953. <p>Managing Director: Martin Edenhofer</p>\
  954. <p> </p>\
  955. <p>-----Original Message-----<br>Von: Billy Zhou &lt;bz@zammad.com&gt; <br>Gesendet: Dienstag, 4. September 2018 15:33<br>An: me@zammad.com<br>Betreff: test email title</p>\
  956. <p> </p>\
  957. <p>test email content</p>\
  958. <p> </p>\
  959. </div>'
  960. should = '<div>\
  961. <p>Reply with Office 365 (10325.20118) on Windows 10 Build 1803</p>\
  962. <p> </p>\
  963. <p><b>fett</b></p>\
  964. <p> </p>\
  965. <span class="js-signatureMarker"></span><p><span class=\"js-signatureMarker\"></span>--</p>\
  966. <p>Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany</p>\
  967. <p> </p>\
  968. <p>P: +49 (0) 30 55 57 160-0</p>\
  969. <p>F: +49 (0) 30 55 57 160-99</p>\
  970. <p>W: <a href="https://zammad.com" rel="nofollow noreferrer noopener" target="_blank">https://zammad.com</a></p>\
  971. <p> </p>\
  972. <p>Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg</p>\
  973. <p>Managing Director: Martin Edenhofer</p>\
  974. <p> </p>\
  975. <p>-----Original Message-----<br>Von: Billy Zhou &lt;bz@zammad.com&gt; <br>Gesendet: Dienstag, 4. September 2018 15:33<br>An: me@zammad.com<br>Betreff: test email title</p>\
  976. <p> </p>\
  977. <p>test email content</p>\
  978. <p> </p>\
  979. </div>'
  980. result = App.Utils.signatureIdentifyByHtml(message)
  981. equal(result, should)
  982. // Office 365 (10325.20118) on Windows 10 Build 1803
  983. // With German marker: -----Ursprüngliche Nachricht-----
  984. // Without any existing <span class="js-signatureMarker"></span>
  985. // Using fallback to signatureIdentifyByPlaintext
  986. message = '<div>\
  987. <p>Reply with Office 365 (10325.20118) on Windows 10 Build 1803</p>\
  988. <p> </p>\
  989. <p><b>fett</b></p>\
  990. <p> </p>\
  991. <p>--</p>\
  992. <p>Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany</p>\
  993. <p> </p>\
  994. <p>P: +49 (0) 30 55 57 160-0</p>\
  995. <p>F: +49 (0) 30 55 57 160-99</p>\
  996. <p>W: <a href="https://zammad.com" rel="nofollow noreferrer noopener" target="_blank">https://zammad.com</a></p>\
  997. <p> </p>\
  998. <p>Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg</p>\
  999. <p>Managing Director: Martin Edenhofer</p>\
  1000. <p> </p>\
  1001. <p>-----Ursprüngliche Nachricht-----<br>Von: Billy Zhou &lt;bz@zammad.com&gt; <br>Gesendet: Dienstag, 4. September 2018 15:33<br>An: me@zammad.com<br>Betreff: test email title</p>\
  1002. <p> </p>\
  1003. <p>test email content</p>\
  1004. <p> </p>\
  1005. </div>'
  1006. should = '<div>\
  1007. <p>Reply with Office 365 (10325.20118) on Windows 10 Build 1803</p>\
  1008. <p> </p>\
  1009. <p><b>fett</b></p>\
  1010. <p> </p>\
  1011. <p><span class=\"js-signatureMarker\"></span>--</p>\
  1012. <p>Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany</p>\
  1013. <p> </p>\
  1014. <p>P: +49 (0) 30 55 57 160-0</p>\
  1015. <p>F: +49 (0) 30 55 57 160-99</p>\
  1016. <p>W: <a href="https://zammad.com" rel="nofollow noreferrer noopener" target="_blank">https://zammad.com</a></p>\
  1017. <p> </p>\
  1018. <p>Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg</p>\
  1019. <p>Managing Director: Martin Edenhofer</p>\
  1020. <p> </p>\
  1021. <p>-----Ursprüngliche Nachricht-----<br>Von: Billy Zhou &lt;bz@zammad.com&gt; <br>Gesendet: Dienstag, 4. September 2018 15:33<br>An: me@zammad.com<br>Betreff: test email title</p>\
  1022. <p> </p>\
  1023. <p>test email content</p>\
  1024. <p> </p>\
  1025. </div>'
  1026. result = App.Utils.signatureIdentifyByHtml(message)
  1027. equal(result, should)
  1028. });
  1029. // check attachment references
  1030. test("check check attachment reference", function() {
  1031. var message = 'some not existing'
  1032. var result = false
  1033. var verify = App.Utils.checkAttachmentReference(message)
  1034. equal(verify, result)
  1035. message = 'some attachment for you'
  1036. result = 'Attachment'
  1037. verify = App.Utils.checkAttachmentReference(message)
  1038. equal(verify, result)
  1039. message = 'your attachment.'
  1040. result = 'Attachment'
  1041. verify = App.Utils.checkAttachmentReference(message)
  1042. equal(verify, result)
  1043. message = 'some otherattachment for you'
  1044. result = false
  1045. verify = App.Utils.checkAttachmentReference(message)
  1046. equal(verify, result)
  1047. message = 'some attachmentother for you'
  1048. result = false
  1049. verify = App.Utils.checkAttachmentReference(message)
  1050. equal(verify, result)
  1051. message = 'someattachment'
  1052. result = false
  1053. verify = App.Utils.checkAttachmentReference(message)
  1054. equal(verify, result)
  1055. message = 'As enclosed you will find.'
  1056. result = 'Enclosed'
  1057. verify = App.Utils.checkAttachmentReference(message)
  1058. equal(verify, result)
  1059. message = '<div>Hi Test,</div><div><blockquote>On Monday, 22 July 2019, 14:07:54, Test User wrote:<br><br>Test attachment <br></blockquote></div>'
  1060. result = false
  1061. verify = App.Utils.checkAttachmentReference(message)
  1062. equal(verify, result)
  1063. message = '<div>Hi Test,</div><div><blockquote type="cite">cite attachment </blockquote></div>'
  1064. result = false
  1065. verify = App.Utils.checkAttachmentReference(message)
  1066. equal(verify, result)
  1067. message = '<div>Hi Test,</div><div><blockquote class="ecxgmail_quote">ecxgmail_quote attachment </blockquote></div>'
  1068. result = false
  1069. verify = App.Utils.checkAttachmentReference(message)
  1070. equal(verify, result)
  1071. });
  1072. // replace tags
  1073. test("check replace tags", function() {
  1074. var formatNumber = function(num, digits) {
  1075. while (num.toString().length < digits) {
  1076. num = '0' + num
  1077. }
  1078. return num
  1079. }
  1080. var formatTimestamp = function(timestamp) {
  1081. localTime = new Date(Date.parse(timestamp))
  1082. d = formatNumber(localTime.getDate(), 2)
  1083. m = formatNumber(localTime.getMonth() + 1, 2)
  1084. yfull = localTime.getFullYear()
  1085. M = formatNumber(localTime.getMinutes(), 2)
  1086. H = formatNumber(localTime.getHours(), 2)
  1087. return m + '/' + d + '/' + yfull + ' ' + H + ':' + M
  1088. }
  1089. var message = "<div>#{user.firstname} #{user.lastname}</div>"
  1090. var result = '<div>Bob Smith</div>'
  1091. var data = {
  1092. user: {
  1093. firstname: 'Bob',
  1094. lastname: 'Smith',
  1095. },
  1096. }
  1097. var verify = App.Utils.replaceTags(message, data)
  1098. equal(verify, result)
  1099. message = "<div>#{user.firstname} #{user.lastname}</div>"
  1100. result = '<div>Bob Smith</div>'
  1101. data = {
  1102. user: {
  1103. firstname: function() { return 'Bob' },
  1104. lastname: function() { return 'Smith' },
  1105. },
  1106. }
  1107. verify = App.Utils.replaceTags(message, data)
  1108. equal(verify, result)
  1109. message = "<div>#{user.firstname} #{user.lastname}</div>"
  1110. result = '<div>Bob -</div>'
  1111. data = {
  1112. user: {
  1113. firstname: 'Bob',
  1114. },
  1115. }
  1116. verify = App.Utils.replaceTags(message, data)
  1117. equal(verify, result)
  1118. message = "<div>#{user.firstname} #{user.lastname}</div>"
  1119. result = '<div>Bob 0</div>'
  1120. data = {
  1121. user: {
  1122. firstname: 'Bob',
  1123. lastname: 0,
  1124. },
  1125. }
  1126. verify = App.Utils.replaceTags(message, data)
  1127. equal(verify, result)
  1128. message = "<div>#{user.firstname} #{user.lastname}</div>"
  1129. result = '<div>Bob -</div>'
  1130. data = {
  1131. user: {
  1132. firstname: 'Bob',
  1133. lastname: '',
  1134. },
  1135. }
  1136. verify = App.Utils.replaceTags(message, data)
  1137. equal(verify, result)
  1138. message = "<div>#{user.firstname} #{user.not.existing.test}</div>"
  1139. result = '<div>Bob -</div>'
  1140. data = {
  1141. user: {
  1142. firstname: 'Bob',
  1143. },
  1144. }
  1145. verify = App.Utils.replaceTags(message, data)
  1146. equal(verify, result)
  1147. message = "<div>#{user.firstname} #{not.existing.test}</div>"
  1148. result = '<div>Bob -</div>'
  1149. data = {
  1150. user: {
  1151. firstname: 'Bob',
  1152. },
  1153. }
  1154. verify = App.Utils.replaceTags(message, data)
  1155. equal(verify, result)
  1156. message = "<div>#{user.firstname} #{not.existing.test}</div>"
  1157. result = '<div>Bob -</div>'
  1158. data = {
  1159. user: {
  1160. firstname: 'Bob',
  1161. not: null,
  1162. },
  1163. }
  1164. verify = App.Utils.replaceTags(message, data)
  1165. equal(verify, result)
  1166. message = "<div>#{user.firstname} #{not.existing.test}</div>"
  1167. result = '<div>Bob -</div>'
  1168. data = {
  1169. user: {
  1170. firstname: 'Bob',
  1171. not: {},
  1172. },
  1173. }
  1174. verify = App.Utils.replaceTags(message, data)
  1175. equal(verify, result)
  1176. message = "<div>#{user.firstname} #{<a href=\"/test\">user.lastname</a>}</div>"
  1177. result = '<div>Bob Smith</div>'
  1178. data = {
  1179. user: {
  1180. firstname: 'Bob',
  1181. lastname: 'Smith',
  1182. },
  1183. }
  1184. verify = App.Utils.replaceTags(message, data)
  1185. equal(verify, result)
  1186. user = new App.User({
  1187. firstname: 'Bob',
  1188. lastname: 'Smith Good',
  1189. created_at: '2018-10-31T10:00:00Z',
  1190. })
  1191. message = "<div>#{user.firstname} #{user.created_at}</div>"
  1192. result = '<div>Bob ' + formatTimestamp('2018-10-31T10:00:00Z') + '</div>'
  1193. data = {
  1194. user: user
  1195. }
  1196. verify = App.Utils.replaceTags(message, data)
  1197. equal(verify, result)
  1198. message = "<div>#{user.firstname} #{user.created_at.date}</div>"
  1199. result = '<div>Bob -</div>'
  1200. data = {
  1201. user: user
  1202. }
  1203. verify = App.Utils.replaceTags(message, data)
  1204. equal(verify, result)
  1205. message = "<div>#{user.firstname} #{user.created.date}</div>"
  1206. result = '<div>Bob -</div>'
  1207. data = {
  1208. user: user
  1209. }
  1210. verify = App.Utils.replaceTags(message, data)
  1211. equal(verify, result)
  1212. message = "<a href=\"https://example.co/q=#{user.lastname}\">some text</a>"
  1213. result = '<a href=\"https://example.co/q=Smith%20Good\">some text</a>'
  1214. data = {
  1215. user: user
  1216. }
  1217. verify = App.Utils.replaceTags(message, data, true)
  1218. equal(verify, result)
  1219. });
  1220. // check attibute validation
  1221. test("check attibute validation", function() {
  1222. var string = '123'
  1223. var result = '123'
  1224. var verify = App.Utils.htmlAttributeCleanup(string)
  1225. equal(verify, result, string)
  1226. string = '123!'
  1227. result = '123'
  1228. verify = App.Utils.htmlAttributeCleanup(string)
  1229. equal(verify, result, string)
  1230. string = '12 3!'
  1231. result = '123'
  1232. verify = App.Utils.htmlAttributeCleanup(string)
  1233. equal(verify, result, string)
  1234. string = '12-3!'
  1235. result = '12-3'
  1236. verify = App.Utils.htmlAttributeCleanup(string)
  1237. equal(verify, result, string)
  1238. string = '12_3!'
  1239. result = '12_3'
  1240. verify = App.Utils.htmlAttributeCleanup(string)
  1241. equal(verify, result, string)
  1242. string = '^12_3!'
  1243. result = '12_3'
  1244. verify = App.Utils.htmlAttributeCleanup(string)
  1245. equal(verify, result, string)
  1246. string = '^1\n 2_3!'
  1247. result = '12_3'
  1248. verify = App.Utils.htmlAttributeCleanup(string)
  1249. equal(verify, result, string)
  1250. string = 'abc?'
  1251. result = 'abc'
  1252. verify = App.Utils.htmlAttributeCleanup(string)
  1253. equal(verify, result, string)
  1254. string = 'abc."'
  1255. result = 'abc'
  1256. verify = App.Utils.htmlAttributeCleanup(string)
  1257. equal(verify, result, string)
  1258. string = '#abc!^'
  1259. result = 'abc'
  1260. verify = App.Utils.htmlAttributeCleanup(string)
  1261. equal(verify, result, string)
  1262. string = 'abc()=$'
  1263. result = 'abc'
  1264. verify = App.Utils.htmlAttributeCleanup(string)
  1265. equal(verify, result, string)
  1266. string = "abc()=$\n123\rß"
  1267. result = 'abc123'
  1268. verify = App.Utils.htmlAttributeCleanup(string)
  1269. equal(verify, result, string)
  1270. });
  1271. // check form diff
  1272. test("check form diff", function() {
  1273. var dataNow = {
  1274. owner_id: 1,
  1275. pending_date: '2015-01-28T09:39:00Z',
  1276. }
  1277. var dataLast = {
  1278. owner_id: '',
  1279. pending_date: '2015-01-28T09:39:00Z',
  1280. }
  1281. var diff = {}
  1282. var result = App.Utils.formDiff(dataNow, dataLast)
  1283. deepEqual(result, diff, 'check form diff')
  1284. dataNow = {
  1285. owner_id: '1',
  1286. pending_date: '2015-01-28T09:39:00Z',
  1287. }
  1288. dataLast = {
  1289. owner_id: '',
  1290. pending_date: '2015-01-28T09:39:00Z',
  1291. }
  1292. diff = {}
  1293. result = App.Utils.formDiff(dataNow, dataLast)
  1294. deepEqual(result, diff, 'check form diff')
  1295. dataNow = {
  1296. pending_date: '2015-01-28T09:39:00Z',
  1297. }
  1298. dataLast = {
  1299. owner_id: 1,
  1300. pending_date: '2015-01-28T09:39:00Z',
  1301. }
  1302. diff = {}
  1303. result = App.Utils.formDiff(dataNow, dataLast)
  1304. deepEqual(result, diff, 'check form diff')
  1305. dataNow = {
  1306. owner_id: '',
  1307. pending_date: '2015-01-28T09:39:00Z',
  1308. }
  1309. dataLast = {
  1310. pending_date: '2015-01-28T09:39:00Z',
  1311. }
  1312. diff = {
  1313. }
  1314. result = App.Utils.formDiff(dataNow, dataLast)
  1315. deepEqual(result, diff, 'check form diff')
  1316. dataNow = {
  1317. owner_id: '',
  1318. state_ids: [1,5,6,7],
  1319. }
  1320. dataLast = {}
  1321. diff = {
  1322. state_ids: ['1','5','6','7'],
  1323. }
  1324. result = App.Utils.formDiff(dataNow, dataLast)
  1325. deepEqual(result, diff, 'check form diff')
  1326. dataNow = {
  1327. owner_id: 1,
  1328. state_ids: [1,5,7,6],
  1329. }
  1330. dataLast = {
  1331. owner_id: '',
  1332. state_ids: [1,5,6,7],
  1333. }
  1334. diff = {}
  1335. result = App.Utils.formDiff(dataNow, dataLast)
  1336. deepEqual(result, diff, 'check form diff')
  1337. dataNow = {
  1338. owner_id: 1,
  1339. state_ids: [1,5,6,7],
  1340. }
  1341. dataLast = {
  1342. state_ids: ['1','5','7'],
  1343. }
  1344. diff = {
  1345. state_ids: ['6'],
  1346. }
  1347. result = App.Utils.formDiff(dataNow, dataLast)
  1348. deepEqual(result, diff, 'check form diff')
  1349. dataNow = {
  1350. owner_id: '',
  1351. state_ids: [1,5,6,7],
  1352. }
  1353. dataLast = {
  1354. owner_id: 1,
  1355. state_ids: [1,5,6,7],
  1356. }
  1357. diff = {}
  1358. result = App.Utils.formDiff(dataNow, dataLast)
  1359. deepEqual(result, diff, 'check form diff')
  1360. dataNow = {
  1361. owner_id: '',
  1362. state_ids: [1,5,6,7],
  1363. }
  1364. dataLast = {
  1365. owner_id: 5,
  1366. state_ids: [1,5,6,7],
  1367. }
  1368. diff = {
  1369. owner_id: ''
  1370. }
  1371. result = App.Utils.formDiff(dataNow, dataLast)
  1372. deepEqual(result, diff, 'check form diff')
  1373. dataNow = {
  1374. state_id: 4,
  1375. pending_time: '2015-01-28T11:34:00Z'
  1376. }
  1377. dataLast = {
  1378. state_id: 5,
  1379. pending_time: undefined
  1380. }
  1381. diff = {
  1382. state_id: '4',
  1383. pending_time: '2015-01-28T11:34:00Z'
  1384. }
  1385. result = App.Utils.formDiff(dataNow, dataLast)
  1386. deepEqual(result, diff, 'check form diff')
  1387. dataNow = {
  1388. pending_time: undefined
  1389. }
  1390. dataLast = {
  1391. pending_time: null
  1392. }
  1393. diff = {}
  1394. result = App.Utils.formDiff(dataNow, dataLast)
  1395. deepEqual(result, diff, 'check form diff')
  1396. dataNow = {
  1397. ticket: {
  1398. pending_time: undefined,
  1399. },
  1400. }
  1401. dataLast = {
  1402. ticket: {
  1403. pending_time: null,
  1404. },
  1405. }
  1406. diff = {}
  1407. result = App.Utils.formDiff(dataNow, dataLast)
  1408. deepEqual(result, diff, 'check form diff')
  1409. dataNow = {
  1410. test: '123',
  1411. ticket: {
  1412. pending_time: undefined,
  1413. },
  1414. }
  1415. dataLast = {
  1416. test: '123',
  1417. ticket: {
  1418. pending_time: null,
  1419. },
  1420. }
  1421. diff = {}
  1422. result = App.Utils.formDiff(dataNow, dataLast)
  1423. deepEqual(result, diff, 'check form diff')
  1424. dataNow = {
  1425. test: '123',
  1426. }
  1427. dataLast = {}
  1428. diff = {
  1429. test: '123',
  1430. }
  1431. result = App.Utils.formDiff(dataNow, dataLast)
  1432. deepEqual(result, diff, 'check form diff')
  1433. dataNow = {
  1434. test: '123',
  1435. }
  1436. dataLast = {
  1437. test: [1,2,3,4]
  1438. }
  1439. diff = {
  1440. test: '123',
  1441. }
  1442. result = App.Utils.formDiff(dataNow, dataLast)
  1443. deepEqual(result, diff, 'check form diff')
  1444. dataNow = {
  1445. test: '123',
  1446. }
  1447. dataLast = {
  1448. test: {
  1449. 1: 1,
  1450. 2: 2,
  1451. }
  1452. }
  1453. diff = {
  1454. test: '123',
  1455. }
  1456. result = App.Utils.formDiff(dataNow, dataLast)
  1457. deepEqual(result, diff, 'check form diff')
  1458. dataNow = {
  1459. test: [1,2,3,'4']
  1460. }
  1461. dataLast = {
  1462. test: '123',
  1463. }
  1464. diff = {
  1465. test: ['1','2','3','4']
  1466. }
  1467. result = App.Utils.formDiff(dataNow, dataLast)
  1468. deepEqual(result, diff, 'check form diff')
  1469. dataNow = {
  1470. test: {
  1471. 1: 1,
  1472. 2: 2,
  1473. }
  1474. }
  1475. dataLast = {
  1476. test: '123',
  1477. }
  1478. diff = {
  1479. test: {
  1480. 1: '1',
  1481. 2: '2',
  1482. }
  1483. }
  1484. result = App.Utils.formDiff(dataNow, dataLast)
  1485. deepEqual(result, diff, 'check form diff')
  1486. // regression test for issue #2042 - incorrect notification when closing a tab after setting up an object
  1487. // A newly created attribute will have the empty string as its value, this should be ignored for formDiff comparison
  1488. dataNow = {
  1489. test: '',
  1490. }
  1491. dataLast = {}
  1492. diff = {}
  1493. result = App.Utils.formDiff(dataNow, dataLast)
  1494. deepEqual(result, diff, 'check form diff for a newly created attribute that is blank')
  1495. dataNow = {
  1496. test: '',
  1497. }
  1498. dataLast = {
  1499. test: '123',
  1500. }
  1501. diff = {
  1502. test: '',
  1503. }
  1504. result = App.Utils.formDiff(dataNow, dataLast)
  1505. deepEqual(result, diff, 'check form diff for setting a previously valid value to blank')
  1506. dataNow = {
  1507. test: '123',
  1508. ticket: {
  1509. pending_time: undefined,
  1510. },
  1511. }
  1512. dataLast = {
  1513. ticket: {
  1514. pending_time: null,
  1515. },
  1516. }
  1517. diff = {
  1518. test: '123',
  1519. }
  1520. result = App.Utils.formDiff(dataNow, dataLast)
  1521. deepEqual(result, diff, 'check form diff')
  1522. dataNow = undefined
  1523. dataLast = undefined
  1524. diff = {}
  1525. result = App.Utils.formDiff(dataNow, dataLast)
  1526. deepEqual(result, diff, 'check form diff')
  1527. dataNow = {}
  1528. 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}
  1529. diff = {}
  1530. result = App.Utils.formDiff(dataNow, dataLast)
  1531. deepEqual(result, diff, 'check form diff')
  1532. // do not compare content of data instances/objects
  1533. no = function test_object() {
  1534. this.a = function() { return 123; }
  1535. this.b = function() { return '1234'; }
  1536. this.c = function() { return [123]; }
  1537. this.d = [1,2,3];
  1538. this.e = 'abc';
  1539. }
  1540. no1 = new no()
  1541. no2 = new no()
  1542. no3 = new no()
  1543. dataNow = {
  1544. number:'10013',
  1545. Article: [no1],
  1546. }
  1547. dataLast = {
  1548. number: "10012",
  1549. title: "some subject 123äöü",
  1550. Article: [ no2, no3 ],
  1551. }
  1552. diff = {
  1553. number:'10013',
  1554. }
  1555. result = App.Utils.formDiff(dataNow, dataLast)
  1556. deepEqual(result, diff, 'check form diff')
  1557. dataNow = {
  1558. number:'10013',
  1559. Article: [no1,2],
  1560. }
  1561. dataLast = {
  1562. number: "10012",
  1563. title: "some subject 123äöü",
  1564. Article: [ no2, no3 ],
  1565. }
  1566. diff = {
  1567. number:'10013',
  1568. Article: ['2'],
  1569. }
  1570. result = App.Utils.formDiff(dataNow, dataLast)
  1571. deepEqual(result, diff, 'check form diff')
  1572. });
  1573. // check decimal format
  1574. test("check decimal format", function() {
  1575. var string = '123'
  1576. var result = '123.00'
  1577. var verify = App.Utils.decimal(string)
  1578. equal(verify, result, string)
  1579. string = '0.6'
  1580. result = '0.60'
  1581. verify = App.Utils.decimal(string)
  1582. equal(verify, result, string)
  1583. string = '6'
  1584. result = '6.00'
  1585. verify = App.Utils.decimal(string)
  1586. equal(verify, result, string)
  1587. string = 6.5
  1588. result = '6.50'
  1589. verify = App.Utils.decimal(string)
  1590. equal(verify, result, string)
  1591. string = '111111.6'
  1592. result = '111111.60'
  1593. verify = App.Utils.decimal(string)
  1594. equal(verify, result, string)
  1595. string = '111111.622'
  1596. result = '111111.62'
  1597. verify = App.Utils.decimal(string)
  1598. equal(verify, result, string)
  1599. string = 'abc.6'
  1600. result = 'abc.6'
  1601. verify = App.Utils.decimal(string)
  1602. equal(verify, result, string)
  1603. string = ''
  1604. result = ''
  1605. verify = App.Utils.decimal(string)
  1606. equal(verify, result, string)
  1607. string = undefined
  1608. result = ''
  1609. verify = App.Utils.decimal(string)
  1610. equal(verify, result, string)
  1611. string = null
  1612. result = ''
  1613. verify = App.Utils.decimal(string)
  1614. equal(verify, result, string)
  1615. });
  1616. // check formatTime format
  1617. test("check formatTime format", function() {
  1618. var string = '123'
  1619. var result = '123'
  1620. var verify = App.Utils.formatTime(string, 0)
  1621. equal(verify, result, string)
  1622. string = '6'
  1623. result = '06'
  1624. verify = App.Utils.formatTime(string, 2)
  1625. equal(verify, result, string)
  1626. string = ''
  1627. result = '00'
  1628. verify = App.Utils.formatTime(string, 2)
  1629. equal(verify, result, string)
  1630. string = undefined
  1631. result = ''
  1632. verify = App.Utils.formatTime(string, 2)
  1633. equal(verify, result, string)
  1634. string = null
  1635. result = ''
  1636. verify = App.Utils.formatTime(string, 2)
  1637. equal(verify, result, string)
  1638. });
  1639. // check diffPosition
  1640. test("check diffPosition format", function() {
  1641. var a = [1,2,3,4]
  1642. var b = [1,2,3,4,5]
  1643. var result = [
  1644. {
  1645. position: 4,
  1646. id: 5,
  1647. },
  1648. ]
  1649. var verify = App.Utils.diffPositionAdd(a, b)
  1650. deepEqual(verify, result)
  1651. a = [2,3,4]
  1652. b = [1,2,3,4]
  1653. result = [
  1654. {
  1655. position: 0,
  1656. id: 1,
  1657. },
  1658. ]
  1659. verify = App.Utils.diffPositionAdd(a, b)
  1660. deepEqual(verify, result)
  1661. a = [2,3,4]
  1662. b = [1,2,3,4,5]
  1663. result = [
  1664. {
  1665. position: 0,
  1666. id: 1,
  1667. },
  1668. {
  1669. position: 4,
  1670. id: 5,
  1671. },
  1672. ]
  1673. verify = App.Utils.diffPositionAdd(a, b)
  1674. deepEqual(verify, result)
  1675. a = [2,3,4]
  1676. b = [1,99,12,2,3,4,5]
  1677. result = [
  1678. {
  1679. position: 0,
  1680. id: 1,
  1681. },
  1682. {
  1683. position: 1,
  1684. id: 99,
  1685. },
  1686. {
  1687. position: 2,
  1688. id: 12,
  1689. },
  1690. {
  1691. position: 6,
  1692. id: 5,
  1693. },
  1694. ]
  1695. verify = App.Utils.diffPositionAdd(a, b)
  1696. deepEqual(verify, result)
  1697. a = [4,3,1]
  1698. b = [1,2,3,4,5]
  1699. result = false
  1700. verify = App.Utils.diffPositionAdd(a, b)
  1701. deepEqual(verify, result)
  1702. a = ['Ticket-347', 'TicketCreateScreen-2217']
  1703. b = ['Ticket-347', 'TicketCreateScreen-2217', 'TicketCreateScreen-71517']
  1704. result = [
  1705. {
  1706. position: 2,
  1707. id: 'TicketCreateScreen-71517',
  1708. },
  1709. ]
  1710. verify = App.Utils.diffPositionAdd(a, b)
  1711. deepEqual(verify, result)
  1712. });
  1713. // check textLengthWithUrl format
  1714. test("check textLengthWithUrl format", function() {
  1715. var string = '123'
  1716. var result = 3
  1717. var verify = App.Utils.textLengthWithUrl(string)
  1718. equal(verify, result)
  1719. string = '123 http is not here'
  1720. result = 20
  1721. verify = App.Utils.textLengthWithUrl(string)
  1722. equal(verify, result)
  1723. string = '123 http://host is not here'
  1724. result = 39
  1725. verify = App.Utils.textLengthWithUrl(string)
  1726. equal(verify, result)
  1727. string = '123 http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX is not here'
  1728. result = 39
  1729. verify = App.Utils.textLengthWithUrl(string)
  1730. equal(verify, result)
  1731. string = 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  1732. result = 23
  1733. verify = App.Utils.textLengthWithUrl(string)
  1734. equal(verify, result)
  1735. string = 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, some other text'
  1736. result = 23 + 17
  1737. verify = App.Utils.textLengthWithUrl(string)
  1738. equal(verify, result)
  1739. string = 'some other text,http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  1740. result = 23 + 16
  1741. verify = App.Utils.textLengthWithUrl(string)
  1742. equal(verify, result)
  1743. string = 'some other text, http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX?abc=123;aaa=ab+c usw'
  1744. result = 23 + 21
  1745. verify = App.Utils.textLengthWithUrl(string)
  1746. equal(verify, result)
  1747. });
  1748. // check getRecipientArticle format
  1749. test('check getRecipientArticle format', function() {
  1750. var customer = {
  1751. login: 'login',
  1752. firstname: 'firstname',
  1753. lastname: 'lastname',
  1754. email: 'customer@example.com',
  1755. }
  1756. var ticket = {
  1757. customer: customer,
  1758. }
  1759. var article = {
  1760. type: {
  1761. name: 'phone',
  1762. },
  1763. sender: {
  1764. name: 'Customer',
  1765. },
  1766. from: customer.email,
  1767. to: 'some group',
  1768. message_id: 'message_id1',
  1769. created_by: {
  1770. login: 'login',
  1771. firstname: 'firstname',
  1772. lastname: 'lastname',
  1773. email: 'article_created_by@example.com',
  1774. },
  1775. }
  1776. var result = {
  1777. to: 'customer@example.com',
  1778. cc: '',
  1779. body: '',
  1780. in_reply_to: 'message_id1',
  1781. }
  1782. var verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1783. deepEqual(verify, result)
  1784. customer = {
  1785. login: 'login',
  1786. firstname: 'firstname',
  1787. lastname: 'lastname',
  1788. email: 'customer@example.com',
  1789. }
  1790. ticket = {
  1791. customer: customer,
  1792. }
  1793. article = {
  1794. type: {
  1795. name: 'phone',
  1796. },
  1797. sender: {
  1798. name: 'Customer',
  1799. },
  1800. from: customer.email,
  1801. message_id: 'message_id2',
  1802. created_by: {
  1803. login: 'login',
  1804. firstname: 'firstname',
  1805. lastname: 'lastname',
  1806. email: 'article_created_by@example.com',
  1807. },
  1808. }
  1809. result = {
  1810. to: customer.email,
  1811. cc: '',
  1812. body: '',
  1813. in_reply_to: 'message_id2',
  1814. }
  1815. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1816. deepEqual(verify, result)
  1817. customer = {
  1818. login: 'login',
  1819. firstname: 'firstname',
  1820. lastname: 'lastname',
  1821. email: 'customer@example.com',
  1822. }
  1823. ticket = {
  1824. customer: customer,
  1825. }
  1826. article = {
  1827. message_id: 'message_id3',
  1828. type: {
  1829. name: 'phone',
  1830. },
  1831. sender: {
  1832. name: 'Agent',
  1833. },
  1834. from: 'article_created_by@example.com',
  1835. created_by: {
  1836. login: 'login',
  1837. firstname: 'firstname',
  1838. lastname: 'lastname',
  1839. email: 'article_created_by@example.com',
  1840. },
  1841. }
  1842. result = {
  1843. to: 'customer@example.com',
  1844. cc: '',
  1845. body: '',
  1846. in_reply_to: 'message_id3',
  1847. }
  1848. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1849. deepEqual(verify, result)
  1850. customer = {
  1851. login: 'login',
  1852. firstname: 'firstname',
  1853. lastname: 'lastname',
  1854. email: 'customer@example.com',
  1855. }
  1856. ticket = {
  1857. customer: customer,
  1858. }
  1859. article = {
  1860. message_id: 'message_id4',
  1861. created_by: customer,
  1862. type: {
  1863. name: 'web',
  1864. },
  1865. sender: {
  1866. name: 'Customer',
  1867. },
  1868. from: customer.email,
  1869. to: 'some group',
  1870. created_by: {
  1871. login: 'login',
  1872. firstname: 'firstname',
  1873. lastname: 'lastname',
  1874. email: 'article_created_by@example.com',
  1875. },
  1876. }
  1877. result = {
  1878. to: 'customer@example.com',
  1879. cc: '',
  1880. body: '',
  1881. in_reply_to: 'message_id4',
  1882. }
  1883. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1884. deepEqual(verify, result)
  1885. customer = {
  1886. login: 'login',
  1887. firstname: 'firstname',
  1888. lastname: 'lastname',
  1889. email: 'customer@example.com',
  1890. }
  1891. ticket = {
  1892. customer: customer,
  1893. }
  1894. article = {
  1895. message_id: 'message_id5',
  1896. type: {
  1897. name: 'web',
  1898. },
  1899. sender: {
  1900. name: 'Customer',
  1901. },
  1902. from: customer.email,
  1903. created_by: {
  1904. login: 'login',
  1905. firstname: 'firstname',
  1906. lastname: 'lastname',
  1907. email: 'article_created_by@example.com',
  1908. }
  1909. }
  1910. result = {
  1911. to: 'customer@example.com',
  1912. cc: '',
  1913. body: '',
  1914. in_reply_to: 'message_id5',
  1915. }
  1916. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1917. deepEqual(verify, result)
  1918. customer = {
  1919. login: 'login',
  1920. firstname: 'firstname',
  1921. lastname: 'lastname',
  1922. email: 'customer@example.com',
  1923. }
  1924. ticket = {
  1925. customer: customer,
  1926. }
  1927. article = {
  1928. message_id: 'message_id6',
  1929. type: {
  1930. name: 'email',
  1931. },
  1932. sender: {
  1933. name: 'Customer',
  1934. },
  1935. from: customer.email,
  1936. to: 'some group',
  1937. created_by: {
  1938. login: 'login',
  1939. firstname: 'firstname',
  1940. lastname: 'lastname',
  1941. email: 'article_created_by@example.com',
  1942. }
  1943. }
  1944. result = {
  1945. to: 'customer@example.com',
  1946. cc: '',
  1947. body: '',
  1948. in_reply_to: 'message_id6',
  1949. }
  1950. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1951. deepEqual(verify, result)
  1952. customer = {
  1953. login: 'login',
  1954. firstname: 'firstname',
  1955. lastname: 'lastname',
  1956. email: 'customer@example.com',
  1957. }
  1958. ticket = {
  1959. customer: customer,
  1960. }
  1961. article = {
  1962. message_id: 'message_id7',
  1963. type: {
  1964. name: 'email',
  1965. },
  1966. sender: {
  1967. name: 'Customer',
  1968. },
  1969. from: 'some other invalid part, ' + customer.email,
  1970. to: 'some group',
  1971. created_by: {
  1972. login: 'login',
  1973. firstname: 'firstname',
  1974. lastname: 'lastname',
  1975. email: 'article_created_by@example.com',
  1976. }
  1977. }
  1978. result = {
  1979. to: 'customer@example.com',
  1980. cc: '',
  1981. body: '',
  1982. in_reply_to: 'message_id7',
  1983. }
  1984. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  1985. console.log(verify)
  1986. deepEqual(verify, result)
  1987. customer = {
  1988. login: 'login',
  1989. firstname: 'firstname',
  1990. lastname: 'lastname',
  1991. email: 'customer@example.com',
  1992. }
  1993. ticket = {
  1994. customer: customer,
  1995. }
  1996. article = {
  1997. message_id: 'message_id7.1',
  1998. type: {
  1999. name: 'email',
  2000. },
  2001. sender: {
  2002. name: 'Customer',
  2003. },
  2004. from: 'some other invalid part, Some Realname ' + customer.email,
  2005. to: 'some group',
  2006. created_by: {
  2007. login: 'login',
  2008. firstname: 'firstname',
  2009. lastname: 'lastname',
  2010. email: 'article_created_by@example.com',
  2011. }
  2012. }
  2013. result = {
  2014. to: 'customer@example.com',
  2015. cc: '',
  2016. body: '',
  2017. in_reply_to: 'message_id7.1',
  2018. }
  2019. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2020. console.log(verify)
  2021. deepEqual(verify, result)
  2022. customer = {
  2023. login: 'login',
  2024. firstname: 'firstname',
  2025. lastname: 'lastname',
  2026. email: 'customer@example.com',
  2027. }
  2028. ticket = {
  2029. customer: customer,
  2030. }
  2031. article = {
  2032. message_id: 'message_id7.2',
  2033. type: {
  2034. name: 'email',
  2035. },
  2036. sender: {
  2037. name: 'Customer',
  2038. },
  2039. from: 'some other invalid part, Some Realname ' + customer.email + ' , abc',
  2040. to: 'some group',
  2041. created_by: {
  2042. login: 'login',
  2043. firstname: 'firstname',
  2044. lastname: 'lastname',
  2045. email: 'article_created_by@example.com',
  2046. }
  2047. }
  2048. result = {
  2049. to: 'customer@example.com',
  2050. cc: '',
  2051. body: '',
  2052. in_reply_to: 'message_id7.2',
  2053. }
  2054. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2055. console.log(verify)
  2056. deepEqual(verify, result)
  2057. customer = {
  2058. login: 'login',
  2059. firstname: 'firstname',
  2060. lastname: 'lastname',
  2061. email: 'customer@example.com',
  2062. }
  2063. agent = {
  2064. login: 'login',
  2065. firstname: 'firstname',
  2066. lastname: 'lastname',
  2067. email: 'agent@example.com',
  2068. }
  2069. ticket = {
  2070. customer: customer,
  2071. }
  2072. article = {
  2073. message_id: 'message_id8',
  2074. created_by: agent,
  2075. type: {
  2076. name: 'email',
  2077. },
  2078. sender: {
  2079. name: 'Agent',
  2080. },
  2081. from: 'customer2@example.com',
  2082. to: 'customer@example.com',
  2083. }
  2084. result = {
  2085. to: 'customer2@example.com',
  2086. cc: '',
  2087. body: '',
  2088. in_reply_to: 'message_id8',
  2089. }
  2090. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2091. deepEqual(verify, result)
  2092. customer = {
  2093. login: 'login',
  2094. firstname: 'firstname',
  2095. lastname: 'lastname',
  2096. email: 'customer@example.com',
  2097. }
  2098. agent = {
  2099. login: 'login',
  2100. firstname: 'firstname',
  2101. lastname: 'lastname',
  2102. email: 'agent@example.com',
  2103. }
  2104. ticket = {
  2105. customer: customer,
  2106. }
  2107. article = {
  2108. message_id: 'message_id9',
  2109. created_by: agent,
  2110. type: {
  2111. name: 'email',
  2112. },
  2113. sender: {
  2114. name: 'Agent',
  2115. },
  2116. from: 'agent@example.com',
  2117. to: 'customer@example.com',
  2118. }
  2119. result = {
  2120. to: 'customer@example.com',
  2121. cc: '',
  2122. body: '',
  2123. in_reply_to: 'message_id9',
  2124. }
  2125. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2126. deepEqual(verify, result)
  2127. customer = {
  2128. login: 'login',
  2129. firstname: 'firstname',
  2130. lastname: 'lastname',
  2131. email: 'customer@example.com',
  2132. }
  2133. agent = {
  2134. login: 'login',
  2135. firstname: 'firstname',
  2136. lastname: 'lastname',
  2137. email: 'agent@example.com',
  2138. }
  2139. ticket = {
  2140. customer: customer,
  2141. }
  2142. article = {
  2143. message_id: 'message_id10',
  2144. created_by: agent,
  2145. type: {
  2146. name: 'email',
  2147. },
  2148. sender: {
  2149. name: 'Agent',
  2150. },
  2151. from: 'Agent@Example.com',
  2152. to: 'customer@example.com',
  2153. cc: 'zammad@example.com',
  2154. }
  2155. result = {
  2156. to: 'customer@example.com',
  2157. cc: '',
  2158. body: '',
  2159. in_reply_to: 'message_id10',
  2160. }
  2161. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2162. deepEqual(verify, result)
  2163. customer = {
  2164. login: 'login',
  2165. firstname: 'firstname',
  2166. lastname: 'lastname',
  2167. email: 'customer@example.com',
  2168. }
  2169. agent = {
  2170. login: 'login',
  2171. firstname: 'firstname',
  2172. lastname: 'lastname',
  2173. email: 'agent@example.com',
  2174. }
  2175. ticket = {
  2176. customer: customer,
  2177. }
  2178. article = {
  2179. message_id: 'message_id11',
  2180. created_by: agent,
  2181. type: {
  2182. name: 'email',
  2183. },
  2184. sender: {
  2185. name: 'Agent',
  2186. },
  2187. from: 'Agent@Example.com',
  2188. to: 'customer@example.com, agent@example.com',
  2189. cc: 'zammad@example.com',
  2190. }
  2191. result = {
  2192. to: 'customer@example.com, agent@example.com',
  2193. cc: 'zammad@example.com',
  2194. body: '',
  2195. in_reply_to: 'message_id11',
  2196. }
  2197. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type, [], true)
  2198. deepEqual(verify, result)
  2199. customer = {
  2200. login: 'login',
  2201. firstname: 'firstname',
  2202. lastname: 'lastname',
  2203. email: 'customer@example.com',
  2204. }
  2205. agent = {
  2206. login: 'login',
  2207. firstname: 'firstname',
  2208. lastname: 'lastname',
  2209. email: 'agent@example.com',
  2210. }
  2211. ticket = {
  2212. customer: customer,
  2213. }
  2214. article = {
  2215. message_id: 'message_id12',
  2216. created_by: agent,
  2217. type: {
  2218. name: 'email',
  2219. },
  2220. sender: {
  2221. name: 'Agent',
  2222. },
  2223. from: 'Agent@Example.com',
  2224. to: 'customeR@EXAMPLE.com, agent@example.com',
  2225. cc: 'zammad@example.com, customer@example.com',
  2226. }
  2227. result = {
  2228. to: 'customer@example.com, agent@example.com',
  2229. cc: 'zammad@example.com',
  2230. body: '',
  2231. in_reply_to: 'message_id12',
  2232. }
  2233. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, [], true)
  2234. deepEqual(verify, result)
  2235. customer = {
  2236. login: 'login',
  2237. firstname: 'firstname',
  2238. lastname: 'lastname',
  2239. email: 'customer@example.com',
  2240. }
  2241. agent = {
  2242. login: 'login',
  2243. firstname: 'firstname',
  2244. lastname: 'lastname',
  2245. email: 'agent@example.com',
  2246. }
  2247. ticket = {
  2248. customer: customer,
  2249. }
  2250. article = {
  2251. message_id: 'message_id13',
  2252. created_by: agent,
  2253. type: {
  2254. name: 'email',
  2255. },
  2256. sender: {
  2257. name: 'Agent',
  2258. },
  2259. from: 'Agent@Example.com',
  2260. to: 'customeR@EXAMPLE.com, agent@example.com, zammad2@EXAMPLE.com',
  2261. cc: 'zammad@example.com, customer2@example.com',
  2262. }
  2263. result = {
  2264. to: 'customer@example.com, agent@example.com',
  2265. cc: 'customer2@example.com',
  2266. body: '',
  2267. in_reply_to: 'message_id13',
  2268. }
  2269. email_addresses = [
  2270. {
  2271. email: 'zammad@example.com',
  2272. },
  2273. {
  2274. email: 'zammad2@example.com',
  2275. }
  2276. ]
  2277. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
  2278. deepEqual(verify, result)
  2279. customer = {
  2280. login: 'login',
  2281. firstname: 'firstname',
  2282. lastname: 'lastname',
  2283. email: 'customer@example.com',
  2284. }
  2285. agent = {
  2286. login: 'login',
  2287. firstname: 'firstname',
  2288. lastname: 'lastname',
  2289. email: 'AGENT@example.com',
  2290. }
  2291. ticket = {
  2292. customer: customer,
  2293. }
  2294. article = {
  2295. message_id: 'message_id14',
  2296. created_by: agent,
  2297. type: {
  2298. name: 'email',
  2299. },
  2300. sender: {
  2301. name: 'Agent',
  2302. },
  2303. from: 'Agent@Example.com',
  2304. to: 'customeR@EXAMPLE.com, agent@example.com, zammad2@EXAMPLE.com',
  2305. cc: 'zammad@example.com, customer2@example.com',
  2306. }
  2307. result = {
  2308. to: 'customer@example.com, agent@example.com',
  2309. cc: 'customer2@example.com',
  2310. body: '',
  2311. in_reply_to: 'message_id14',
  2312. }
  2313. email_addresses = [
  2314. {
  2315. email: 'zammad@example.com',
  2316. },
  2317. {
  2318. email: 'zammad2@example.com',
  2319. }
  2320. ]
  2321. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
  2322. deepEqual(verify, result)
  2323. customer = {
  2324. login: 'login',
  2325. firstname: 'firstname',
  2326. lastname: 'lastname',
  2327. email: 'zammad@example.com',
  2328. }
  2329. ticket = {
  2330. customer: customer,
  2331. }
  2332. article = {
  2333. message_id: 'message_id15',
  2334. created_by: customer,
  2335. type: {
  2336. name: 'email',
  2337. },
  2338. sender: {
  2339. name: 'Agent',
  2340. },
  2341. from: 'zammad@EXAMPLE.com',
  2342. to: 'customeR@EXAMPLE.com, agent@example.com, zammad2@EXAMPLE.com',
  2343. cc: 'zammad@example.com, customer2@example.com',
  2344. }
  2345. result = {
  2346. to: 'customer@example.com, agent@example.com',
  2347. cc: 'customer2@example.com',
  2348. body: '',
  2349. in_reply_to: 'message_id15',
  2350. }
  2351. email_addresses = [
  2352. {
  2353. email: 'zammad@example.com',
  2354. },
  2355. {
  2356. email: 'zammad2@example.com',
  2357. }
  2358. ]
  2359. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
  2360. deepEqual(verify, result)
  2361. customer = {
  2362. login: 'login',
  2363. firstname: 'firstname',
  2364. lastname: 'lastname',
  2365. email: 'customer@example.com',
  2366. }
  2367. ticket = {
  2368. customer: customer,
  2369. }
  2370. article = {
  2371. message_id: 'message_id16',
  2372. created_by: customer,
  2373. type: {
  2374. name: 'email',
  2375. },
  2376. sender: {
  2377. name: 'Agent',
  2378. },
  2379. from: 'customer@example.com',
  2380. to: 'customer1@example.com, customer2@example.com, zammad@example.com',
  2381. cc: '',
  2382. }
  2383. result = {
  2384. to: 'customer1@example.com, customer2@example.com, customer@example.com',
  2385. cc: '',
  2386. body: '',
  2387. in_reply_to: 'message_id16',
  2388. }
  2389. email_addresses = [
  2390. {
  2391. email: 'zammad@example.com',
  2392. },
  2393. {
  2394. email: 'zammad2@example.com',
  2395. }
  2396. ]
  2397. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
  2398. deepEqual(verify, result)
  2399. customer = {
  2400. login: 'login',
  2401. firstname: 'firstname',
  2402. lastname: 'lastname',
  2403. email: 'customer@example.com',
  2404. }
  2405. ticket = {
  2406. customer: customer,
  2407. }
  2408. article = {
  2409. message_id: 'message_id17',
  2410. created_by: customer,
  2411. type: {
  2412. name: 'email',
  2413. },
  2414. sender: {
  2415. name: 'Agent',
  2416. },
  2417. from: 'customer@example.com',
  2418. to: 'customer1@example.com, customer2@example.com, zammad@example.com, customer2+2@example.com',
  2419. cc: '',
  2420. }
  2421. result = {
  2422. to: 'customer1@example.com, customer2@example.com, customer2+2@example.com, customer@example.com',
  2423. cc: '',
  2424. body: '',
  2425. in_reply_to: 'message_id17',
  2426. }
  2427. email_addresses = [
  2428. {
  2429. email: 'zammad@example.com',
  2430. },
  2431. {
  2432. email: 'zammad2@example.com',
  2433. }
  2434. ]
  2435. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
  2436. deepEqual(verify, result)
  2437. customer = {
  2438. login: 'login',
  2439. firstname: 'firstname',
  2440. lastname: 'lastname',
  2441. email: 'customer@example.com',
  2442. }
  2443. agent = {
  2444. login: 'login',
  2445. firstname: 'firstname',
  2446. lastname: 'lastname',
  2447. email: 'zammad@example.com',
  2448. }
  2449. ticket = {
  2450. customer: customer,
  2451. }
  2452. article = {
  2453. message_id: 'message_id18',
  2454. created_by: agent,
  2455. type: {
  2456. name: 'email',
  2457. },
  2458. sender: {
  2459. name: 'Agent',
  2460. },
  2461. from: 'zammad@example.com',
  2462. to: 'customer@example.com',
  2463. cc: '',
  2464. }
  2465. result = {
  2466. to: 'customer@example.com',
  2467. cc: '',
  2468. body: '',
  2469. in_reply_to: 'message_id18',
  2470. }
  2471. email_addresses = [
  2472. {
  2473. email: 'zammad@example.com',
  2474. },
  2475. {
  2476. email: 'zammad2@example.com',
  2477. }
  2478. ]
  2479. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, true)
  2480. deepEqual(verify, result)
  2481. customer = {
  2482. login: 'login',
  2483. firstname: 'firstname',
  2484. lastname: 'lastname',
  2485. email: 'customer@example.com',
  2486. }
  2487. agent = {
  2488. login: 'login',
  2489. firstname: 'firstname',
  2490. lastname: 'lastname',
  2491. email: 'zammad@example.com',
  2492. }
  2493. ticket = {
  2494. customer: customer,
  2495. }
  2496. article = {
  2497. message_id: 'message_id19',
  2498. created_by: agent,
  2499. type: {
  2500. name: 'email',
  2501. },
  2502. sender: {
  2503. name: 'Agent',
  2504. },
  2505. from: 'Sender <zammad@example.com>',
  2506. to: 'Customer <customer@example.com>',
  2507. cc: '',
  2508. }
  2509. result = {
  2510. to: 'customer@example.com',
  2511. cc: '',
  2512. body: '',
  2513. in_reply_to: 'message_id19',
  2514. }
  2515. email_addresses = [
  2516. {
  2517. email: 'zammad@example.com',
  2518. },
  2519. {
  2520. email: 'zammad2@example.com',
  2521. }
  2522. ]
  2523. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, false)
  2524. deepEqual(verify, result)
  2525. agent = {
  2526. login: 'login',
  2527. firstname: 'firstname',
  2528. lastname: 'lastname',
  2529. email: 'agent@example.com',
  2530. }
  2531. ticket = {
  2532. customer: agent,
  2533. }
  2534. article = {
  2535. message_id: 'message_id20',
  2536. created_by: agent,
  2537. type: {
  2538. name: 'email',
  2539. },
  2540. sender: {
  2541. name: 'Agent',
  2542. },
  2543. from: 'Agent <Agent@Example.com>',
  2544. to: 'Sender <zammad@example.com>',
  2545. cc: '',
  2546. }
  2547. result = {
  2548. to: 'agent@example.com',
  2549. cc: '',
  2550. body: '',
  2551. in_reply_to: 'message_id20',
  2552. }
  2553. email_addresses = [
  2554. {
  2555. email: 'zammad@example.com',
  2556. },
  2557. {
  2558. email: 'zammad2@example.com',
  2559. }
  2560. ]
  2561. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, false)
  2562. deepEqual(verify, result)
  2563. agent = {
  2564. login: 'login',
  2565. firstname: 'firstname',
  2566. lastname: 'lastname',
  2567. email: 'agent@example.com',
  2568. }
  2569. ticket = {
  2570. customer: agent,
  2571. }
  2572. article = {
  2573. message_id: 'message_id20',
  2574. created_by: agent,
  2575. type: {
  2576. name: 'email',
  2577. },
  2578. sender: {
  2579. name: 'Agent',
  2580. },
  2581. from: 'Agent <Agent@Example.com>',
  2582. to: 'somebodyelse@example.com, Zammad <zammad@example.com>',
  2583. cc: '',
  2584. }
  2585. result = {
  2586. to: 'agent@example.com',
  2587. cc: '',
  2588. body: '',
  2589. in_reply_to: 'message_id20',
  2590. }
  2591. email_addresses = [
  2592. {
  2593. email: 'zammad@example.com',
  2594. },
  2595. {
  2596. email: 'zammad2@example.com',
  2597. }
  2598. ]
  2599. verify = App.Utils.getRecipientArticle(ticket, article, agent, article.type, email_addresses, false)
  2600. deepEqual(verify, result)
  2601. customer = {
  2602. login: 'login',
  2603. firstname: 'firstname',
  2604. lastname: 'lastname',
  2605. email: "'customer@example.com'",
  2606. }
  2607. agent = {
  2608. login: 'login',
  2609. firstname: 'firstname',
  2610. lastname: 'lastname',
  2611. email: 'agent@example.com',
  2612. }
  2613. ticket = {
  2614. customer: customer,
  2615. }
  2616. article = {
  2617. message_id: 'message_id21',
  2618. created_by: agent,
  2619. type: {
  2620. name: 'email',
  2621. },
  2622. sender: {
  2623. name: 'Agent',
  2624. },
  2625. from: customer.email,
  2626. to: 'agent@example.com',
  2627. }
  2628. result = {
  2629. to: 'customer@example.com',
  2630. cc: '',
  2631. body: '',
  2632. in_reply_to: 'message_id21',
  2633. }
  2634. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2635. deepEqual(verify, result)
  2636. // Regression test for issue #2184
  2637. // Case 1
  2638. // 1. Create a "Received Call" Ticket for article_customer
  2639. // 2. Change the Customer of the ticket to ticket_customer (but article.from still points to article_customer)
  2640. // 3. Reply to the first Article
  2641. // Recipient SHOULD BE Article.from
  2642. var article_customer = {
  2643. login: 'login',
  2644. firstname: 'article',
  2645. lastname: 'lastname',
  2646. email: 'article_customer@example.com',
  2647. }
  2648. var ticket_customer = {
  2649. login: 'login2',
  2650. firstname: 'ticket',
  2651. lastname: 'lastname',
  2652. email: 'ticket_customer@example.com',
  2653. }
  2654. ticket = {
  2655. customer: ticket_customer,
  2656. }
  2657. article = {
  2658. type: {
  2659. name: 'phone',
  2660. },
  2661. sender: {
  2662. name: 'Customer',
  2663. },
  2664. from: 'article lastname <article_customer@example.com>',
  2665. to: 'some group',
  2666. message_id: 'message_id22',
  2667. created_by: {
  2668. login: 'login',
  2669. firstname: 'firstname',
  2670. lastname: 'lastname',
  2671. email: 'article_created_by@example.com',
  2672. },
  2673. }
  2674. result = {
  2675. to: 'article_customer@example.com',
  2676. cc: '',
  2677. body: '',
  2678. in_reply_to: 'message_id22',
  2679. }
  2680. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2681. deepEqual(verify, result)
  2682. // Regression test for issue #2184
  2683. // Case 2
  2684. // 1. Create a "Outbound Call" Ticket for article_customer
  2685. // 2. Change the Customer of the Ticket to ticket_customer (but article.to still points to article_customer)
  2686. // 3. Reply to the first Article
  2687. // Recipient SHOULD BE Article.to
  2688. article_customer = {
  2689. login: 'login',
  2690. firstname: 'article',
  2691. lastname: 'lastname',
  2692. email: 'article_customer@example.com',
  2693. }
  2694. ticket_customer = {
  2695. login: 'login2',
  2696. firstname: 'ticket',
  2697. lastname: 'lastname',
  2698. email: 'ticket_customer@example.com',
  2699. }
  2700. ticket = {
  2701. customer: ticket_customer,
  2702. }
  2703. article = {
  2704. type: {
  2705. name: 'phone',
  2706. },
  2707. sender: {
  2708. name: 'Agent',
  2709. },
  2710. from: 'agent1@example.com',
  2711. to: article_customer.email,
  2712. message_id: 'message_id23',
  2713. created_by: {
  2714. login: 'login',
  2715. firstname: 'firstname',
  2716. lastname: 'lastname',
  2717. email: 'article_created_by@example.com',
  2718. },
  2719. }
  2720. result = {
  2721. to: 'article_customer@example.com',
  2722. cc: '',
  2723. body: '',
  2724. in_reply_to: 'message_id23',
  2725. }
  2726. verify = App.Utils.getRecipientArticle(ticket, article, article.created_by, article.type)
  2727. deepEqual(verify, result)
  2728. });
  2729. test("contentTypeCleanup", function() {
  2730. var source = "image/png"
  2731. var should = "image/png"
  2732. var result = App.Utils.contentTypeCleanup(source)
  2733. equal(result, should, source)
  2734. source = "image/png; some.file"
  2735. should = "image/png"
  2736. result = App.Utils.contentTypeCleanup(source)
  2737. equal(result, should, source)
  2738. source = "image/png;some.file"
  2739. should = "image/png"
  2740. result = App.Utils.contentTypeCleanup(source)
  2741. equal(result, should, source)
  2742. source = "image/jpeg;some.file"
  2743. should = "image/jpeg"
  2744. result = App.Utils.contentTypeCleanup(source)
  2745. equal(result, should, source)
  2746. source = "image/jpg;some.file"
  2747. should = "image/jpg"
  2748. result = App.Utils.contentTypeCleanup(source)
  2749. equal(result, should, source)
  2750. source = "image/gif;some.file"
  2751. should = "image/gif"
  2752. result = App.Utils.contentTypeCleanup(source)
  2753. equal(result, should, source)
  2754. source = "image/gif\n;some.file"
  2755. should = "image/gif"
  2756. result = App.Utils.contentTypeCleanup(source)
  2757. equal(result, should, source)
  2758. });
  2759. // htmlImage2DataUrl
  2760. test("htmlImage2DataUrl", function() {
  2761. var source = '<div>test 13</div>'
  2762. var should = '<div>test 13</div>'
  2763. var result = App.Utils.htmlImage2DataUrl(source)
  2764. equal(result, should, source)
  2765. source = 'some test'
  2766. should = 'some test'
  2767. result = App.Utils.htmlImage2DataUrl(source)
  2768. equal(result, should, source)
  2769. source = '<img src="some url">some test'
  2770. should = '<img src="data:,">some test'
  2771. result = App.Utils.htmlImage2DataUrl(source)
  2772. equal(result, should, source)
  2773. source = '<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAADAAEDAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAACv/EABQQAQAAAAAAAAAAAAAAAAAAAAD/xAAUAQEAAAAAAAAAAAAAAAAAAAAF/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AbgQDv//Z">some test'
  2774. should = '<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAADAAEDAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAACv/EABQQAQAAAAAAAAAAAAAAAAAAAAD/xAAUAQEAAAAAAAAAAAAAAAAAAAAF/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AbgQDv//Z">some test'
  2775. result = App.Utils.htmlImage2DataUrl(source)
  2776. equal(result, should, source)
  2777. source = '<img src="data:image/jpeg;base64,some_data_123">some <img src="some url">test'
  2778. should = '<img src="data:image/jpeg;base64,some_data_123">some <img src="data:,">test'
  2779. result = App.Utils.htmlImage2DataUrl(source)
  2780. equal(result, should, source)
  2781. // GitHub issue #2305
  2782. source = '<img src="cid:1234">some test'
  2783. should = '<img src="cid:1234">some test'
  2784. result = App.Utils.htmlImage2DataUrl(source)
  2785. equal(result, should, source)
  2786. // GitHub issue #2701
  2787. source = '<img alt="foo">some test'
  2788. should = '<img alt="foo">some test'
  2789. result = App.Utils.htmlImage2DataUrl(source)
  2790. equal(result, should, source)
  2791. });
  2792. test('App.Utils.icon()', function() {
  2793. // When given no arguments,
  2794. // expect @icon() to return null
  2795. equal(App.Utils.icon(), null, 'with no arguments')
  2796. // On a modern browser and when given a single argument,
  2797. // expect @icon(name) to return an <svg> tag
  2798. window.svgPolyfill = false
  2799. svgTag = '<svg class="icon icon-foo "><use xlink:href="assets/images/icons.svg#icon-foo" /></svg>'
  2800. equal(App.Utils.icon('foo'), svgTag, 'with one arg / no SVG polyfill')
  2801. // On a modern browser and when given two arguments,
  2802. // expect @icon(name) to return an <svg> tag
  2803. // with second arg as add'l class name
  2804. window.svgPolyfill = false
  2805. svgTag = '<svg class="icon icon-foo bar"><use xlink:href="assets/images/icons.svg#icon-foo" /></svg>'
  2806. equal(App.Utils.icon('foo', 'bar'), svgTag, 'with two args / no SVG polyfill')
  2807. // On a browser requiring SVG polyfill and when given a single argument,
  2808. // expect @icon(name, class) to return an <svg> tag
  2809. // with pathless xlink:href attr
  2810. window.svgPolyfill = true
  2811. svgTag = '<svg class="icon icon-foo "><use xlink:href="#icon-foo" /></svg>'
  2812. equal(App.Utils.icon('foo'), svgTag, 'with one arg / SVG polyfill')
  2813. // On a browser requiring SVG polyfill and when given two arguments,
  2814. // expect @icon(name, class) to return an <svg> tag
  2815. // with pathless xlink:href attr and second arg as add'l class name
  2816. window.svgPolyfill = true
  2817. svgTag = '<svg class="icon icon-foo bar"><use xlink:href="#icon-foo" /></svg>'
  2818. equal(App.Utils.icon('foo', 'bar'), svgTag, 'with two args / SVG polyfill')
  2819. // For a left-to-right browser language and when given an argument containing '{start}' or '{end}',
  2820. // expect @icon(name) to return an <svg> tag
  2821. // replacing '{start}' with 'left' and '{end}' with 'right'
  2822. window.svgPolyfill = false
  2823. App.i18n.dir = function() { return 'ltr' }
  2824. svgTag = '<svg class="icon icon-arrow-left "><use xlink:href="assets/images/icons.svg#icon-arrow-left" /></svg>'
  2825. equal(App.Utils.icon('arrow-{start}'), svgTag, 'for ltr locale / name includes "{start}"')
  2826. svgTag = '<svg class="icon icon-arrow-right "><use xlink:href="assets/images/icons.svg#icon-arrow-right" /></svg>'
  2827. equal(App.Utils.icon('arrow-{end}'), svgTag, 'for ltr locale / name includes "{end}"')
  2828. // For a right-to-left browser language and when given an argument containing '{start}' or '{end}',
  2829. // expect @icon(name) to return an <svg> tag
  2830. // replacing '{start}' with 'left' and '{end}' with 'right'
  2831. window.svgPolyFill = false
  2832. App.i18n.dir = function() { return 'rtl' }
  2833. svgTag = '<svg class="icon icon-arrow-right "><use xlink:href="assets/images/icons.svg#icon-arrow-right" /></svg>'
  2834. equal(App.Utils.icon('arrow-{start}'), svgTag, 'for rtl locale / name includes "{start}"')
  2835. svgTag = '<svg class="icon icon-arrow-left "><use xlink:href="assets/images/icons.svg#icon-arrow-left" /></svg>'
  2836. equal(App.Utils.icon('arrow-{end}'), svgTag, 'for rtl locale / name includes "{end}"')
  2837. });
  2838. source = '<img src="/assets/images/avatar-bg.png">some test'
  2839. $('#image2text').html(source)
  2840. var htmlImage2DataUrlTest = function() {
  2841. var result = App.Utils.htmlImage2DataUrl(source)
  2842. test("htmlImage2DataUrl async", function() {
  2843. var result = App.Utils.htmlImage2DataUrl(source)
  2844. ok(result.match(/some test/), source)
  2845. ok(!result.match(/avatar-bg.png/), source)
  2846. ok(result.match(/^\<img src=\"data:image\/png;base64,/), source)
  2847. });
  2848. }
  2849. $('#image2text img').one('load', htmlImage2DataUrlTest)
  2850. }
  2851. test('App.Utils.baseUrl()', function() {
  2852. // When FQDN is undefined or null,
  2853. // expect @baseUrl() to return window.location.origin
  2854. App.Config.get = function(key) { return undefined }
  2855. equal(App.Utils.baseUrl(), window.location.origin, 'with undefined FQDN')
  2856. App.Config.get = function(key) { return null }
  2857. equal(App.Utils.baseUrl(), window.location.origin, 'with null FQDN')
  2858. // When FQDN is zammad.example.com,
  2859. // expect @baseUrl() to return window.location.origin
  2860. App.Config.get = function(key) {
  2861. if (key === 'fqdn') {
  2862. return 'zammad.example.com'
  2863. }
  2864. }
  2865. equal(App.Utils.baseUrl(), window.location.origin, 'with FQDN zammad.example.com')
  2866. // Otherwise,
  2867. // expect @baseUrl() to return FQDN with current HTTP(S) scheme
  2868. App.Config.get = function(key) {
  2869. if (key === 'fqdn') {
  2870. return 'foo.zammad.com'
  2871. } else if (key === 'http_type') {
  2872. return 'https'
  2873. }
  2874. }
  2875. equal(App.Utils.baseUrl(), 'https://foo.zammad.com', 'with any other FQDN (and https scheme)')
  2876. App.Config.get = function(key) {
  2877. if (key === 'fqdn') {
  2878. return 'bar.zammad.com'
  2879. } else if (key === 'http_type') {
  2880. return 'http'
  2881. }
  2882. }
  2883. equal(App.Utils.baseUrl(), 'http://bar.zammad.com', 'with any other FQDN (and http scheme)')
  2884. });
  2885. test('App.Utils.joinUrlComponents()', function() {
  2886. // When given a list of strings,
  2887. // expect @joinUrlComponents() to join them with slashes
  2888. equal(App.Utils.joinUrlComponents('foo', 'bar', 'baz'), 'foo/bar/baz', 'with a destructured list of strings')
  2889. // When given an array of strings,
  2890. // expect @joinUrlComponents() to join them with slashes
  2891. equal(App.Utils.joinUrlComponents(['foo', 'bar', 'baz']), 'foo/bar/baz', 'with an array of strings')
  2892. // When given a list of many types,
  2893. // expect @joinUrlComponents() to join their string representations with slashes
  2894. equal(App.Utils.joinUrlComponents(0, 1, 'two', true, false, { foo: 'bar' }), '0/1/two/true/false/[object Object]', 'with a list of many types')
  2895. // When given a list including null or undefined,
  2896. // expect @joinUrlComponents() to filter them out of the results before joining the rest with slashes
  2897. equal(App.Utils.joinUrlComponents('foo', undefined, 'bar', null, 'baz'), 'foo/bar/baz', 'with a list including null or undefined')
  2898. });
  2899. test('App.Utils.signatureIdentifyByHtmlHelper()', function() {
  2900. result = App.Utils.signatureIdentifyByHtmlHelper("&lt;script&gt;alert('fish2');&lt;/script&gt;<blockquote></blockquote>")
  2901. equal(result, "&lt;script&gt;alert('fish2');&lt;/script&gt;<span class=\"js-signatureMarker\"></span><blockquote></blockquote>", 'signatureIdentifyByHtmlHelper does not reactivate alert')
  2902. });