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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key.html

Issue 2480133002: Convert editing/spelling/spelling-on-context-menu-key.html with spellcheck_test (Closed)
Patch Set: Mon Nov 7 12:15:05 JST 2016 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <script src="../../resources/testharness.js"></script>
3 <head> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../assert_selection.js"></script>
5 <script src="resources/util.js"></script> 5 <script src="spellcheck_test.js"></script>
6 </head>
7 <body>
8 <div id="container">
9 <div id="destination" contentEditable></div>
10 </div>
11 6
12 <script> 7 <script>
8 test(() => assert_false(navigator.platform.includes('Mac')),
9 'This test requires context menu key.');
10 test(() => assert_not_equals(window.eventSender, undefined),
11 'This test requires event sender.');
13 12
14 description("Spell check selects the misspelled word on context menu key. " + 13 spellcheck_test(
15 "To test manually, type 'wellcome home.' place the cursor on 'wellco me', and press the context menu key. " + 14 '<div contenteditable>well|come home.</div>',
16 "The test succeeds when 'wellcome' is selected after the context men u key."); 15 '',
17 16 '<div contenteditable>#wellcome# home.</div>',
18 initSpellTest("destination", "wellcome home.", function(textNode) { 17 {
19 var behaviors = ["win", "mac"]; 18 title: 'Mark initial misspelling.',
20 for (var i = 0; i < behaviors.length; i++) { 19 callback: sample => test(() => {
21 internals.settings.setEditingBehavior(behaviors[i]); 20 eventSender.keyDown('ContextMenu');
22 21 eventSender.keyDown('Escape');
23 // Place cursor on "wellcome". 22 assert_equals(sample.selection.toString(), 'wellcome');
24 window.getSelection().removeAllRanges(); 23 }, 'When caret is on a misspelled word, pressing context menu key ' +
25 var range = document.createRange(); 24 'selects the word.')
26 range.setStart(textNode, 2); 25 });
27 range.setEnd(textNode, 2);
28 window.getSelection().addRange(range);
29
30 // Context menu key to show the context menu.
31 eventSender.keyDown("ContextMenu");
32
33 // Esc to close the context menu.
34 eventSender.keyDown("Escape");
35
36 shouldBeEqualToString("window.getSelection().toString()", "wellcome");
37 }
38 });
39
40 </script> 26 </script>
41 </body>
42 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698