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

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html

Issue 2932123002: Add test case for context click at misspelled word boundary (Closed)
Patch Set: Fix Mac Created 3 years, 6 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html b/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html
index 199edbf4808fbb5b41bc145a689391624ffbbac5..44924a92a5335480a3e0a2b825dd2a5f40b40871 100644
--- a/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html
+++ b/third_party/WebKit/LayoutTests/editing/spelling/context_click_select_misspelling.html
@@ -11,7 +11,7 @@ test(() => assert_not_equals(window.internals, undefined),
test(() => assert_not_equals(window.eventSender, undefined),
'This test requires event sender to simulate keyboard and mouse actions.');
-const kNumTests = 4;
+const kNumTests = 5;
const heldTest = async_test(
() => assert_true(true),
'Dummy async test for blocking test harness.',
@@ -39,7 +39,7 @@ function assertContextClickSelection(
range.setStart(textNode, offset);
const rect = range.getClientRects()[0];
- const x = document.offsetLeft + rect.left;
+ const x = document.offsetLeft + rect.left + 2;
const y = document.offsetTop + rect.top + rect.height / 2;
eventSender.mouseMoveTo(x, y);
const contextMenuElements = eventSender.contextClick();
@@ -94,6 +94,44 @@ spellcheck_test(
'',
'<div contenteditable>#wellcome# home.</div>',
{
+ title: 'Context click at boundary of misspelled word.',
+ callback: sample => test(() => {
+ const container = sample.document.querySelector('div');
+ const shouldSelect = isMac(navigator.platform);
+ if (shouldSelect) {
+ // On Mac, right-clicking immediately before a word will select it.
+ assertContextClickSelection(
+ container, 0, 'wellcome',
+ 'Context clicking immediately before "wellcome" selects it');
+
+ // De-select "wellcome"; otherwise, context-clicking immediately after "wellcome" will
+ // not change the selection (since it would select a space and not another word)
+ container.ownerDocument.getSelection().removeAllRanges();
+
+ // On Mac, right-clicking immediately after a word will select the space after it.
+ assertContextClickSelection(
+ container, 8, ' ',
+ 'Context clicking immediately after "wellcome" selects the space after it');
+ return;
+ }
+
+ assertContextClickSelection(
+ container, 0, '',
+ 'Context clicking immediately before "wellcome" does not select it');
+
+ assertContextClickSelection(
+ container, 8, '',
+ 'Context clicking immediately after "wellcome" does not select it');
+ },
+ 'Context clicking immediately before or after misspelled word in editable DIV does not select it.',
+ {sample: sample, blockHeldTest: true})
+ });
+
+spellcheck_test(
+ '<div contenteditable>wellcome home.|</div>',
+ '',
+ '<div contenteditable>#wellcome# home.</div>',
+ {
title: 'Mark initial misspelling "wellcome" in editable DIV.',
callback: sample => test(() => {
const container = sample.document.querySelector('div');
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698