forked from mirrors/gecko-dev
MozReview-Commit-ID: 6tv0Z06CO4a --HG-- extra : rebase_source : 014c0b04d8538dc5f15bc6dd4ed6bd220c55c5d4
49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
"use strict";
|
|
|
|
var gInvalidFormPopup = document.getElementById("invalid-form-popup");
|
|
|
|
function checkPopupHide() {
|
|
ok(gInvalidFormPopup.state != "showing" && gInvalidFormPopup.state != "open",
|
|
"[Test " + testId + "] The invalid form popup should not be shown");
|
|
}
|
|
|
|
var testId = 0;
|
|
|
|
function incrementTest() {
|
|
testId++;
|
|
info("Starting next part of test");
|
|
}
|
|
|
|
/**
|
|
* In this test, we check that no popup appears if the element display is none.
|
|
*/
|
|
add_task(function* () {
|
|
ok(gInvalidFormPopup,
|
|
"The browser should have a popup to show when a form is invalid");
|
|
|
|
incrementTest();
|
|
let testPage =
|
|
"data:text/html," +
|
|
'<form target="t"><input type="url" placeholder="url" value="http://" style="display: none;"><input id="s" type="button" value="check"></form>';
|
|
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, testPage);
|
|
yield BrowserTestUtils.synthesizeMouse("#s", 0, 0, {}, gBrowser.selectedBrowser);
|
|
|
|
checkPopupHide();
|
|
yield BrowserTestUtils.removeTab(tab);
|
|
});
|
|
|
|
/**
|
|
* In this test, we check that no popup appears if the element visibility is hidden.
|
|
*/
|
|
add_task(function* () {
|
|
incrementTest();
|
|
let testPage =
|
|
"data:text/html," +
|
|
'<form target="t"><input type="url" placeholder="url" value="http://" style="visibility: hidden;"><input id="s" type="button" value="check"></form>';
|
|
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, testPage);
|
|
yield BrowserTestUtils.synthesizeMouse("#s", 0, 0, {}, gBrowser.selectedBrowser);
|
|
|
|
checkPopupHide();
|
|
yield BrowserTestUtils.removeTab(tab);
|
|
});
|
|
|