File: select-inside-top-layer.tentative.html

package info (click to toggle)
firefox-esr 140.4.0esr-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,539,276 kB
  • sloc: cpp: 7,381,286; javascript: 6,388,710; ansic: 3,710,139; python: 1,393,780; xml: 628,165; asm: 426,918; java: 184,004; sh: 65,742; makefile: 19,302; objc: 13,059; perl: 12,912; yacc: 4,583; cs: 3,846; pascal: 3,352; lex: 1,720; ruby: 1,226; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (92 lines) | stat: -rw-r--r-- 3,447 bytes parent folder | download | duplicates (8)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!doctype html>
<meta charset=utf-8>
<title>appearance:base select nested inside top layer elements</title>
<link rel=author href="mailto:masonf@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="../../../popovers/resources/popover-utils.js"></script>

<div id=popover1 popover>popover1
  <select id=select1>
    <option>option</option>
    <option>option
      <div popover id=popover2>popover2</div>
    </option>
  </select>
</div>

<dialog id=dialog1>dialog1
  <select id=select2>
    <option>option</option>
    <option>option
      <dialog id=dialog2>dialog2</dialog>
    </option>
  </select>
</dialog>

<style>
  select, ::picker(select) {
    appearance: base-select;
  }
</style>

<script>
promise_test(async (t) => {
  const popover = document.querySelector('#popover1');
  const select = document.querySelector('#select1');
  assert_true(!!popover && !!select,'precondition');
  t.add_cleanup(() => popover.hidePopover());

  popover.showPopover();
  assert_true(popover.matches(':popover-open'));
  await clickOn(select);
  assert_true(select.matches(':open'),'the select should be showing');
  assert_true(popover.matches(':popover-open'),'and the popover should also still be showing');
},'select can be nested inside a popover');

promise_test(async (t) => {
  const popover1 = document.querySelector('#popover1');
  const popover2 = document.querySelector('#popover2');
  const select = document.querySelector('#select1');
  assert_true(!!popover1 && !!popover2 && !!select,'precondition');
  t.add_cleanup(() => popover1.hidePopover());

  popover1.showPopover();
  await clickOn(select);
  popover2.showPopover();
  assert_true(select.matches(':open'),'the select should be showing');
  assert_true(popover1.matches(':popover-open'),'and the outer popover should also still be showing');
  assert_true(popover2.matches(':popover-open'),'and the inner popover should also still be showing');
},'a popover can be nested inside select');

promise_test(async (t) => {
  const dialog = document.querySelector('#dialog1');
  const select = document.querySelector('#select2');
  assert_true(!!dialog && !!select,'precondition');
  t.add_cleanup(() => dialog.close());

  dialog.showModal();
  assert_true(dialog.matches('[open]:modal'));
  await clickOn(select);
  assert_true(select.matches(':open'),'the select should be showing');
  assert_true(dialog.matches('[open]:modal'),'and the dialog should also still be showing');
},'select can be nested inside a modal dialog');

promise_test(async (t) => {
  const dialog1 = document.querySelector('#dialog1');
  const dialog2 = document.querySelector('#dialog2');
  const select = document.querySelector('#select2');
  assert_true(!!dialog1 && dialog2 && !!select,'precondition');
  t.add_cleanup(() => {dialog1.close();dialog2.close()});

  dialog1.showModal();
  await clickOn(select);
  dialog2.showModal();
  assert_true(select.matches(':open'),'the select should be showing');
  assert_true(dialog1.matches('[open]:modal'),'and the outer dialog should also still be showing');
  assert_true(dialog2.matches('[open]:modal'),'and the inner dialog should also still be showing');
},'a modal dialog can be nested inside select');
</script>