blob: 6e8eb4d7677555fea732a43905751ccdc14b3aea [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="resources/util.js"></script>
</head>
<body>
<div id="container">
<div id="destination" contentEditable></div>
</div>
<script>
description("Spell check should select multi-word misspellings on context click. "+
"To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', and context-click on the word 'upper'. " +
"The test succeeds when 'upper case' was selected after context click.");
initSpellTest("destination", "It should be upper case.", function(textNode) {
spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
shouldBeEqualToString("spellingMarkerRange.toString()", "upper case");
shouldBeEqualToString("window.getSelection().toString()", "");
// Context click on "upper case" to show the context menu.
var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 100;
var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
contextMenuElements = eventSender.contextClick();
// Esc key to hide the context menu.
eventSender.keyDown(String.fromCharCode(0x001B), null);
spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
shouldBeEqualToString("spellingMarkerRange.toString()", "upper case");
shouldBeEqualToString("window.getSelection().toString()", "upper case");
shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "uppercase");
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>