summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-reflection.html
blob: c92fd0f0cf233508a6cafafd02b4f8121463bdd3 (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>form.action</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-fs-action">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<form id="form1" action="a.html"></form>
<form id="form2" action=""></form>
<form id="form3"></form>

<script>
"use strict";

test(() => {

  assert_equals(document.querySelector("#form1").action, (new URL("a.html", document.baseURI)).href,
    "action should equal the correct absolute URL");

}, "An action URL should be resolved relative to the document's base URL (= the document's URL in this case)");

test(() => {

  assert_equals(document.querySelector("#form2").action, document.URL);

}, "An empty-string action content attribute should cause the IDL attribute to return the document's URL (= the document's base URL in this case)");

test(() => {

  assert_equals(document.querySelector("#form3").action, document.URL);

}, "A missing action content attribute should cause the IDL attribute to return the document's URL (= the document's base URL in this case)");

</script>