tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

grouping-li.html (6851B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <meta charset="utf-8">
      5    <title>li element</title>
      6    <link rel="author" title="dzenana" href="mailto:dzenana.trenutak@gmail.com">
      7    <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-li-element">
      8    <script src="/resources/testharness.js"></script>
      9    <script src="/resources/testharnessreport.js"></script>
     10 </head>
     11 <body>
     12    <h1>Description</h1>
     13    <p>This test validates the li element.</p>
     14 
     15    <div id="log"></div>
     16 
     17    <span>
     18    <menu id="listmenu">
     19        <li>Command</li>
     20        <li value="3">Command</li>
     21    </menu>
     22 
     23    <menu type="toolbar" id="toolbarmenu">
     24        <li>
     25            <menu label="File">
     26                <button type="button">New...</button>
     27                <button type="button">Open...</button>
     28            </menu>
     29        </li>
     30        <li value="10">
     31            <menu label="Help">
     32                <li value = "2"><a href="help.html">Help Me</a></li>
     33                <li><a href="about.html">About</a></li>
     34            </menu>
     35        </li>
     36    </menu>
     37 
     38    <p>Unordered List</p>
     39    <ul id="unordered">
     40        <li>list item</li>
     41        <li>list item</li>
     42        <li>list item</li>
     43    </ul>
     44    </span>
     45 
     46    <p>Ordered List</p>
     47    <ol id="basic">
     48        <li>list item</li>
     49        <li>list item</li>
     50        <li>list item</li>
     51    </ol>
     52 
     53    <p>Ordered List</p>
     54    <ol id="start2">
     55        <li value="2">list item</li>
     56        <li>list item</li>
     57        <li>list item</li>
     58    </ol>
     59 
     60    <p>Ordered List</p>
     61    <ol id="negative">
     62        <li value="-10">list item</li>
     63        <li>list item</li>
     64        <li>list item</li>
     65    </ol>
     66 
     67    <p>Ordered List</p>
     68    <ol id="posFloatDown">
     69        <li value="4.03">list item</li>
     70        <li>list item</li>
     71        <li>list item</li>
     72    </ol>
     73 
     74    <p>Ordered List</p>
     75    <ol id="negFloatDown">
     76        <li value="-4.03">list item</li>
     77        <li>list item</li>
     78        <li>list item</li>
     79    </ol>
     80 
     81    <p>Ordered List</p>
     82    <ol id="posFloatUp">
     83        <li value="4.9">list item</li>
     84        <li>list item</li>
     85        <li>list item</li>
     86    </ol>
     87 
     88    <p>Ordered List</p>
     89    <ol id="negFloatUp">
     90        <li value="-4.9">list item</li>
     91        <li>list item</li>
     92        <li>list item</li>
     93    </ol>
     94 
     95    <p>Ordered List</p>
     96    <ol id="exponent">
     97        <li value="7e2">list item</li>
     98        <li>list item</li>
     99        <li>list item</li>
    100    </ol>
    101 
    102    <p>Ordered List</p>
    103    <ol id="decimal">
    104        <li value=".5">list item</li>
    105        <li>list item</li>
    106        <li>list item</li>
    107    </ol>
    108 
    109    <p>Ordered List</p>
    110    <ol id="letter">
    111        <li value="A">list item</li>
    112        <li>list item</li>
    113        <li>list item</li>
    114    </ol>
    115 
    116    <script>
    117        "use strict";
    118 
    119        // "The [value] attribute has no default value" so, per https://html.spec.whatwg.org/multipage/#reflect,
    120        // the default when unspecified is 0
    121        test(function() {
    122            var testList = document.querySelectorAll("#unordered li, #basic li");
    123            for (var i = 0; i < testList.length; i++) {
    124                assert_equals(testList[i].value, 0, "Default (unspecified) value of value is 0.");
    125            }
    126        }, "Default (unspecified) value of value is 0.");
    127 
    128        // "If the value attribute is present, user agents must parse it as an integer, in order to determine the attribute's value.
    129        //  If the attribute's value cannot be converted to a number, the attribute must be treated as if it was absent."
    130        // Per https://html.spec.whatwg.org/multipage/#collect-a-sequence-of-characters,
    131        //    an integer is parsed by collecting as many digits as possible and then aborting at the first
    132        //    non-digit character after the first digit (otherwise, with no beginning digit, it's just an error)
    133        // and:  "The value IDL attribute must reflect the value of the value content attribute."
    134 
    135        // start2's first element has value of 2
    136        test(function() {
    137            var testLI = document.getElementById("start2").children[0];
    138            assert_equals(testLI.value, 2, "value of 2 -> value of 2");
    139        }, ".value property reflects content attribute - and both parse value of '2' correctly.");
    140 
    141        // negative's first element has value of -10
    142        test(function() {
    143            var testLI = document.getElementById("negative").children[0];
    144            assert_equals(testLI.value, -10, "value of -10 -> value of -10");
    145        }, "IDL and content attribute parse value of '-10' correctly.");
    146 
    147        // posFloatDown's first element has value of 4.03 which should return 4
    148        test(function() {
    149            var testLI = document.getElementById("posFloatDown").children[0];
    150            assert_equals(testLI.value, 4, "value of 4.03 -> 4");
    151        }, "IDL and content attribute parse value of '4.03' correctly.");
    152 
    153        // negFloatDown's first element has value of -4.03 which should return -4
    154        test(function() {
    155            var testLI = document.getElementById("negFloatDown").children[0];
    156            assert_equals(testLI.value, -4, "value of -4.03 -> -4");
    157        }, "IDL and content attribute parse value of '-4.03' correctly.");
    158 
    159        // posFloatUp's first element has value of 4.9 which should return 4
    160        test(function() {
    161            var testLI = document.getElementById("posFloatUp").children[0];
    162            assert_equals(testLI.value, 4, "value of 4.9 -> 4");
    163        }, "IDL and content attribute parse value of '4.9' correctly.");
    164 
    165        // negFloatUp's first element has value of -4.9 which should return -4
    166        test(function() {
    167            var testLI = document.getElementById("negFloatUp").children[0];
    168            assert_equals(testLI.value, -4, "value of -4.9 -> -4");
    169        }, "IDL and content attribute parse value of '-4.9' correctly.");
    170 
    171        // exponent's first element has value of 7e2 which should return 7
    172        test(function() {
    173            var testLI = document.getElementById("exponent").children[0];
    174            assert_equals(testLI.value, 7, "value of 7e2 -> 7");
    175        }, "IDL and content attribute parse value of '7e2' correctly.");
    176 
    177        // decimal's first element has value of .5 which should return 0
    178        test(function() {
    179            var testLI = document.getElementById("decimal").children[0];
    180            assert_equals(testLI.value, 0, "value of .5 -> 0 (default)");
    181        }, "IDL and content attribute parse value of '.5' correctly.");
    182 
    183        // letter's first element has value of A which should return 0
    184        test(function() {
    185            var testLI = document.getElementById("letter").children[0];
    186            assert_equals(testLI.value, 0, "value of A -> 0 (default)");
    187        }, "IDL and content attribute parse value of 'A' correctly.");
    188 
    189        // SHOULD I TEST MORE NON-ASCII-DIGIT ENTRIES?
    190 
    191    </script>
    192 </body>
    193 </html>