summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-selectmenu-element/selectmenu-labels.tentative.html
blob: 6f94043299932979c81b71aac75dc1ce4fde15d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html lang="en">
<title>HTMLSelectMenuElement Test: labels</title>
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<label id="label1" for="selectmenu1">Label 1</label>
<selectmenu id="selectmenu1">
  <option>one</option>
  <option>two</option>
  <option>three</option>
  <option>four</option>
</selectmenu>
<label id="label2" for="selectmenu1">Label 2</label>
<label id="label3" for="invalid-selectmenu1">Label 3</label>

<script>

test(() => {
  let selectMenu = document.getElementById("selectmenu1");

  assert_true(selectMenu.labels instanceof NodeList);
  assert_equals(selectMenu.labels.length, 2);
  assert_equals(selectMenu.labels[0], document.getElementById("label1"));
  assert_equals(selectMenu.labels[1], document.getElementById("label2"));
}, "Validate selectmenu.labels");

</script>