test_bug636465.html (2190B)
1 <!doctype html> 2 <title>Mozilla bug 636465</title> 3 <link rel=stylesheet href="/tests/SimpleTest/test.css"> 4 <script src="/tests/SimpleTest/EventUtils.js"></script> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script src="/tests/SimpleTest/WindowSnapshot.js"></script> 7 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=636465" 8 target="_blank">Mozilla Bug 636465</a> 9 <input id="x" value="foobarbaz" spellcheck="true" style="background-color: transparent; border: transparent;"> 10 <script> 11 SimpleTest.waitForExplicitFinish(); 12 13 function runTest() { 14 const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule( 15 "resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs" 16 ); 17 var x = document.getElementById("x"); 18 x.focus(); 19 onSpellCheck(x, function() { 20 x.blur(); 21 var spellCheckTrue = snapshotWindow(window); 22 x.setAttribute("spellcheck", "false"); 23 var spellCheckFalse = snapshotWindow(window); 24 x.setAttribute("spellcheck", "true"); 25 x.focus(); 26 onSpellCheck(x, function() { 27 x.blur(); 28 var spellCheckTrueAgain = snapshotWindow(window); 29 x.removeAttribute("spellcheck"); 30 var spellCheckNone = snapshotWindow(window); 31 var ret = compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0]; 32 ok(ret, 33 "Setting the spellcheck attribute to false should work"); 34 if (!ret) { 35 ok(false, "\nspellCheckTrue: " + spellCheckTrue.toDataURL() + "\nspellCheckFalse: " + spellCheckFalse.toDataURL()); 36 } 37 ret = compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0]; 38 ok(ret, 39 "Setting the spellcheck attribute back to true should work"); 40 if (!ret) { 41 ok(false, "\nspellCheckTrue: " + spellCheckTrue.toDataURL() + "\nspellCheckTrueAgain: " + spellCheckTrueAgain.toDataURL()); 42 } 43 ret = compareSnapshots(spellCheckNone, spellCheckFalse, true)[0]; 44 ok(ret, 45 "Unsetting the spellcheck attribute should work"); 46 if (!ret) { 47 ok(false, "\spellCheckNone: " + spellCheckNone.toDataURL() + "\nspellCheckFalse: " + spellCheckFalse.toDataURL()); 48 } 49 SimpleTest.finish(); 50 }); 51 }); 52 } 53 addLoadEvent(runTest); 54 </script>