test29.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 029</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "en-us": "FORCEHYPHENOPOLY",
  10. "en-au": "FORCEHYPHENOPOLY",
  11. "de": "FORCEHYPHENOPOLY",
  12. "de-ch": "FORCEHYPHENOPOLY"
  13. },
  14. fallbacks: {
  15. "en-au": "en-gb",
  16. "de-ch": "de"
  17. },
  18. setup: {
  19. hide: "all",
  20. selectors: {
  21. ".hyphenate": {
  22. hyphen: "|"
  23. }
  24. }
  25. },
  26. handleEvent: {
  27. hyphenopolyEnd: function (e) {
  28. assert();
  29. }
  30. }
  31. };
  32. function assert() {
  33. var tests = 6;
  34. var i = 1;
  35. var test = "";
  36. var ref = "";
  37. var result = true;
  38. while (i <= tests) {
  39. test = document.getElementById("test" + i).innerHTML;
  40. ref = document.getElementById("ref" + i).innerHTML;
  41. if (test === ref) {
  42. document.getElementById("result").innerHTML += "<span style=\"background-color: #d6ffd6\">" + (function (i) {
  43. return (i < 10) ? "0" + i : i;
  44. }(i)) + "</span> ";
  45. result = result && true;
  46. } else {
  47. document.getElementById("result").innerHTML += "<span style=\"background-color: #ffd6d6\">" + (function (i) {
  48. return (i < 10) ? "0" + i : i;
  49. }(i)) + "</span> ";
  50. result = false;
  51. }
  52. i += 1;
  53. }
  54. if (parent != window) {
  55. parent.postMessage(JSON.stringify({
  56. desc: document.getElementById("desc").innerHTML,
  57. index: 29,
  58. result: (result ? "passed" : "failed")
  59. }), window.location.href);
  60. }
  61. }
  62. </script>
  63. <script src="../Hyphenopoly_Loader.js"></script>
  64. <style type="text/css">
  65. body {
  66. width:50%;
  67. margin-left:25%;
  68. margin-right:25%;
  69. }
  70. .test {
  71. background-color: #D8E2F9;
  72. }
  73. .ref {
  74. background-color: #FEEFC0;
  75. }
  76. </style>
  77. </head>
  78. <body>
  79. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test28.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test30.html">Next&nbsp;&rarr;</a></div>
  80. <h1>Test 029</h1>
  81. <p id="desc">Check case-insensitiveness of lang attributes and fallbacks.</p>
  82. <div id="result">R: </div>
  83. <hr>
  84. <h2>1: en-us</h2>
  85. <p id="test1" class="test hyphenate" lang="en-us">A hyphenation algorithm is a set of rules that decides at which points a word can be broken over two lines with a hyphen.</p>
  86. <p id="ref1" class="ref" lang="en-us">A hy|phen|ation al|go|rithm is a set of rules that de|cides at which points a word can be bro|ken over two lines with a hy|phen.</p>
  87. <h2>2: en-US</h2>
  88. <p id="test2" class="test hyphenate" lang="en-US">A hyphenation algorithm is a set of rules that decides at which points a word can be broken over two lines with a hyphen.</p>
  89. <p id="ref2" class="ref" lang="en-US">A hy|phen|ation al|go|rithm is a set of rules that de|cides at which points a word can be bro|ken over two lines with a hy|phen.</p>
  90. <h2>3: en-au (fallback to en-gb)</h2>
  91. <p id="test3" class="test hyphenate" lang="en-au">A hyphenation algorithm is a set of rules that decides at which points a word can be broken over two lines with a hyphen.</p>
  92. <p id="ref3" class="ref" lang="en-au">A hy|phen|a|tion al|gorithm is a set of rules that de|cides at which points a word can be broken over two lines with a hy|phen.</p>
  93. <h2>4: en-AU (fallback to en-gb)</h2>
  94. <p id="test4" class="test hyphenate" lang="en-AU">A hyphenation algorithm is a set of rules that decides at which points a word can be broken over two lines with a hyphen.</p>
  95. <p id="ref4" class="ref" lang="en-AU">A hy|phen|a|tion al|gorithm is a set of rules that de|cides at which points a word can be broken over two lines with a hy|phen.</p>
  96. <h2>5: de</h2>
  97. <p id="test5" class="test hyphenate" lang="de">Die Worttrennung, auch Silbentrennung genannt, bezeichnet in der Orthographie die Art und Weise, wie die Wörter insbesondere am Zeilenende getrennt werden können.</p>
  98. <p id="ref5" class="ref" lang="de">Die Wort|tren|nung, auch Sil|ben|tren|nung ge|nannt, be|zeich|net in der Or|tho|gra|phie die Art und Weise, wie die Wör|ter ins|be|son|de|re am Zei|len|en|de ge|trennt wer|den kön|nen.</p>
  99. <h2>6: de-CH (fallback to de)</h2>
  100. <p id="test6" class="test hyphenate" lang="de-CH">Die Worttrennung, auch Silbentrennung genannt, bezeichnet in der Orthographie die Art und Weise, wie die Wörter insbesondere am Zeilenende getrennt werden können.</p>
  101. <p id="ref6" class="ref" lang="de-CH">Die Wort|tren|nung, auch Sil|ben|tren|nung ge|nannt, be|zeich|net in der Or|tho|gra|phie die Art und Weise, wie die Wör|ter ins|be|son|de|re am Zei|len|en|de ge|trennt wer|den kön|nen.</p>
  102. <hr>
  103. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  104. </body>
  105. </html>