Skip to content

Commit

Permalink
Test that selectedOptions is a HTMLCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
shvaikalesh authored and domenic committed Jan 30, 2019
1 parent f26f3ca commit 64381e1
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<option selected>Three</option>
</select>

<select id="select-named-selected">
<option>One</option>
<option>Two</option>
<option id="named-option" selected>Three</option>
</select>

<select id="invalid-select">
<option selected>One</option>
<option selected>Two</option>
Expand Down Expand Up @@ -103,6 +109,13 @@
}, ".selectedOptions without the 'multiple' attribute but " +
"more than one selected option should return the last one");

test(() => {
const select = document.getElementById("select-named-selected");

assert_equals(select.selectedOptions.constructor, HTMLCollection);
assert_equals(select.selectedOptions.namedItem("named-option"), select.children[2]);
}, ".selectedOptions should return `HTMLCollection` instance");

test(() => {
const select = document.getElementById("select-same-object");
const selectAgain = document.getElementById("select-same-object");
Expand Down

0 comments on commit 64381e1

Please sign in to comment.