Bug 1850295 - Fix some mochitests I had missed.

MANUAL PUSH: Orange fix CLOSED TREE
This commit is contained in:
Emilio Cobos Álvarez 2024-01-16 12:57:40 +01:00
Родитель 71838e2f11
Коммит 60455dfe29
5 изменённых файлов: 16 добавлений и 96 удалений

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

@ -604,8 +604,6 @@ skip-if = [
["test_bug619278.html"]
["test_bug622558.html"]
["test_bug622597.html"]
["test_bug623291.html"]

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

@ -88,17 +88,22 @@ function checkSelectElement(aElement)
checkPseudoClass(aElement, false);
aElement.blur();
checkPseudoClass(aElement, !aElement.multiple);
checkPseudoClass(aElement, false);
// Focusing while :-moz-ui-invalid applies,
// the pseudo-class should apply while changing selection if appropriate.
aElement.focus();
checkPseudoClass(aElement, !aElement.multiple);
checkPseudoClass(aElement, false);
aElement.selectedIndex = 1;
checkPseudoClass(aElement, false);
aElement.selectedIndex = 0;
checkPseudoClass(aElement, !aElement.multiple);
checkPseudoClass(aElement, false);
aElement.selectedIndex = 1;
checkPseudoClass(aElement, false);
aElement.blur();
checkPseudoClass(aElement, false);
}
checkElement(document.getElementsByTagName('input')[0]);

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

@ -68,9 +68,9 @@ checkPseudoClass(select, true);
content.appendChild(textarea);
content.appendChild(input);
content.appendChild(select);
checkPseudoClass(textarea, false);
checkPseudoClass(input, false);
checkPseudoClass(select, false);
checkPseudoClass(textarea, true);
checkPseudoClass(input, true);
checkPseudoClass(select, true);
// Back in the form.
form.appendChild(textarea);
@ -95,9 +95,9 @@ checkPseudoClass(select, true);
// Remove the form.
document.getElementsByTagName('table')[0].removeChild(form);
checkPseudoClass(textarea, false);
checkPseudoClass(input, false);
checkPseudoClass(select, false);
checkPseudoClass(textarea, true);
checkPseudoClass(input, true);
checkPseudoClass(select, true);
</script>
</pre>

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

@ -34,8 +34,8 @@ function runTest()
ok(!select.matches(":-moz-ui-invalid"),
":-moz-ui-invalid should not apply");
todo(!select.matches(":-moz-ui-valid"),
":-moz-ui-valid should not apply");
ok(!select.matches(":-moz-ui-valid"),
":-moz-ui-valid should not apply");
SimpleTest.finish();
}, {once: true});

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

@ -1,83 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=622558
-->
<head>
<title>Test for Bug 622558</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.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=622558">Mozilla Bug 622558</a>
<p id="display"></p>
<div id="content">
<form>
<input>
<textarea></textarea>
<select><option>foo</option></select>
</div>
<pre id="test">
<script type="application/javascript">
// Bug 940203
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
}
/** Test for Bug 622558 **/
function checkSelectors(aElement)
{
ok(aElement.matches(":-moz-ui-invalid"),
":-moz-ui-invalid should match for " + aElement);
ok(!aElement.matches(":-moz-ui-valid"),
":-moz-ui-valid should not match for " + aElement);
}
var input = document.getElementsByTagName('input')[0];
var textarea = document.getElementsByTagName('textarea')[0];
var select = document.getElementsByTagName('select')[0];
select.addEventListener("focus", function() {
SimpleTest.executeSoon(function() {
select.setCustomValidity('foo');
SimpleTest.executeSoon(function() {
checkSelectors(select);
SimpleTest.finish();
});
});
}, {once: true});
textarea.addEventListener("focus", function() {
SimpleTest.executeSoon(function() {
textarea.setCustomValidity('foo');
SimpleTest.executeSoon(function() {
checkSelectors(textarea);
select.focus();
});
});
}, {once: true});
input.addEventListener("focus", function() {
SimpleTest.executeSoon(function() {
input.setCustomValidity('foo');
SimpleTest.executeSoon(function() {
checkSelectors(input);
textarea.focus();
});
});
}, {once: true});
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
input.focus();
});
</script>
</pre>
</body>
</html>