summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/formmethod-attribute-test.html
blob: 66823eeedf526f315261b078ce2e1299f17190c5 (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
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>

<p>Test formmethod attribute</p>

<form id=f1 method="post">
<input type="submit" value="Submit" id="ip1">
<input type="submit" formmethod="" value="Submit" id="ip2">
<input type="submit" formmethod="post" value="Submit" id="ip3">
<input type="submit" formmethod="get" value="Submit" id="ip4">
<input type="submit" formmethod="foo" value="Submit" id="ip5">
</form>
<div id=console></div>
<script>
var form1 = document.getElementById('f1');

debug('Missing value');
var ip1 = document.getElementById('ip1');
shouldBeEqualToString("ip1.formMethod","");
shouldBeNull("ip1.getAttribute('formmethod')");
debug('');

debug('Empty value');
var ip2 = document.getElementById('ip2');
shouldBeEqualToString("ip2.formMethod", "get");
shouldBeEqualToString("ip2.getAttribute('formmethod')", "");
debug('');

debug('Post value');
var ip3 = document.getElementById('ip3');
shouldBeEqualToString("ip3.formMethod", "post");
shouldBeEqualToString("ip3.getAttribute('formmethod')", "post");
debug('');

debug('Get value');
var ip4 = document.getElementById('ip4');
shouldBeEqualToString("ip4.formMethod", "get");
shouldBeEqualToString("ip4.getAttribute('formmethod')", "get");
debug('');

debug('Invalid value');
var ip5 = document.getElementById('ip5');
shouldBeEqualToString("ip5.formMethod", "get");
shouldBeEqualToString("ip5.getAttribute('formmethod')", "foo");
debug('');
</script>
</body>
</html>