| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test.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) { |
| var behaviors = ["win", "mac"]; |
| for (var i = 0; i < behaviors.length; i++) { |
| internals.settings.setEditingBehavior(behaviors[i]); |
| |
| 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"); |
| |
| window.getSelection().removeAllRanges(); |
| } |
| }); |
| |
| </script> |
| </body> |
| </html> |