test34.html 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 034</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "foobar": "garzabariktimalborsi",
  10. "en-us": "FORCEHYPHENOPOLY"
  11. },
  12. setup: {
  13. safeCopy: false,
  14. checkRes: true
  15. },
  16. handleEvent: {
  17. hyphenopolyEnd: function (e) {
  18. assert();
  19. }
  20. }
  21. };
  22. function assert() {
  23. var tests = 2;
  24. var i = 1;
  25. var test = "";
  26. var ref = "";
  27. var result = true;
  28. var lang = "";
  29. while (i <= tests) {
  30. lang = document.getElementById("test" + i).lang;
  31. if (Hyphenopoly.cf.langs[lang] === "CSS") {
  32. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed (CSS)</p>";
  33. result = result && true;
  34. } else {
  35. test = document.getElementById("test" + i).innerHTML;
  36. ref = document.getElementById("ref" + i).innerHTML;
  37. if (test === ref) {
  38. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
  39. result = result && true;
  40. } else {
  41. document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
  42. result = false;
  43. }
  44. }
  45. i += 1;
  46. }
  47. if (parent != window) {
  48. parent.postMessage(JSON.stringify({
  49. desc: document.getElementById("desc").innerHTML,
  50. index: 34,
  51. result: (result ? "passed" : "failed")
  52. }), window.location.href);
  53. }
  54. }
  55. </script>
  56. <script src="../Hyphenopoly_Loader.js"></script>
  57. <style type="text/css">
  58. body {
  59. width:50%;
  60. margin-left:25%;
  61. margin-right:25%;
  62. }
  63. .test {
  64. background-color: #D8E2F9;
  65. }
  66. .ref {
  67. background-color: #FEEFC0;
  68. }
  69. .hyphenate {
  70. hyphens: auto;
  71. -ms-hyphens: auto;
  72. -moz-hyphens: auto;
  73. -webkit-hyphens: auto;
  74. }
  75. </style>
  76. </head>
  77. <body>
  78. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test33.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test35.html">Next&nbsp;&rarr;</a></div>
  79. <h1>Test 034</h1>
  80. <p id="desc">Recover from 404 if .hpb doesn't exist.</p>
  81. <div id="result"></div>
  82. <hr>
  83. <h2>1: foobar</h2>
  84. <p id="test1" class="test hyphenate" lang="foobar">Izgarz blonab schub ei follar quabsi zubur ma na fnaghi. Dalla burksi fad pelo i fnagha werksnar.</p>
  85. <p id="ref1" class="ref" lang="foobar">Izgarz blonab schub ei follar quabsi zubur ma na fnaghi. Dalla burksi fad pelo i fnagha werksnar.</p>
  86. <h2>2: en</h2>
  87. <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>
  88. <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>
  89. <hr>
  90. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  91. </body>
  92. </html>