test13.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 013</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "en-us": "FORCEHYPHENOPOLY",
  10. "de": "FORCEHYPHENOPOLY"
  11. },
  12. setup: {
  13. selectors: {
  14. ".hyphenate": {
  15. hyphen: "•"
  16. },
  17. ".hyphenate2": {}
  18. },
  19. exceptions: {
  20. "global": "FORTRAN, Java-Script",
  21. "en-us": "Web-As-sem-bly",
  22. "de": "Web-Assembly"
  23. }
  24. },
  25. handleEvent: {
  26. hyphenopolyEnd: function (e) {
  27. assert();
  28. }
  29. }
  30. };
  31. function assert() {
  32. var tests = 2;
  33. var i = 1;
  34. var test = "";
  35. var ref = "";
  36. var result = false;
  37. while (i <= tests) {
  38. test = document.getElementById("test" + i).innerHTML;
  39. ref = document.getElementById("ref" + i).innerHTML;
  40. if (test === ref) {
  41. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
  42. result = result || true;
  43. } else {
  44. document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
  45. result = result || false;
  46. }
  47. i += 1;
  48. }
  49. if (parent != window) {
  50. parent.postMessage(JSON.stringify({
  51. desc: document.getElementById("desc").innerHTML,
  52. index: 13,
  53. result: (result ? "passed" : "failed")
  54. }), window.location.href);
  55. }
  56. }
  57. </script>
  58. <script src="../Hyphenopoly_Loader.js"></script>
  59. <style type="text/css">
  60. body {
  61. width:50%;
  62. margin-left:25%;
  63. margin-right:25%;
  64. }
  65. .test {
  66. background-color: #D8E2F9;
  67. }
  68. .ref {
  69. background-color: #FEEFC0;
  70. }
  71. .hyphenate {
  72. hyphens: auto;
  73. -ms-hyphens: auto;
  74. -moz-hyphens: auto;
  75. -webkit-hyphens: auto;
  76. }
  77. </style>
  78. </head>
  79. <body>
  80. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test12.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test14.html">Next&nbsp;&rarr;</a></div>
  81. <h1>Test 013</h1>
  82. <p id="desc">Check exceptions</p>
  83. <div id="result"></div>
  84. <hr>
  85. <p id="test1" class="test hyphenate" lang="en-us">FORTRAN, JavaScript, WebAssembly <span lang="de">(WebAssembly)</span></p>
  86. <p id="ref1" class="ref" lang="en-us">FORTRAN, Java•Script, Web•As•sem•bly <span lang="de">(Web•Assembly)</span></p>
  87. <p id="test2" class="test hyphenate2" lang="en-us">FORTRAN, JavaScript, WebAssembly <span lang="de">(WebAssembly)</span></p>
  88. <p id="ref2" class="ref" lang="en-us">FORTRAN, Java&shy;Script, Web&shy;As&shy;sem&shy;bly <span lang="de">(Web&shy;Assembly)</span></p>
  89. <hr>
  90. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  91. </body>
  92. </html>