test31.html 3.3 KB

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