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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-spellcheck.html

Issue 2457523003: Support 'insertReplacementText' for spellcheck (Closed)
Patch Set: yosin@ comment#57 #58 addressed 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/Source/core/clipboard/DataObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-spellcheck.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-spellcheck.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-spellcheck.html
new file mode 100644
index 0000000000000000000000000000000000000000..fbc29156675f856620262c175c4da4c4cbc7dbad
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-spellcheck.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<script src='../../../resources/testharness.js'></script>
+<script src='../../../resources/testharnessreport.js'></script>
+<script src='../../../editing/assert_selection.js'></script>
+
+<script>
+test(() => {
+ assert_not_equals(window.internals,
+ undefined,
+ 'This test requires internals.');
+
+ assert_selection(
+ '<div contenteditable id="editable">|appla^ </div>',
+ selection => {
+ const document = selection.document;
+ internals.setMarker(document, selection.getRangeAt(0), 'Spelling');
+ const editable = document.getElementById('editable');
+
+ editable.addEventListener('beforeinput', (event) => {
+ assert_equals(event.inputType, 'insertReplacementText');
+ assert_equals(event.dataTransfer.getData('text/plain'), 'apple');
+ assert_equals(event.getTargetRanges().length, 1);
+ });
+
+ internals.replaceMisspelled(document, 'apple');
+ },
+ '<div contenteditable id="editable">apple| </div>');
+}, 'spellcheck-replace-in-contenteditable');
+
+test(() => {
+ assert_not_equals(window.internals,
+ undefined,
+ 'This test requires internals.');
+
+ assert_selection(
+ '<textarea id="ta">^appla| </textarea>',
+ selection => {
+ const document = selection.document;
+ const textarea = document.getElementById('ta');
+
+ const shadowRoot = internals.shadowRoot(textarea);
+ const selection1 = shadowRoot.getSelection();
+ const range = selection1.getRangeAt(0);
+ internals.setMarker(document, range, 'Spelling');
+
+ textarea.addEventListener('beforeinput', (event) => {
+ assert_equals(event.inputType, 'insertReplacementText');
+ assert_equals(event.data, 'apple');
+ assert_equals(event.getTargetRanges().length, 0);
+ });
+
+ internals.replaceMisspelled(document, 'apple');
+ },
+ '<textarea id="ta">apple| </textarea>');
+}, 'spellcheck-replace-in-textarea');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/clipboard/DataObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698