Skip to content

Commit

Permalink
Test selectedOptions + selected interaction
Browse files Browse the repository at this point in the history
This catches a regression bug that was introduced in 3a569a6.
  • Loading branch information
eps1lon authored and domenic committed Jan 7, 2023
1 parent 3737347 commit bda8241
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset="utf-8">
<title>HTMLSelectElement's selectedOptions and HTMLOptionElement's selected</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-select-value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<select id="sel">
<option id="opt1" value="x" data-foo="a" selected="selected">1st opt</option>
<option id="opt2" value="y" data-foo="b">2nd opt</option>
</select>

<script>
"use strict";
test(() => {
const select = document.getElementById("sel");
const opt1 = document.getElementById("opt1");

assert_equals(select.selectedOptions.length, 1);
assert_equals(select.selectedOptions[0], opt1);
});
</script>

0 comments on commit bda8241

Please sign in to comment.