fune/browser/modules/test/browser_bug1319078.js
Jared Wein 43bac26d30 Bug 1331661 - Enable the 'quotes' rule for eslint and fix most of the errors with --fix. r=Gijs
MozReview-Commit-ID: 6tv0Z06CO4a

--HG--
extra : rebase_source : 014c0b04d8538dc5f15bc6dd4ed6bd220c55c5d4
2017-01-17 09:48:17 -06:00

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);
});