<html>
    <head>
        <script src="resources/dump-list.js"></script>
        <script>
            function test()
            {
                if (window.testRunner)
                    testRunner.dumpAsText();

                var list1 = document.getElementById("list1");
                list1.offsetTop; // Force a relayout.
                list1.firstElementChild.value = 10;
                document.getElementById("console1").innerHTML = dumpList(list1);

                var list2 = document.getElementById("list2");
                list2.querySelector("li[value=\"20\"]").removeAttribute("value");
                document.getElementById("console2").innerHTML = dumpList(list2);

                var list3 = document.getElementById("list3");
                list3.start = 20;
                document.getElementById("console3").innerHTML = dumpList(list3);

                var list4 = document.getElementById("list4");
                list4.removeAttribute("start");
                document.getElementById("console4").innerHTML = dumpList(list4);

                var list5 = document.getElementById("list5");
                list5.setAttribute("start","");
                document.getElementById("console5").innerHTML = dumpList(list5);

                // Don't show the actual lists as they are useless in the text-only mode.
                list1.parentNode.removeChild(list1);
                list2.parentNode.removeChild(list2);
                list3.parentNode.removeChild(list3);
                list4.parentNode.removeChild(list4);
                list5.parentNode.removeChild(list5);
            }
        </script>
    </head>
    <body onload="test()">
        <p>This tests that changing the value of an item updates markers accordingly.</p>
        <ol id="list1" reversed>
            <li>Ten</li>
            <li>Nine</li>
            <li>Eight</li>
            <li>Seven</li>
            <li>Six</li>
        </ol>
        <p id="console1"></p>

        <p>This tests that resetting the value of an item updates markers accordingly.</p>
        <ol id="list2" reversed>
            <li>Five</li>
            <li>Four</li>
            <li value="20">Three</li>
            <li>Two</li>
            <li>One</li>
        </ol>
        <p id="console2"></p>

        <p>This tests that changing the start value of the list updates markers accordingly.</p>
        <ol id="list3" reversed start="5">
            <li>Twenty</li>
            <li>Nineteen</li>
            <li>Eighteen</li>
            <li>Seventeen</li>
            <li>Sixteen</li>
        </ol>
        <p id="console3"></p>

        <p>This tests that removing the custom start value of the list updates markers accordingly.</p>
        <ol id="list4" reversed start="20">
            <li>Five</li>
            <li>Four</li>
            <li>Three</li>
            <li>Two</li>
            <li>One</li>
        </ol>
        <p id="console4"></p>

        <p>This tests that changing the custom start value from 1 to "" works.</p>
        <ol id="list5" reversed start="1">
            <li>Five</li>
            <li>Four</li>
            <li>Three</li>
            <li>Two</li>
            <li>One</li>
        </ol>
        <p id="console5"></p>
    </body>
</html>
