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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key.html b/third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key.html
index 75cc22c5879a8592bba1069c9afffdbcf7871426..76b694795add7c5d03c2cda4150ea36485f9291a 100644
--- a/third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key.html
+++ b/third_party/WebKit/LayoutTests/editing/spelling/spelling-on-context-menu-key.html
@@ -1,42 +1,26 @@
<!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 src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<script src="spellcheck_test.js"></script>
<script>
-
-description("Spell check selects the misspelled word on context menu key. " +
- "To test manually, type 'wellcome home.' place the cursor on 'wellcome', and press the context menu key. " +
- "The test succeeds when 'wellcome' is selected after the context menu key.");
-
-initSpellTest("destination", "wellcome home.", function(textNode) {
- var behaviors = ["win", "mac"];
- for (var i = 0; i < behaviors.length; i++) {
- internals.settings.setEditingBehavior(behaviors[i]);
-
- // Place cursor on "wellcome".
- window.getSelection().removeAllRanges();
- var range = document.createRange();
- range.setStart(textNode, 2);
- range.setEnd(textNode, 2);
- window.getSelection().addRange(range);
-
- // Context menu key to show the context menu.
- eventSender.keyDown("ContextMenu");
-
- // Esc to close the context menu.
- eventSender.keyDown("Escape");
-
- shouldBeEqualToString("window.getSelection().toString()", "wellcome");
- }
-});
-
+test(() => assert_false(navigator.platform.includes('Mac')),
+ 'This test requires context menu key.');
+test(() => assert_not_equals(window.eventSender, undefined),
+ 'This test requires event sender.');
+
+spellcheck_test(
+ '<div contenteditable>well|come home.</div>',
+ '',
+ '<div contenteditable>#wellcome# home.</div>',
+ {
+ title: 'Mark initial misspelling.',
+ callback: sample => test(() => {
+ eventSender.keyDown('ContextMenu');
+ eventSender.keyDown('Escape');
+ assert_equals(sample.selection.toString(), 'wellcome');
+ }, 'When caret is on a misspelled word, pressing context menu key ' +
+ 'selects the word.')
+ });
</script>
-</body>
-</html>
« 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