<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Test 014</title>
        <script>
            var Hyphenopoly = {
                require: {
                    "de": "FORCEHYPHENOPOLY",
                    "en-us": "FORCEHYPHENOPOLY"
                },
                setup: {
                    selectors: {
                        ".class1": {
                            hyphen: "•",
                            leftmin: 0,
                            rightmin: 0
                        },
                        ".class2": {
                            hyphen: "•",
                            leftmin: 4,
                            rightmin: 4
                        },
                        ".class3": {
                            hyphen: "•",
                            leftmin: 0,
                            leftminPerLang: {
                                "de": 4,
                                "en-us": 4
                            }
                        }
                    }
                },
                handleEvent: {
                    hyphenopolyEnd: function (e) {
                        assert();
                    }
                }
            };

            function assert() {
                var tests = 3;
                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 += "<span style=\"background-color: #d6ffd6\">" + (function (i) {
                            return (i < 10) ? "0" + i : i; 
                        }(i)) + "</span> ";
                        result = result || true;
                    } else {
                        document.getElementById("result").innerHTML += "<span style=\"background-color: #ffd6d6\">" + (function (i) {
                            return (i < 10) ? "0" + i : i; 
                        }(i)) + "</span> ";
                        result = result || false;
                    }
                    i += 1;
                }
                if (parent != window) {
                    parent.postMessage(JSON.stringify({
                        desc: document.getElementById("desc").innerHTML,
                        index: 14,
                        result: (result ? "passed" : "failed")
                    }), window.location.href);
                }
            }
        </script>
        <script src="../Hyphenopoly_Loader.js"></script>
        <style type="text/css">
            body {
                width:50%;
                margin-left:25%;
                margin-right:25%;
            }

            .test {
                background-color: #D8E2F9;
            }
            .ref {
                background-color: #FEEFC0;
            }

            .hyphenate {
                hyphens: auto;
                -ms-hyphens: auto;
                -moz-hyphens: auto;
                -webkit-hyphens: auto;
            }
        </style>
    </head>
    <body>
        <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test13.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test15.html">Next&nbsp;&rarr;</a></div>

        <h1>Test 014</h1>
        <p id="desc">Test left-/rightmin and left-/rightminPerLang</p>
        <div id="result"></div>
        <hr>
        <p id="test1" class="test class1" lang="de">Silbentrennungsalgorithmus</p>
        <p id="ref1" class="ref" lang="de">Sil•ben•tren•nungs•al•go•rith•mus</p>
        <p id="test2" class="test class2" lang="de">Silbentrennungsalgorithmus</p>
        <p id="ref2" class="ref" lang="de">Silben•tren•nungs•al•go•rithmus</p>
        <p id="test3" class="test class3" lang="de">Silbentrennungsalgorithmus <span lang="en-us">hyphenation</span></p>
        <p id="ref3" class="ref" lang="de">Silben•tren•nungs•al•go•rith•mus <span lang="en-us">hyphen•ation</span></p>
        <hr>
        <div><span class="test">Test</span> <span class="ref">Ref</span></div>

    </body>
</html>