summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-select-element/select-value.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-select-element/select-value.html')
-rw-r--r--testing/web-platform/tests/html/semantics/forms/the-select-element/select-value.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-value.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/select-value.html
new file mode 100644
index 0000000000..d8d5263e3e
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/select-value.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>HTMLSelectElement.value</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>
+<div id=log></div>
+
+<select id=sel1>
+ <option value=0></option>
+ <option selected value=1></option>
+</select>
+
+<select id=sel2>
+ <optgroup>
+ <option value=0></option>
+ </optgroup>
+ <optgroup></optgroup>
+ <optgroup>
+ <option></option>
+ <option value=1></option>
+ <option selected value=2></option>
+ </optgroup>
+</select>
+
+<select id=sel3>
+ <option selected value=1></option>
+</select>
+
+<select id=sel4></select>
+
+<script>
+test(function() {
+ var select = document.getElementById('sel1');
+ assert_equals(select.value, '1');
+}, 'options');
+
+test(function() {
+ var select = document.getElementById('sel2');
+ assert_equals(select.value, '2');
+}, 'optgroups');
+
+test(function() {
+ var select = document.getElementById('sel3');
+ var option = select.options[0];
+ var div = document.createElement('div');
+ select.appendChild(div);
+ div.appendChild(option);
+ assert_equals(select.value, '');
+}, 'option is child of div');
+
+test(function() {
+ var select = document.getElementById('sel4');
+ assert_equals(select.value, '');
+}, 'no options');
+</script>