|
Lines 1-39
a/LayoutTests/editing/spelling/design-mode-spellcheck-off.html_sec1
|
| 1 |
<!DOCTYPE html> |
1 |
<!DOCTYPE html> |
| 2 |
<html> |
2 |
<html> |
| 3 |
<body spellcheck="false"> |
3 |
<head> |
| 4 |
asdf is misspelled. |
4 |
<script src="../editing.js"></script> |
| 5 |
<p>To test this manually, click "asdf" above. There should be no spelling marker for "asdf" after the click.</p> |
5 |
</head> |
|
|
6 |
<body spellcheck="false"> |
| 7 |
<script src="../../resources/js-test-pre.js"></script> |
| 8 |
<div id="misspelled" onmouseup="checkSpellingMarker()">asdf is misspelled.</div> |
| 6 |
<script> |
9 |
<script> |
|
|
10 |
description("This tests whether WebKit does not spell check in 'designMode' " |
| 11 |
+ "when spellcheck='false'. To test manually, click arround 'asdf'. " |
| 12 |
+ "There should be no spelling marker for 'asdf' after the click."); |
| 7 |
|
13 |
|
| 8 |
if (window.testRunner) |
14 |
jsTestIsAsync = true; |
| 9 |
testRunner.dumpAsText(); |
15 |
|
|
|
16 |
if (window.internals) { |
| 17 |
internals.settings.setUnifiedTextCheckerEnabled(true); |
| 18 |
internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| 19 |
} |
| 10 |
|
20 |
|
| 11 |
document.designMode = "on"; |
21 |
document.designMode = "on"; |
| 12 |
|
22 |
|
| 13 |
if (document.activeElement != document.body) |
23 |
function checkSpellingMarker() |
| 14 |
document.body.appendChild(document.createTextNode('FAIL: active element before click is not body element')); |
24 |
{ |
| 15 |
else if (window.testRunner && window.eventSender) { |
25 |
if (!window.internals) |
| 16 |
testRunner.waitUntilDone(); |
26 |
return; |
| 17 |
|
27 |
|
| 18 |
document.body.addEventListener('mousedown', function() { |
28 |
// First, verify spelling with spellcheck attribute off. |
| 19 |
if (document.activeElement != document.body) |
29 |
// Move selection to the next word to notify WebKit that "asdf" has been typed/changed |
| 20 |
document.body.appendChild(document.createTextNode('FAIL: active element after click is not body element')); |
30 |
// to give a chance to spellcheck. |
| 21 |
else if (internals.hasSpellingMarker(0, 4)) |
31 |
moveSelectionForwardByWordCommand(); |
| 22 |
document.body.appendChild(document.createTextNode('FAIL: spell check was invoked')); |
32 |
shouldBecomeEqual('internals.hasSpellingMarker(0, 4)', 'false', function() { |
| 23 |
else |
33 |
evalAndLog('document.body.setAttribute("spellcheck", "true")'); |
| 24 |
document.body.appendChild(document.createTextNode('PASS')); |
34 |
// Do any selection change to force spellchecking after attribute change. |
| 25 |
testRunner.notifyDone(); |
35 |
moveSelectionForwardByLineCommand(); |
|
|
36 |
shouldBecomeDifferent('internals.hasSpellingMarker(0, 4)', 'false', finishJSTest); |
| 26 |
}); |
37 |
}); |
|
|
38 |
} |
| 27 |
|
39 |
|
| 28 |
var x = document.body.offsetLeft + 10; |
40 |
if (window.eventSender) { |
| 29 |
var y = document.body.offsetTop + 10; |
41 |
var misspelledDiv = document.getElementById("misspelled"); |
|
|
42 |
var x = misspelledDiv.offsetLeft; |
| 43 |
var y = misspelledDiv.offsetTop; |
| 30 |
eventSender.mouseMoveTo(x, y); |
44 |
eventSender.mouseMoveTo(x, y); |
| 31 |
eventSender.mouseDown(); |
45 |
eventSender.mouseDown(); |
| 32 |
eventSender.mouseUp(); |
46 |
eventSender.mouseUp(); |
| 33 |
setTimeout("testRunner.notifyDone();document.body.appendChild(document.createTextNode('FAIL: timeout'));", 500); |
47 |
} |
| 34 |
} else |
|
|
| 35 |
document.body.appendChild(document.createTextNode('PASS')); |
| 36 |
|
| 37 |
</script> |
48 |
</script> |
|
|
49 |
<script src="../../resources/js-test-post.js"></script> |
| 38 |
</body> |
50 |
</body> |
| 39 |
</html> |
51 |
</html> |