test14.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 014</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "de": "FORCEHYPHENOPOLY",
  10. "en-us": "FORCEHYPHENOPOLY"
  11. },
  12. setup: {
  13. selectors: {
  14. ".class1": {
  15. hyphen: "•",
  16. leftmin: 0,
  17. rightmin: 0
  18. },
  19. ".class2": {
  20. hyphen: "•",
  21. leftmin: 4,
  22. rightmin: 4
  23. },
  24. ".class3": {
  25. hyphen: "•",
  26. leftmin: 0,
  27. leftminPerLang: {
  28. "de": 4,
  29. "en-us": 4
  30. }
  31. }
  32. }
  33. },
  34. handleEvent: {
  35. hyphenopolyEnd: function (e) {
  36. assert();
  37. }
  38. }
  39. };
  40. function assert() {
  41. var tests = 3;
  42. var i = 1;
  43. var test = "";
  44. var ref = "";
  45. var result = false;
  46. while (i <= tests) {
  47. test = document.getElementById("test" + i).innerHTML;
  48. ref = document.getElementById("ref" + i).innerHTML;
  49. if (test === ref) {
  50. document.getElementById("result").innerHTML += "<span style=\"background-color: #d6ffd6\">" + (function (i) {
  51. return (i < 10) ? "0" + i : i;
  52. }(i)) + "</span> ";
  53. result = result || true;
  54. } else {
  55. document.getElementById("result").innerHTML += "<span style=\"background-color: #ffd6d6\">" + (function (i) {
  56. return (i < 10) ? "0" + i : i;
  57. }(i)) + "</span> ";
  58. result = result || false;
  59. }
  60. i += 1;
  61. }
  62. if (parent != window) {
  63. parent.postMessage(JSON.stringify({
  64. desc: document.getElementById("desc").innerHTML,
  65. index: 14,
  66. result: (result ? "passed" : "failed")
  67. }), window.location.href);
  68. }
  69. }
  70. </script>
  71. <script src="../Hyphenopoly_Loader.js"></script>
  72. <style type="text/css">
  73. body {
  74. width:50%;
  75. margin-left:25%;
  76. margin-right:25%;
  77. }
  78. .test {
  79. background-color: #D8E2F9;
  80. }
  81. .ref {
  82. background-color: #FEEFC0;
  83. }
  84. .hyphenate {
  85. hyphens: auto;
  86. -ms-hyphens: auto;
  87. -moz-hyphens: auto;
  88. -webkit-hyphens: auto;
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test13.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test15.html">Next&nbsp;&rarr;</a></div>
  94. <h1>Test 014</h1>
  95. <p id="desc">Test left-/rightmin and left-/rightminPerLang</p>
  96. <div id="result"></div>
  97. <hr>
  98. <p id="test1" class="test class1" lang="de">Silbentrennungsalgorithmus</p>
  99. <p id="ref1" class="ref" lang="de">Sil•ben•tren•nungs•al•go•rith•mus</p>
  100. <p id="test2" class="test class2" lang="de">Silbentrennungsalgorithmus</p>
  101. <p id="ref2" class="ref" lang="de">Silben•tren•nungs•al•go•rithmus</p>
  102. <p id="test3" class="test class3" lang="de">Silbentrennungsalgorithmus <span lang="en-us">hyphenation</span></p>
  103. <p id="ref3" class="ref" lang="de">Silben•tren•nungs•al•go•rith•mus <span lang="en-us">hyphen•ation</span></p>
  104. <hr>
  105. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  106. </body>
  107. </html>