summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-double-submit-multiple-targets.html
blob: 2b5a589b534524fe729c20e5ec2f4092c95a4e0a (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
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">

<!-- The expected behavior of this test is not explicitly specified. -->

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<form id=myform name=myform action="/formaction.html"></form>
<iframe id=frame1 name=target1></iframe>
<iframe id=frame2 name=target2></iframe>
<iframe id=frame3 name=target3></iframe>

<script>

promise_test(async () => {
  const frame1LoadPromise = new Promise(resolve => frame1.onload = resolve);
  const frame2LoadPromise = new Promise(resolve => frame2.onload = resolve);
  const frame3LoadPromise = new Promise(resolve => frame3.onload = resolve);

  myform.target = 'target1';
  myform.submit();
  myform.target = 'target2';
  myform.submit();
  myform.target = 'target3';
  myform.submit();

  await Promise.all([frame1LoadPromise, frame2LoadPromise, frame3LoadPromise]);

  assert_equals(frame1.contentDocument.location.pathname, '/formaction.html');
  assert_equals(frame2.contentDocument.location.pathname, '/formaction.html');
  assert_equals(frame3.contentDocument.location.pathname, '/formaction.html');

}, 'Verifies that one form used to target multiple frames in succession navigates all of them.');

</script>