formMethod to have empty string as default value and 'get' as invalid.
[WebKit-https.git] / LayoutTests / fast / forms / formmethod-attribute-test.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../js/resources/js-test-pre.js"></script>
5
6 <p>Test formmethod attribute</p>
7
8 <form id=f1 method="post">
9 <input type="submit" value="Submit" id="ip1">
10 <input type="submit" formmethod="" value="Submit" id="ip2">
11 <input type="submit" formmethod="post" value="Submit" id="ip3">
12 <input type="submit" formmethod="get" value="Submit" id="ip4">
13 <input type="submit" formmethod="foo" value="Submit" id="ip5">
14 </form>
15 <div id=console></div>
16 <script>
17 var form1 = document.getElementById('f1');
18
19 debug('Missing value');
20 var ip1 = document.getElementById('ip1');
21 shouldBeEqualToString("ip1.formMethod","");
22 shouldBeNull("ip1.getAttribute('formmethod')");
23 debug('');
24
25 debug('Empty value');
26 var ip2 = document.getElementById('ip2');
27 shouldBeEqualToString("ip2.formMethod", "get");
28 shouldBeEqualToString("ip2.getAttribute('formmethod')", "");
29 debug('');
30
31 debug('Post value');
32 var ip3 = document.getElementById('ip3');
33 shouldBeEqualToString("ip3.formMethod", "post");
34 shouldBeEqualToString("ip3.getAttribute('formmethod')", "post");
35 debug('');
36
37 debug('Get value');
38 var ip4 = document.getElementById('ip4');
39 shouldBeEqualToString("ip4.formMethod", "get");
40 shouldBeEqualToString("ip4.getAttribute('formmethod')", "get");
41 debug('');
42
43 debug('Invalid value');
44 var ip5 = document.getElementById('ip5');
45 shouldBeEqualToString("ip5.formMethod", "get");
46 shouldBeEqualToString("ip5.getAttribute('formmethod')", "foo");
47 debug('');
48 </script>
49 <script src="../js/resources/js-test-post.js"></script>
50 </body>
51 </html>
52