Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/grouping-content/the-li-element/grouping-li.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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-elemen t">
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 id="test_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 var testLI = document.getElementById("test_li"), testList = [], i = 0;
120
121 // check that prototype matches spec's DOM interface
122 test(function() {
123 assert_equals(Object.getPrototypeOf(testLI), HTMLLIElement.prototype , "HTMLLIElement.prototype should be used for li");
124 }, "The prototype for li is HTMLLIElement.prototype");
125
126 // check that "own" property "value" is present
127 test(function() {
128 assert_own_property(testLI,"value", "li should have a 'value' attrib ute");
129 }, "li should have a 'value' attribute");
130
131 // "The [value] attribute has no default value" so, per https://html.spe c.whatwg.org/multipage/#reflect,
132 // the default when unspecified is 0
133 testList = document.querySelectorAll("#unordered li, #basic li");
134 test(function() {
135 for(i = 0; i < testList.length; i++) {
136 assert_equals(testList[i].value, 0, "Default (unspecified) value of value is 0.");
137 }
138 }, "Default (unspecified) value of value is 0.");
139
140 // "If the value attribute is present, user agents must parse it as an i nteger, in order to determine the attribute's value.
141 // If the attribute's value cannot be converted to a number, the attrib ute must be treated as if it was absent."
142 // Per https://html.spec.whatwg.org/multipage/#collect-a-sequence-of-cha racters,
143 // an integer is parsed by collecting as many digits as possible and then aborting at the first
144 // non-digit character after the first digit (otherwise, with no begi nning digit, it's just an error)
145 // and: "The value IDL attribute must reflect the value of the value co ntent attribute."
146
147 // start2's first element has value of 2
148 test(function() {
149 testLI = document.getElementById("start2").children[0];
150 assert_equals(testLI.value, 2, "value of 2 -> value of 2");
151 }, ".value property reflects content attribute - and both parse value of '2' correctly.");
152
153 // negative's first element has value of -10
154 test(function() {
155 testLI = document.getElementById("negative").children[0];
156 assert_equals(testLI.value, -10, "value of -10 -> value of -10");
157 }, "IDL and content attribute parse value of '-10' correctly.");
158
159 // posFloatDown's first element has value of 4.03 which should return 4
160 test(function() {
161 testLI = document.getElementById("posFloatDown").children[0];
162 assert_equals(testLI.value, 4, "value of 4.03 -> 4");
163 }, "IDL and content attribute parse value of '4.03' correctly.");
164
165 // negFloatDown's first element has value of -4.03 which should return - 4
166 test(function() {
167 testLI = document.getElementById("negFloatDown").children[0];
168 assert_equals(testLI.value, -4, "value of -4.03 -> -4");
169 }, "IDL and content attribute parse value of '-4.03' correctly.");
170
171 // posFloatUp's first element has value of 4.9 which should return 4
172 test(function() {
173 testLI = document.getElementById("posFloatUp").children[0];
174 assert_equals(testLI.value, 4, "value of 4.9 -> 4");
175 }, "IDL and content attribute parse value of '4.9' correctly.");
176
177 // negFloatUp's first element has value of -4.9 which should return -4
178 test(function() {
179 testLI = document.getElementById("negFloatUp").children[0];
180 assert_equals(testLI.value, -4, "value of -4.9 -> -4");
181 }, "IDL and content attribute parse value of '-4.9' correctly.");
182
183 // exponent's first element has value of 7e2 which should return 7
184 test(function() {
185 testLI = document.getElementById("exponent").children[0];
186 assert_equals(testLI.value, 7, "value of 7e2 -> 7");
187 }, "IDL and content attribute parse value of '7e2' correctly.");
188
189 // decimal's first element has value of .5 which should return 0
190 test(function() {
191 testLI = document.getElementById("decimal").children[0];
192 assert_equals(testLI.value, 0, "value of .5 -> 0 (default)");
193 }, "IDL and content attribute parse value of '.5' correctly.");
194
195 // letter's first element has value of A which should return 0
196 test(function() {
197 testLI = document.getElementById("letter").children[0];
198 assert_equals(testLI.value, 0, "value of A -> 0 (default)");
199 }, "IDL and content attribute parse value of 'A' correctly.");
200
201 // SHOULD I TEST MORE NON-ASCII-DIGIT ENTRIES?
202
203 </script>
204 </body>
205 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698