blob: a8d7cf42bc0471c6102d63ac32ca76f206e0976b [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="resources/js-test-selection-shared.js"></script>
</head>
<body>
<div>
<div id="src" contenteditable="true" spellcheck="true"></div>
</div>
<script language="javascript">
description('Test if WebKit does not spellcheck text when pasting text and continuous spellcheck is turned off. ' +
'To test manually, disable continuous spellcheck, copy the text "zz apple" and paste it to the textarea. ' +
'When "zz" is not marked as misspelled, this test succeeds.');
// Insert a misspelled word to initialize a spellchecker.
var srcNode = document.getElementById('src');
srcNode.focus();
document.execCommand("InsertText", false, 'z');
document.execCommand("InsertText", false, 'z');
document.execCommand("InsertText", false, ' ');
document.execCommand("InsertText", false, 'a');
document.execCommand("InsertText", false, 'p');
document.execCommand("InsertText", false, 'p');
document.execCommand("InsertText", false, 'l');
document.execCommand("InsertText", false, 'e');
shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)');
window.getSelection().selectAllChildren(srcNode);
document.execCommand('Copy');
internals.setContinuousSpellCheckingEnabled(false);
document.execCommand('Paste');
shouldBeFalse('internals.hasSpellingMarker(document, 0, 2)');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>