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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/grouping-content/the-li-element/grouping-li.html

Issue 2212873003: W3C auto test importer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <title>li element</title> 5 <title>li element</title>
6 <link rel="author" title="dzenana" href="mailto:dzenana.trenutak@gmail.com"> 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"> 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-li-elemen t">
8 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testharnessreport.js"></script>
10 </head> 10 </head>
(...skipping 19 matching lines...) Expand all
30 <li value="10"> 30 <li value="10">
31 <menu label="Help"> 31 <menu label="Help">
32 <li value = "2"><a href="help.html">Help Me</a></li> 32 <li value = "2"><a href="help.html">Help Me</a></li>
33 <li><a href="about.html">About</a></li> 33 <li><a href="about.html">About</a></li>
34 </menu> 34 </menu>
35 </li> 35 </li>
36 </menu> 36 </menu>
37 37
38 <p>Unordered List</p> 38 <p>Unordered List</p>
39 <ul id="unordered"> 39 <ul id="unordered">
40 <li id="test_li">list item</li> 40 <li>list item</li>
41 <li>list item</li> 41 <li>list item</li>
42 <li>list item</li> 42 <li>list item</li>
43 </ul> 43 </ul>
44 </span> 44 </span>
45 45
46 <p>Ordered List</p> 46 <p>Ordered List</p>
47 <ol id="basic"> 47 <ol id="basic">
48 <li>list item</li> 48 <li>list item</li>
49 <li>list item</li> 49 <li>list item</li>
50 <li>list item</li> 50 <li>list item</li>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 <p>Ordered List</p> 109 <p>Ordered List</p>
110 <ol id="letter"> 110 <ol id="letter">
111 <li value="A">list item</li> 111 <li value="A">list item</li>
112 <li>list item</li> 112 <li>list item</li>
113 <li>list item</li> 113 <li>list item</li>
114 </ol> 114 </ol>
115 115
116 <script> 116 <script>
117 "use strict"; 117 "use strict";
118 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, 119 // "The [value] attribute has no default value" so, per https://html.spe c.whatwg.org/multipage/#reflect,
132 // the default when unspecified is 0 120 // the default when unspecified is 0
133 testList = document.querySelectorAll("#unordered li, #basic li");
134 test(function() { 121 test(function() {
135 for(i = 0; i < testList.length; i++) { 122 var testList = document.querySelectorAll("#unordered li, #basic li") ;
123 for (var i = 0; i < testList.length; i++) {
136 assert_equals(testList[i].value, 0, "Default (unspecified) value of value is 0."); 124 assert_equals(testList[i].value, 0, "Default (unspecified) value of value is 0.");
137 } 125 }
138 }, "Default (unspecified) value of value is 0."); 126 }, "Default (unspecified) value of value is 0.");
139 127
140 // "If the value attribute is present, user agents must parse it as an i nteger, in order to determine the attribute's value. 128 // "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." 129 // 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, 130 // 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 131 // 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) 132 // 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." 133 // and: "The value IDL attribute must reflect the value of the value co ntent attribute."
146 134
147 // start2's first element has value of 2 135 // start2's first element has value of 2
148 test(function() { 136 test(function() {
149 testLI = document.getElementById("start2").children[0]; 137 var testLI = document.getElementById("start2").children[0];
150 assert_equals(testLI.value, 2, "value of 2 -> value of 2"); 138 assert_equals(testLI.value, 2, "value of 2 -> value of 2");
151 }, ".value property reflects content attribute - and both parse value of '2' correctly."); 139 }, ".value property reflects content attribute - and both parse value of '2' correctly.");
152 140
153 // negative's first element has value of -10 141 // negative's first element has value of -10
154 test(function() { 142 test(function() {
155 testLI = document.getElementById("negative").children[0]; 143 var testLI = document.getElementById("negative").children[0];
156 assert_equals(testLI.value, -10, "value of -10 -> value of -10"); 144 assert_equals(testLI.value, -10, "value of -10 -> value of -10");
157 }, "IDL and content attribute parse value of '-10' correctly."); 145 }, "IDL and content attribute parse value of '-10' correctly.");
158 146
159 // posFloatDown's first element has value of 4.03 which should return 4 147 // posFloatDown's first element has value of 4.03 which should return 4
160 test(function() { 148 test(function() {
161 testLI = document.getElementById("posFloatDown").children[0]; 149 var testLI = document.getElementById("posFloatDown").children[0];
162 assert_equals(testLI.value, 4, "value of 4.03 -> 4"); 150 assert_equals(testLI.value, 4, "value of 4.03 -> 4");
163 }, "IDL and content attribute parse value of '4.03' correctly."); 151 }, "IDL and content attribute parse value of '4.03' correctly.");
164 152
165 // negFloatDown's first element has value of -4.03 which should return - 4 153 // negFloatDown's first element has value of -4.03 which should return - 4
166 test(function() { 154 test(function() {
167 testLI = document.getElementById("negFloatDown").children[0]; 155 var testLI = document.getElementById("negFloatDown").children[0];
168 assert_equals(testLI.value, -4, "value of -4.03 -> -4"); 156 assert_equals(testLI.value, -4, "value of -4.03 -> -4");
169 }, "IDL and content attribute parse value of '-4.03' correctly."); 157 }, "IDL and content attribute parse value of '-4.03' correctly.");
170 158
171 // posFloatUp's first element has value of 4.9 which should return 4 159 // posFloatUp's first element has value of 4.9 which should return 4
172 test(function() { 160 test(function() {
173 testLI = document.getElementById("posFloatUp").children[0]; 161 var testLI = document.getElementById("posFloatUp").children[0];
174 assert_equals(testLI.value, 4, "value of 4.9 -> 4"); 162 assert_equals(testLI.value, 4, "value of 4.9 -> 4");
175 }, "IDL and content attribute parse value of '4.9' correctly."); 163 }, "IDL and content attribute parse value of '4.9' correctly.");
176 164
177 // negFloatUp's first element has value of -4.9 which should return -4 165 // negFloatUp's first element has value of -4.9 which should return -4
178 test(function() { 166 test(function() {
179 testLI = document.getElementById("negFloatUp").children[0]; 167 var testLI = document.getElementById("negFloatUp").children[0];
180 assert_equals(testLI.value, -4, "value of -4.9 -> -4"); 168 assert_equals(testLI.value, -4, "value of -4.9 -> -4");
181 }, "IDL and content attribute parse value of '-4.9' correctly."); 169 }, "IDL and content attribute parse value of '-4.9' correctly.");
182 170
183 // exponent's first element has value of 7e2 which should return 7 171 // exponent's first element has value of 7e2 which should return 7
184 test(function() { 172 test(function() {
185 testLI = document.getElementById("exponent").children[0]; 173 var testLI = document.getElementById("exponent").children[0];
186 assert_equals(testLI.value, 7, "value of 7e2 -> 7"); 174 assert_equals(testLI.value, 7, "value of 7e2 -> 7");
187 }, "IDL and content attribute parse value of '7e2' correctly."); 175 }, "IDL and content attribute parse value of '7e2' correctly.");
188 176
189 // decimal's first element has value of .5 which should return 0 177 // decimal's first element has value of .5 which should return 0
190 test(function() { 178 test(function() {
191 testLI = document.getElementById("decimal").children[0]; 179 var testLI = document.getElementById("decimal").children[0];
192 assert_equals(testLI.value, 0, "value of .5 -> 0 (default)"); 180 assert_equals(testLI.value, 0, "value of .5 -> 0 (default)");
193 }, "IDL and content attribute parse value of '.5' correctly."); 181 }, "IDL and content attribute parse value of '.5' correctly.");
194 182
195 // letter's first element has value of A which should return 0 183 // letter's first element has value of A which should return 0
196 test(function() { 184 test(function() {
197 testLI = document.getElementById("letter").children[0]; 185 var testLI = document.getElementById("letter").children[0];
198 assert_equals(testLI.value, 0, "value of A -> 0 (default)"); 186 assert_equals(testLI.value, 0, "value of A -> 0 (default)");
199 }, "IDL and content attribute parse value of 'A' correctly."); 187 }, "IDL and content attribute parse value of 'A' correctly.");
200 188
201 // SHOULD I TEST MORE NON-ASCII-DIGIT ENTRIES? 189 // SHOULD I TEST MORE NON-ASCII-DIGIT ENTRIES?
202 190
203 </script> 191 </script>
204 </body> 192 </body>
205 </html> 193 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698