correction, ajout gitignore
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test 036</title>
|
||||
<script>
|
||||
var mode = window.location.search.substring(1);
|
||||
var path = "../patterns/";
|
||||
if (mode === "fail") {
|
||||
path = "../pattern/"
|
||||
}
|
||||
var Hyphenopoly = {
|
||||
require: {
|
||||
"fur": "probabilmentri"
|
||||
},
|
||||
paths: {
|
||||
patterndir: 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: 36,
|
||||
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 fur.hpb can't be loaded from ../pattern/") !== -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: 36,
|
||||
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: 36,
|
||||
result: (result ? "passed" : "failed")
|
||||
}), window.location.href);
|
||||
}
|
||||
window.location = "test36.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="test35.html">← Prev</a> | <a href="test37.html">Next →</a></div>
|
||||
|
||||
<h1>Test 036</h1>
|
||||
<p id="desc">Reject hyphenator-promise if pattern 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>
|
||||
Reference in New Issue
Block a user