Bug 1088761 - Update web-platform tests for reportValidity(). r=smaug

--HG--
extra : rebase_source : 027f8d8e7aa2ebbec5561dd83149b19c16814665
This commit is contained in:
John Dai 2016-05-11 04:26:00 +02:00
Родитель def16ce1d5
Коммит 4971a1fd72
6 изменённых файлов: 100 добавлений и 323 удалений

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

@ -97,3 +97,4 @@ skip-if = buildapp == 'b2g' # b2g(374 total, bug 901848, no keygen support) b2g-
[test_valueasdate_attribute.html]
[test_valueasnumber_attribute.html]
[test_validation_not_in_doc.html]
[test_reportValidation_preventDefault.html]

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

@ -0,0 +1,93 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1088761
-->
<head>
<title>Test for Bug 1088761</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
input, textarea, fieldset, button, select, keygen, output, object { background-color: rgb(0,0,0) !important; }
:valid { background-color: rgb(0,255,0) !important; }
:invalid { background-color: rgb(255,0,0) !important; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1088761">Mozilla Bug 1088761</a>
<p id="display"></p>
<div id="content" style="display: none">
<fieldset id='f' oninvalid="invalidEventHandler(event, true);"></fieldset>
<input id='i' required oninvalid="invalidEventHandler(event, true);">
<button id='b' oninvalid="invalidEventHandler(event, true);"></button>
<select id='s' required oninvalid="invalidEventHandler(event, true);"></select>
<textarea id='t' required oninvalid="invalidEventHandler(event, true);"></textarea>
<output id='o' oninvalid="invalidEventHandler(event, true);"></output>
<keygen id='k' oninvalid="invalidEventHandler(event, true);"></keygen>
<object id='obj' oninvalid="invalidEventHandler(event, true);"></object>
</div>
<div id="content2" style="display: none">
<fieldset id='f2' oninvalid="invalidEventHandler(event, false);"></fieldset>
<input id='i2' required oninvalid="invalidEventHandler(event, false);">
<button id='b2' oninvalid="invalidEventHandler(event, false);"></button>
<select id='s2' required oninvalid="invalidEventHandler(event, false);"></select>
<textarea id='t2' required oninvalid="invalidEventHandler(event, false);"></textarea>
<output id='o2' oninvalid="invalidEventHandler(event, false);"></output>
<keygen id='k2' oninvalid="invalidEventHandler(event, false);"></keygen>
<object id='obj2' oninvalid="invalidEventHandler(event, false);"></object>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 1088761 **/
var gInvalid = false;
function invalidEventHandler(aEvent, isPreventDefault)
{
if (isPreventDefault) {
aEvent.preventDefault();
}
is(aEvent.type, "invalid", "Invalid event type should be invalid");
ok(!aEvent.bubbles, "Invalid event should not bubble");
ok(aEvent.cancelable, "Invalid event should be cancelable");
gInvalid = true;
}
function checkReportValidityForInvalid(element)
{
gInvalid = false;
ok(!element.reportValidity(), "reportValidity() should return false when the element is not valid");
ok(gInvalid, "Invalid event should have been handled");
}
function checkReportValidityForValid(element)
{
gInvalid = false;
ok(element.reportValidity(), "reportValidity() should return true when the element is valid");
ok(!gInvalid, "Invalid event shouldn't have been handled");
}
checkReportValidityForInvalid(document.getElementById('i'));
checkReportValidityForInvalid(document.getElementById('s'));
checkReportValidityForInvalid(document.getElementById('t'));
checkReportValidityForInvalid(document.getElementById('i2'));
checkReportValidityForInvalid(document.getElementById('s2'));
checkReportValidityForInvalid(document.getElementById('t2'));
checkReportValidityForValid(document.getElementById('o'));
checkReportValidityForValid(document.getElementById('k'));
checkReportValidityForValid(document.getElementById('obj'));
checkReportValidityForValid(document.getElementById('f'));
checkReportValidityForValid(document.getElementById('o2'));
checkReportValidityForValid(document.getElementById('k2'));
checkReportValidityForValid(document.getElementById('obj2'));
checkReportValidityForValid(document.getElementById('f2'));
</script>
</pre>
</body>
</html>

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

@ -646,12 +646,6 @@
[HTMLIFrameElement interface: attribute seamless]
expected: FAIL
[HTMLObjectElement interface: operation reportValidity()]
expected: FAIL
[HTMLObjectElement interface: document.createElement("object") must inherit property "reportValidity" with the proper type (14)]
expected: FAIL
[HTMLMediaElement interface: document.createElement("video") must inherit property "getStartDate" with the proper type (23)]
expected: FAIL
@ -1192,15 +1186,9 @@
[HTMLTableCellElement interface: document.createElement("th") must inherit property "headers" with the proper type (2)]
expected: FAIL
[HTMLFormElement interface: operation reportValidity()]
expected: FAIL
[HTMLFormElement interface: operation requestAutocomplete()]
expected: FAIL
[HTMLFormElement interface: document.createElement("form") must inherit property "reportValidity" with the proper type (16)]
expected: FAIL
[HTMLFormElement interface: document.createElement("form") must inherit property "requestAutocomplete" with the proper type (17)]
expected: FAIL
@ -1216,9 +1204,6 @@
[HTMLInputElement interface: attribute valueHigh]
expected: FAIL
[HTMLInputElement interface: operation reportValidity()]
expected: FAIL
[HTMLInputElement interface: attribute labels]
expected: FAIL
@ -1234,45 +1219,30 @@
[HTMLInputElement interface: document.createElement("input") must inherit property "valueHigh" with the proper type (38)]
expected: FAIL
[HTMLInputElement interface: document.createElement("input") must inherit property "reportValidity" with the proper type (46)]
expected: FAIL
[HTMLInputElement interface: document.createElement("input") must inherit property "labels" with the proper type (48)]
expected: FAIL
[HTMLButtonElement interface: attribute menu]
expected: FAIL
[HTMLButtonElement interface: operation reportValidity()]
expected: FAIL
[HTMLButtonElement interface: attribute labels]
expected: FAIL
[HTMLButtonElement interface: document.createElement("button") must inherit property "menu" with the proper type (11)]
expected: FAIL
[HTMLButtonElement interface: document.createElement("button") must inherit property "reportValidity" with the proper type (16)]
expected: FAIL
[HTMLButtonElement interface: document.createElement("button") must inherit property "labels" with the proper type (18)]
expected: FAIL
[HTMLSelectElement interface: attribute autocomplete]
expected: FAIL
[HTMLSelectElement interface: operation reportValidity()]
expected: FAIL
[HTMLSelectElement interface: attribute labels]
expected: FAIL
[HTMLSelectElement interface: document.createElement("select") must inherit property "autocomplete" with the proper type (0)]
expected: FAIL
[HTMLSelectElement interface: document.createElement("select") must inherit property "reportValidity" with the proper type (24)]
expected: FAIL
[HTMLSelectElement interface: document.createElement("select") must inherit property "labels" with the proper type (26)]
expected: FAIL
@ -1288,9 +1258,6 @@
[HTMLTextAreaElement interface: attribute minLength]
expected: FAIL
[HTMLTextAreaElement interface: operation reportValidity()]
expected: FAIL
[HTMLTextAreaElement interface: attribute labels]
expected: FAIL
@ -1306,9 +1273,6 @@
[HTMLTextAreaElement interface: document.createElement("textarea") must inherit property "minLength" with the proper type (8)]
expected: FAIL
[HTMLTextAreaElement interface: document.createElement("textarea") must inherit property "reportValidity" with the proper type (23)]
expected: FAIL
[HTMLTextAreaElement interface: document.createElement("textarea") must inherit property "labels" with the proper type (25)]
expected: FAIL
@ -1417,15 +1381,9 @@
[HTMLKeygenElement interface: document.createElement("keygen") must inherit property "labels" with the proper type (13)]
expected: FAIL
[HTMLOutputElement interface: operation reportValidity()]
expected: FAIL
[HTMLOutputElement interface: attribute labels]
expected: FAIL
[HTMLOutputElement interface: document.createElement("output") must inherit property "reportValidity" with the proper type (10)]
expected: FAIL
[HTMLOutputElement interface: document.createElement("output") must inherit property "labels" with the proper type (12)]
expected: FAIL
@ -1441,9 +1399,6 @@
[HTMLMeterElement interface: document.createElement("meter") must inherit property "labels" with the proper type (6)]
expected: FAIL
[HTMLFieldSetElement interface: operation reportValidity()]
expected: FAIL
[AutocompleteErrorEvent interface: existence and properties of interface object]
expected: FAIL

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

@ -1,311 +1,48 @@
[form-validation-reportValidity.html]
type: testharness
[[INPUT in TEXT status\] no constraint]
expected: FAIL
[[INPUT in TEXT status\] no constraint (in a form)]
expected: FAIL
expected: TIMEOUT
[[INPUT in TEXT status\] suffering from being too long]
expected: FAIL
[[INPUT in TEXT status\] suffering from being too long (in a form)]
expected: FAIL
[[INPUT in TEXT status\] suffering from a pattern mismatch]
expected: FAIL
[[INPUT in TEXT status\] suffering from a pattern mismatch (in a form)]
expected: FAIL
[[INPUT in TEXT status\] suffering from being missing]
expected: FAIL
[[INPUT in TEXT status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in SEARCH status\] no constraint]
expected: FAIL
[[INPUT in SEARCH status\] no constraint (in a form)]
expected: FAIL
[[INPUT in SEARCH status\] suffering from being too long]
expected: FAIL
[[INPUT in SEARCH status\] suffering from being too long (in a form)]
expected: FAIL
[[INPUT in SEARCH status\] suffering from a pattern mismatch]
expected: FAIL
[[INPUT in SEARCH status\] suffering from a pattern mismatch (in a form)]
expected: FAIL
[[INPUT in SEARCH status\] suffering from being missing]
expected: FAIL
[[INPUT in SEARCH status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in TEL status\] no constraint]
expected: FAIL
[[INPUT in TEL status\] no constraint (in a form)]
expected: FAIL
[[INPUT in TEL status\] suffering from being too long]
expected: FAIL
[[INPUT in TEL status\] suffering from being too long (in a form)]
expected: FAIL
[[INPUT in TEL status\] suffering from a pattern mismatch]
expected: FAIL
[[INPUT in TEL status\] suffering from a pattern mismatch (in a form)]
expected: FAIL
[[INPUT in TEL status\] suffering from being missing]
expected: FAIL
[[INPUT in TEL status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in PASSWORD status\] no constraint]
expected: FAIL
[[INPUT in PASSWORD status\] no constraint (in a form)]
expected: FAIL
[[INPUT in PASSWORD status\] suffering from being too long]
expected: FAIL
[[INPUT in PASSWORD status\] suffering from being too long (in a form)]
expected: FAIL
[[INPUT in PASSWORD status\] suffering from a pattern mismatch]
expected: FAIL
[[INPUT in PASSWORD status\] suffering from a pattern mismatch (in a form)]
expected: FAIL
[[INPUT in PASSWORD status\] suffering from being missing]
expected: FAIL
[[INPUT in PASSWORD status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in URL status\] no constraint]
expected: FAIL
[[INPUT in URL status\] no constraint (in a form)]
expected: FAIL
[[INPUT in URL status\] suffering from being too long]
expected: FAIL
[[INPUT in URL status\] suffering from being too long (in a form)]
expected: FAIL
[[INPUT in URL status\] suffering from a pattern mismatch]
expected: FAIL
[[INPUT in URL status\] suffering from a pattern mismatch (in a form)]
expected: FAIL
[[INPUT in URL status\] suffering from a type mismatch]
expected: FAIL
[[INPUT in URL status\] suffering from a type mismatch (in a form)]
expected: FAIL
[[INPUT in URL status\] suffering from being missing]
expected: FAIL
[[INPUT in URL status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in EMAIL status\] no constraint]
expected: FAIL
[[INPUT in EMAIL status\] no constraint (in a form)]
expected: FAIL
[[INPUT in EMAIL status\] suffering from being too long]
expected: FAIL
[[INPUT in EMAIL status\] suffering from being too long (in a form)]
expected: FAIL
[[INPUT in EMAIL status\] suffering from a pattern mismatch]
expected: FAIL
[[INPUT in EMAIL status\] suffering from a pattern mismatch (in a form)]
expected: FAIL
[[INPUT in EMAIL status\] suffering from a type mismatch]
expected: FAIL
[[INPUT in EMAIL status\] suffering from a type mismatch (in a form)]
expected: FAIL
[[INPUT in EMAIL status\] suffering from being missing]
expected: FAIL
[[INPUT in EMAIL status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in DATETIME status\] The datetime type must be supported.]
expected: FAIL
[[INPUT in DATE status\] no constraint]
expected: FAIL
[[INPUT in DATE status\] no constraint (in a form)]
expected: FAIL
[[INPUT in DATE status\] suffering from an overflow]
expected: FAIL
[[INPUT in DATE status\] suffering from an overflow (in a form)]
expected: FAIL
[[INPUT in DATE status\] suffering from an underflow]
expected: FAIL
[[INPUT in DATE status\] suffering from an underflow (in a form)]
expected: FAIL
[[INPUT in DATE status\] suffering from a step mismatch]
expected: FAIL
[[INPUT in DATE status\] suffering from a step mismatch (in a form)]
expected: FAIL
[[INPUT in DATE status\] suffering from being missing]
expected: FAIL
[[INPUT in DATE status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in MONTH status\] The month type must be supported.]
expected: FAIL
[[INPUT in WEEK status\] The week type must be supported.]
expected: FAIL
[[INPUT in TIME status\] no constraint]
expected: FAIL
[[INPUT in TIME status\] no constraint (in a form)]
expected: FAIL
[[INPUT in TIME status\] suffering from an overflow]
expected: FAIL
[[INPUT in TIME status\] suffering from an overflow (in a form)]
expected: FAIL
[[INPUT in TIME status\] suffering from an underflow]
expected: FAIL
[[INPUT in TIME status\] suffering from an underflow (in a form)]
expected: FAIL
[[INPUT in TIME status\] suffering from a step mismatch]
expected: FAIL
[[INPUT in TIME status\] suffering from a step mismatch (in a form)]
expected: FAIL
[[INPUT in TIME status\] suffering from being missing]
expected: FAIL
[[INPUT in TIME status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in NUMBER status\] suffering from an overflow]
expected: FAIL
[[INPUT in NUMBER status\] suffering from an overflow (in a form)]
expected: FAIL
[[INPUT in NUMBER status\] suffering from an underflow]
expected: FAIL
[[INPUT in NUMBER status\] suffering from an underflow (in a form)]
expected: FAIL
[[INPUT in NUMBER status\] suffering from a step mismatch]
expected: FAIL
[[INPUT in NUMBER status\] suffering from a step mismatch (in a form)]
expected: FAIL
[[INPUT in NUMBER status\] suffering from being missing]
expected: FAIL
[[INPUT in NUMBER status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in CHECKBOX status\] no constraint]
expected: FAIL
[[INPUT in CHECKBOX status\] no constraint (in a form)]
expected: FAIL
[[INPUT in CHECKBOX status\] suffering from being missing]
expected: FAIL
[[INPUT in CHECKBOX status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in RADIO status\] no constraint]
expected: FAIL
[[INPUT in RADIO status\] no constraint (in a form)]
expected: FAIL
[[INPUT in RADIO status\] suffering from being missing]
expected: FAIL
[[INPUT in RADIO status\] suffering from being missing (in a form)]
expected: FAIL
[[INPUT in FILE status\] no constraint]
expected: FAIL
[[INPUT in FILE status\] no constraint (in a form)]
expected: FAIL
[[INPUT in FILE status\] suffering from being missing]
expected: FAIL
[[INPUT in FILE status\] suffering from being missing (in a form)]
expected: FAIL
[[select\] no constraint]
expected: FAIL
[[select\] no constraint (in a form)]
expected: FAIL
[[select\] suffering from being missing]
expected: FAIL
[[select\] suffering from being missing (in a form)]
expected: FAIL
[[textarea\] no constraint]
expected: FAIL
[[textarea\] no constraint (in a form)]
expected: FAIL
[[textarea\] suffering from being missing]
expected: FAIL
[[textarea\] suffering from being missing (in a form)]
expected: FAIL

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

@ -1,14 +0,0 @@
[form-validation-validate.html]
type: testharness
[If there is any invalid submittable element whose form owner is the form, the form.reportValidity must be false]
expected: FAIL
[If all of the submittable elements whose form owner is the form are valid, the form.reportValidity must be true]
expected: FAIL
[Check the reportValidity method of the form element when it has a fieldset child]
expected: FAIL
[The invalid event must be fired at the invalid controls]
expected: FAIL

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

@ -99,6 +99,11 @@
}, "Check the checkValidity method of the form element when it has a fieldset child");
test(function(){
// Restore the condition to default which was modified during the previous test.
document.getElementById("fs").disabled = false;
document.getElementById("inp1").value = "";
document.getElementById("inp1").type = "text";
assert_true("reportValidity" in fm3, "The reportValidity method is not supported.");
assert_false(fm3.reportValidity(), "The reportValidity method should be false.");
document.getElementById("fs").disabled = true;