summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/document-activeelement.https.html
blob: 3ac1fd866fc58c7bc957054976cf70baa92eacf6 (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
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<title>Test document.activeElement</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="resources/utils.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<body>
<script>
promise_test(async(t) => {
  const actions = new test_driver.Actions();
  const fencedframe = await attachFencedFrameContext();

  assert_equals(document.activeElement, document.body);

  await actions.pointerMove(0, 0, {origin: fencedframe.element})
               .pointerDown()
               .pointerUp()
               .send();

  assert_equals(document.activeElement, fencedframe.element);
}, 'document.activeElement should be the fenced frame when it has focus');

promise_test(async(t) => {
  const actions = new test_driver.Actions();
  const fencedframe = await attachFencedFrameContext();

  await fencedframe.execute(() => {
    assert_equals(document.activeElement, document.body);
  })

}, "a fenced frame's document.activeElement should be its body when it " +
   "doesn't have focus");

</script>
</body>