test33.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 033</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "en-us": "FORCEHYPHENOPOLY",
  10. "en-au": "FORCEHYPHENOPOLY"
  11. },
  12. fallbacks: {
  13. "en-au": "en-us"
  14. },
  15. setup: {
  16. safeCopy: false
  17. },
  18. handleEvent: {
  19. hyphenopolyEnd: function (e) {
  20. assert();
  21. }
  22. }
  23. };
  24. function assert() {
  25. var tests = 2;
  26. var i = 1;
  27. var test = "";
  28. var ref = "";
  29. var result = true;
  30. var lang = "";
  31. while (i <= tests) {
  32. lang = document.getElementById("test" + i).lang;
  33. if (Hyphenopoly.cf.langs[lang] === "CSS") {
  34. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed (CSS)</p>";
  35. result = result && true;
  36. } else {
  37. test = document.getElementById("test" + i).innerHTML;
  38. ref = document.getElementById("ref" + i).innerHTML;
  39. if (test === ref) {
  40. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
  41. result = result && true;
  42. } else {
  43. document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
  44. result = false;
  45. }
  46. }
  47. i += 1;
  48. }
  49. if (parent != window) {
  50. parent.postMessage(JSON.stringify({
  51. desc: document.getElementById("desc").innerHTML,
  52. index: 33,
  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="test32.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test34.html">Next&nbsp;&rarr;</a></div>
  81. <h1>Test 033</h1>
  82. <p id="desc">Make sure en-us.hpb isn't loaded twice (see network tab).</p>
  83. <div id="result"></div>
  84. <hr>
  85. <h2>1: en-au</h2>
  86. <p id="test1" 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>
  87. <p id="ref1" class="ref" lang="en-au">A hy&shy;phen&shy;ation al&shy;go&shy;rithm is a set of rules that de&shy;cides at which points a word can be bro&shy;ken over two lines with a hy&shy;phen.</p>
  88. <h2>2: en</h2>
  89. <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>
  90. <p id="ref2" class="ref" lang="en">A hy&shy;phen&shy;ation al&shy;go&shy;rithm is a set of rules that de&shy;cides at which points a word can be bro&shy;ken over two lines with a hy&shy;phen.</p>
  91. <hr>
  92. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  93. </body>
  94. </html>