Bug 673553 - Move all button attributes reflection tests to test_button_attributes_reflection.html. r=Ms2ger

This commit is contained in:
Mounir Lamouri 2013-08-14 12:12:01 +01:00
Родитель 7fc44becee
Коммит 7c5bc8f611
4 изменённых файлов: 38 добавлений и 62 удалений

Просмотреть файл

@ -148,7 +148,6 @@ MOCHITEST_FILES = \
test_bug569955.html \
test_bug573969.html \
test_bug561640.html \
test_bug566064.html \
test_bug582412-1.html \
test_bug582412-2.html \
test_bug558788-1.html \

Просмотреть файл

@ -69,12 +69,14 @@ reflectBoolean({
reflectString({
element: document.createElement("button"),
attribute: "formTarget",
otherValues: [ "_blank", "_self", "_parent", "_top" ],
});
// .name
reflectString({
element: document.createElement("button"),
attribute: "name",
otherValues: [ "isindex", "_charset_" ]
});
// .type
@ -93,6 +95,42 @@ reflectString({
attribute: "value",
});
// .willValidate
ok("willValidate" in document.createElement("button"),
"willValidate should be an IDL attribute of the button element");
is(typeof(document.createElement("button").willValidate), "boolean",
"button.willValidate should be a boolean");
// .validity
ok("validity" in document.createElement("button"),
"validity should be an IDL attribute of the button element");
is(typeof(document.createElement("button").validity), "object",
"button.validity should be an object");
ok(document.createElement("button").validity instanceof ValidityState,
"button.validity sohuld be an instance of ValidityState");
// .validationMessage
ok("validationMessage" in document.createElement("button"),
"validationMessage should be an IDL attribute of the button element");
is(typeof(document.createElement("button").validationMessage), "string",
"button.validationMessage should be a string");
// .checkValidity()
ok("checkValidity" in document.createElement("button"),
"checkValidity() should be a method of the button element");
is(typeof(document.createElement("button").checkValidity), "function",
"button.checkValidity should be a function");
// .setCustomValidity()
ok("setCustomValidity" in document.createElement("button"),
"setCustomValidity() should be a method of the button element");
is(typeof(document.createElement("button").setCustomValidity), "function",
"button.setCustomValidity should be a function");
// .labels
todo("labels" in document.createElement("button"),
"button.labels isn't implemented yet");
</script>
</pre>
</body>

Просмотреть файл

@ -13,7 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=546995
<p id="display"></p>
<div id="content" style="display: none">
<select id='s'></select>
<button id='b'></button>
</div>
<pre id="test">
<script type="application/javascript">
@ -34,7 +33,6 @@ function checkAutofocusIDLAttribute(element)
// TODO: keygen should be added when correctly implemented, see bug 101019.
checkAutofocusIDLAttribute(document.getElementById('s'));
checkAutofocusIDLAttribute(document.getElementById('b'));
</script>
</pre>

Просмотреть файл

@ -1,59 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=566064
-->
<head>
<title>Test for Bug 566064</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=566064">Mozilla Bug 566064</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 566064 **/
// This test is only checking the IDL/content attribute of 'formtarget'.
// The behavior is tested in test_bug566046.html.
function isFormTargetEquals(aElement, aValue, aShouldBeNull)
{
if (aShouldBeNull) {
contentAtttributeValue = null;
} else {
contentAtttributeValue = aValue;
}
is(aElement.formTarget, aValue,
"formTarget IDL attribute value should be " + aValue);
is(aElement.getAttribute('formtarget'), contentAtttributeValue,
"formTarget content attribute value should be " + contentAtttributeValue);
}
function checkFormTarget(aElement)
{
isFormTargetEquals(aElement, "", true);
aElement.formTarget = "foo";
isFormTargetEquals(aElement, "foo");
aElement.setAttribute("formtarget", "bar");
isFormTargetEquals(aElement, "bar");
aElement.removeAttribute("formtarget");
isFormTargetEquals(aElement, "", true);
}
var button = document.createElement('button');
ok('formTarget' in button, "formTarget is a HTMLButtonElement property");
checkFormTarget(button);
</script>
</pre>
</body>
</html>