Bug 839179 - Part c: Add a test for HTMLButtonElement attributes reflection; r=bz

This commit is contained in:
Ms2ger 2013-02-08 13:50:30 +01:00
parent cc7807ddbe
commit e3c2a6ec01

View File

@ -1,31 +1,66 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=551670
-->
<head>
<title>Test for Bug 551670</title>
<title>Test for HTMLButtonElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="../reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=551670">Mozilla Bug 551670</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 551670 **/
/** Test for HTMLButtonElement attributes reflection **/
// .type
// .autofocus
reflectBoolean({
element: document.createElement("button"),
attribute: "autofocus",
});
// .disabled
reflectBoolean({
element: document.createElement("button"),
attribute: "disabled",
});
// TODO: formAction (URL). But note that we currently reflect it weirdly; see
// content/html/content/test/test_bug607145.html
// .formEnctype
reflectLimitedEnumerated({
element: document.createElement("button"),
attribute: "type",
validValues: [ "submit", "reset", "button" ],
invalidValues: [ "this-is-probably-a-wrong-type", "", "tulip" ],
defaultValue: "submit",
attribute: "formEnctype",
validValues: [
"application/x-www-form-urlencoded",
"multipart/form-data",
"text/plain",
],
invalidValues: [ "text/html", "", "tulip" ],
// TODO (Bug 839171):
// defaultValue: {
// invalid: "application/x-www-form-urlencoded",
// missing: "",
// }
defaultValue: "application/x-www-form-urlencoded",
});
// .formMethod
reflectLimitedEnumerated({
element: document.createElement("button"),
attribute: "formMethod",
validValues: [ "get", "post" ],
invalidValues: [ "put", "", "tulip" ],
unsupportedValues: [ "dialog" ],
// TODO (Bug 839171):
// defaultValue: {
// invalid: "get",
// missing: "",
// }
defaultValue: "get",
});
// .formNoValidate
@ -34,6 +69,34 @@ reflectBoolean({
attribute: "formNoValidate",
});
// .formTarget
reflectString({
element: document.createElement("button"),
attribute: "formTarget",
});
// .name
reflectString({
element: document.createElement("button"),
attribute: "name",
});
// .type
reflectLimitedEnumerated({
element: document.createElement("button"),
attribute: "type",
validValues: [ "submit", "reset", "button" ],
invalidValues: [ "this-is-probably-a-wrong-type", "", "tulip" ],
unsupportedValues: [ "menu" ],
defaultValue: "submit",
});
// .value
reflectString({
element: document.createElement("button"),
attribute: "value",
});
</script>
</pre>
</body>