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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.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 id='title'>HTMLOptionsCollection</title>
6 <script src="../../../../../../resources/testharness.js"></script>
7 <script src="../../../../../../resources/testharnessreport.js"></script>
8 <div id="log"></div>
9 <select id="selly">
10 <option id="id1" name="name1">1</option>
11 <option id="id2" name="name2">2</option>
12 <option id="id3" name="name3">3</option>
13 <option id="id4" name="name4">4</option>
14 <option name="nameonly">nameonly</option>
15 <option id="id3">duplicate ID</option>
16 <option name="name4">duplicate name</option>
17 <option id="mixed1">mixed ID</option>
18 <option name="mixed1">mixed name</option>
19 </select>
20
21 <script>
22 var selly;
23 setup(function() {
24 selly = document.getElementById('selly');
25 });
26
27 test(function () {
28 assert_equals(selly.namedItem('nameonly')["value"], "nameonly");
29 }, "if only one item has a *name* or id value matching the parameter, return tha t object and stop");
30
31 test(function () {
32 assert_equals(selly.namedItem('id2')["value"], "2");
33 }, "if only one item has a name or *id* value matching the parameter, return tha t object and stop");
34
35 test(function () {
36 assert_equals(selly.namedItem('thisdoesnotexist'), null);
37 }, "if no item has a name or id value matching the parameter, return null and st op");
38
39 test(function () {
40 var testarr = [];
41 for (var i = 0; i < selly.namedItem('id3').length; i++) {
42 testarr.push(selly.namedItem('id3')[i].text);
43 }
44 assert_array_equals(testarr, ['3','duplicate ID']);
45 }, "return an HTMLOptionsCollection in correct order for repeated 'id' value");
46
47 test(function () {
48 var testarr = [];
49 for (var i = 0; i < selly.namedItem('name4').length; i++) {
50 testarr.push(selly.namedItem('name4')[i].text);
51 }
52 assert_array_equals(testarr, ['4', 'duplicate name']);
53 }, "return an HTMLOptionsCollection in correct order for repeated 'name' value") ;
54
55 test(function () {
56 var testarr = [];
57 for (var i = 0; i < selly.namedItem('mixed1').length; i++) {
58 testarr.push(selly.namedItem('mixed1')[i].text);
59 }
60 assert_array_equals(testarr, ['mixed ID', 'mixed name']);
61 }, "return an HTMLOptionsCollection in correct order for repeated mixed value");
62 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698