summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/formaction-attribute.html
blob: 3807dada12791671dfbc55ad71d3668c5a89e3d5 (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
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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<form action="javascript: failTest(this)" method="get">
<input id="button1" type="submit" formaction="javascript: passTest1(this)" />
<button id="button2" type="submit" formaction="javascript: passTest2(this)" />
<button type="submit" formaction="javascript: passTest3(this)">
  <span id="span" formaction="javascript: failTest2(this)">submit</span>
</button>
</form>
<script>
description("Test for formaction attributes in input and button tags.");
var doneAction = false;

function failTest(ul)
{
    doneAction = true;
    testFailed('The formaction attribute in the input or button tag was ignored.');
}
function failTest2(ul)
{
    doneAction = true;
    testFailed('The formaction attribute in the span tag was used.');
}
function passTest1(ul)
{
    doneAction = true;
    testPassed('The formaction attribute in the input tag was used.');
}
function passTest2(ul)
{
    doneAction = true;
    testPassed('The formaction attribute in the button tag was used.');
}
function passTest3(ul)
{
    doneAction = true;
    testPassed('The formaction attribute in the button tag was used.');
}

doneAction = false;
var input = document.getElementById('button1');
input.click();
if (!doneAction)
    testFailed('Both of the action and the formaction attributes were ignored.');
doneAction = false;
clickElement(input);
if (!doneAction)
    testFailed('Both of the action and the formaction attributes were ignored.');

doneAction = false;
var button = document.getElementById('button2');
button.click();
if (!doneAction)
    testFailed('Both of the action and the formaction attributes were ignored.');

doneAction = false;
var span = document.getElementById('span');
span.click();
if (!doneAction)
    testFailed('Both of the action and the formaction attributes were ignored.');
</script>
</body>
</html>