Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores.html

Issue 2477353002: Convert editing/spelling/spelling-double-clicked-word[-with-underscores].html with spellcheck_test (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/util.js"></script>
6 </head>
7 <body>
8 <div id="container">
9 <div id="destination" contentEditable></div>
10 </div>
11
12 <script>
13
14 description("Spelling should work for double-clicked misspelled words with under scores. " +
15 "To test manually, type 'wellcome_ home.', double-click on 'wellcome _', and context-click on the selection. " +
16 "The test succeeds when the context menu shows spell check suggestio ns.");
17
18 initSpellTest("destination", "wellcome_ home.", function(textNode) {
19 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
20 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
21 shouldBeEqualToString("window.getSelection().toString()", "");
22
23 // Double-click the misspelled word without the trailing whitespace.
24 internals.settings.setSmartInsertDeleteEnabled(true);
25 internals.settings.setSelectTrailingWhitespaceEnabled(false);
26 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40;
27 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina tion.offsetHeight / 2;
28 eventSender.mouseMoveTo(x, y);
29 eventSender.mouseDown();
30 eventSender.mouseUp();
31 eventSender.mouseDown();
32 eventSender.mouseUp();
33
34 shouldBeEqualToString("window.getSelection().toString()", "wellcome_");
35
36 // Context click on "wellcome_" to show the context menu.
37 x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40;
38 y = destination.offsetParent.offsetTop + destination.offsetTop + destination .offsetHeight / 2;
39 eventSender.mouseMoveTo(x, y);
40 contextMenuElements = eventSender.contextClick();
41 // Esc key to hide the context menu.
42 eventSender.keyDown("Escape", null);
43
44 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
45 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
46 shouldBeEqualToString("window.getSelection().toString()", "wellcome_");
47 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome");
48
49 window.getSelection().removeAllRanges();
50 shouldBeEqualToString("window.getSelection().toString()", "");
51
52 // Double-click the misspelled word with the trailing whitespace.
53 internals.settings.setSmartInsertDeleteEnabled(false);
54 internals.settings.setSelectTrailingWhitespaceEnabled(true);
55 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40;
56 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina tion.offsetHeight / 2;
57 eventSender.mouseMoveTo(x, y);
58 eventSender.mouseDown();
59 eventSender.mouseUp();
60 eventSender.mouseDown();
61 eventSender.mouseUp();
62
63 shouldBeEqualToString("window.getSelection().toString()", "wellcome_ ");
64
65 // Context click on "wellcome_ " to show the context menu.
66 x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40;
67 y = destination.offsetParent.offsetTop + destination.offsetTop + destination .offsetHeight / 2;
68 eventSender.mouseMoveTo(x, y);
69 contextMenuElements = eventSender.contextClick();
70 // Esc key to hide the context menu.
71 eventSender.keyDown("Escape", null);
72
73 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
74 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
75 shouldBeEqualToString("window.getSelection().toString()", "wellcome_ ");
76 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome");
77 });
78
79 </script>
80 </body>
81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698