summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-labels.tentative.html
blob: 819da49fdd4137760bba7cbb3d1e87ef1c595edc (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>HTMLSelectListElement 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="selectlist1">Label 1</label>
<selectlist id="selectlist1">
  <option>one</option>
  <option>two</option>
  <option>three</option>
  <option>four</option>
</selectlist>
<label id="label2" for="selectlist1">Label 2</label>
<label id="label3" for="invalid-selectlist1">Label 3</label>

<script>

test(() => {
  let selectList = document.getElementById("selectlist1");

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

</script>