123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Test 037</title>
- <script>
- var mode = window.location.search.substring(1);
- var path = "../";
- if (mode === "fail") {
- path = "../foobar/"
- }
- var Hyphenopoly = {
- require: {
- "fur": "probabilmentri"
- },
- paths: {
- maindir: path
- },
- setup: {
- selectors: {
- ".hyphenate": {
- hyphen: "|",
- minWordLength: 4
- }
- }
- }
- };
- window.onload = function () {
- function hyphenate_fur(text) {
- if (window.Promise) {
- Hyphenopoly.hyphenators.fur.then(
- function (furhyph) {
- document.getElementById("test1").innerText = furhyph(text);
- assertAll();
- }).catch(function(e) {
- assertError(e);
- });
- } else {
- result = false
- if (parent != window) {
- parent.postMessage(JSON.stringify({
- desc: document.getElementById("desc").innerHTML,
- index: 37,
- result: (result ? "passed" : "failed")
- }), window.location.href);
- }
- }
- }
- hyphenate_fur("Il furlan e je une lenghe romanze de famee des lenghis retichis, che e je fevelade soredut intal Friûl, ma ancje vie pal mont. Cualchi volte al ven clamât Ladin orientâl, parcè che al à diviers ponts in comun cul ladin, ma si è svilupât in un altri mût cul passâ dal timp, sot de influence des lenghis ator dal Friûl");
- };
- function assertError(e) {
- var result = false;
- if (e.message.indexOf("File hyphenEngine.wasm can't be loaded from ../foobar/") !== -1) {
- result = true;
- }
- if (result) {
- document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + 1 + " passed</p>";
- }
- if (parent != window) {
- parent.postMessage(JSON.stringify({
- desc: document.getElementById("desc").innerHTML,
- index: 37,
- result: (result ? "passed" : "failed")
- }), window.location.href);
- }
- }
- function assertAll() {
- var tests = 1;
- var i = 1;
- var test = "";
- var ref = "";
- var result = false;
- while (i <= tests) {
- test = document.getElementById("test" + i).innerHTML;
- ref = document.getElementById("ref" + i).innerHTML;
- if (test === ref) {
- document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
- result = result || true;
- } else {
- document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
- result = result || false;
- }
- i += 1;
- }
- if (parent != window) {
- parent.postMessage(JSON.stringify({
- desc: document.getElementById("desc").innerHTML,
- index: 37,
- result: (result ? "passed" : "failed")
- }), window.location.href);
- }
- window.location = "test37.html?fail";
- }
- </script>
- <script src="../Hyphenopoly_Loader.js"></script>
- <style type="text/css">
- body {
- width:50%;
- margin-left:25%;
- margin-right:25%;
- }
- .test {
- background-color: #D8E2F9;
- hyphens: auto;
- }
- .ref {
- background-color: #FEEFC0;
- }
- </style>
- </head>
- <body>
- <div id="navigate"><a href="index.html">↞ Index</a> | <a href="test36.html">← Prev</a> | <a href="test38.html">Next →</a></div>
- <h1>Test 037</h1>
- <p id="desc">Reject hyphenator-promise if engine can't be loaded.</p>
- <div id="result"></div>
- <hr>
- <h2>fur</h2>
- <p id="test1" lang="fur" class="test hyphenate"></p>
- <p id="ref1" lang="fur" class="ref">Il fur|lan e je une len|ghe ro|man|ze de fa|mee des len|ghis re|ti|chis, che e je fe|ve|la|de so|re|dut in|tal Friûl, ma an|cje vie pal mont. Cual|chi vol|te al ven clamât La|din orientâl, parcè che al à di|viers ponts in co|mun cul la|din, ma si è svi|lupât in un al|tri mût cul pa|ssâ dal timp, sot de in|fluen|ce des len|ghis ator dal Friûl</p>
- <hr>
- <div><span class="test">Test</span> <span class="ref">Ref</span></div>
- </body>
- </html>
|