chromium/third_party/blink/web_tests/fast/forms/formmethod-attribute-test.html

<!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>