-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test selectedOptions + selected interaction
This catches a regression bug that was introduced in 3a569a6.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...upstream/html/semantics/forms/the-select-element/select-selectedOptions-and-selected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |