gecko-dev/editor/libeditor/tests/test_bug636465.html
Mark Banner e824d800fb Bug 1489980 - Enable ESLint for editor/ - Manual fixes. r=masayuki
This enables the editor directory to be linted, and fixes the remaining issues raised by ESLint. Various rules were fixed here including, no-shadow, no-undef, no-unused-vars and others.

I've generally gone conservative, disabling rules where it doesn't make sense to fix them (e.g. sometimes suggests use-services for tests, but it is only used once, or within a Chrome script).

Depends on D5585

Differential Revision: https://phabricator.services.mozilla.com/D5587

--HG--
extra : moz-landing-system : lando
2018-09-13 07:59:47 +00:00

54 lines
2.1 KiB
HTML

<!doctype html>
<title>Mozilla bug 636465</title>
<link rel=stylesheet href="/tests/SimpleTest/test.css">
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=636465"
target="_blank">Mozilla Bug 636465</a>
<input id="x" value="foobarbaz" spellcheck="true" style="background-color: transparent; border: transparent;">
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
const {onSpellCheck} = SpecialPowers.Cu.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm", {});
var x = document.getElementById("x");
x.focus();
onSpellCheck(x, function() {
x.blur();
var spellCheckTrue = snapshotWindow(window);
x.setAttribute("spellcheck", "false");
var spellCheckFalse = snapshotWindow(window);
x.setAttribute("spellcheck", "true");
x.focus();
onSpellCheck(x, function() {
x.blur();
var spellCheckTrueAgain = snapshotWindow(window);
x.removeAttribute("spellcheck");
var spellCheckNone = snapshotWindow(window);
var ret = compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0];
ok(ret,
"Setting the spellcheck attribute to false should work");
if (!ret) {
ok(false, "\nspellCheckTrue: " + spellCheckTrue.toDataURL() + "\nspellCheckFalse: " + spellCheckFalse.toDataURL());
}
ret = compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0];
ok(ret,
"Setting the spellcheck attribute back to true should work");
if (!ret) {
ok(false, "\nspellCheckTrue: " + spellCheckTrue.toDataURL() + "\nspellCheckTrueAgain: " + spellCheckTrueAgain.toDataURL());
}
ret = compareSnapshots(spellCheckNone, spellCheckFalse, true)[0];
ok(ret,
"Unsetting the spellcheck attribute should work");
if (!ret) {
ok(false, "\spellCheckNone: " + spellCheckNone.toDataURL() + "\nspellCheckFalse: " + spellCheckFalse.toDataURL());
}
SimpleTest.finish();
});
});
}
addLoadEvent(runTest);
</script>