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

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

Issue 2457523003: Support 'insertReplacementText' for spellcheck (Closed)
Patch Set: fix for yosin's comments 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 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script src="../../../editing/assert_selection.js"></script>
5
6 <script>
7 test(function () {
8 assert_not_equals(window.eventSender,
9 undefined,
10 'This test requires eventSender.');
11 assert_not_equals(window.internals,
12 undefined,
13 'This test requires internals.');
14
15 assert_selection(
16 '<div contenteditable="true" id="editable">|appla^ </div>',
17 selection => {
18 var document = selection.document;
19 internals.setSpellingMarker(document);
20 var editable = document.getElementById("editable");
21
22 var handler = function(event) {
23 assert_equals(event.inputType, "insertReplacementText");
24 assert_equals(event.dataTransfer.getData("text/plain"), "apple");
25 assert_equals(event.getTargetRanges().length, 1);
26 editable.removeEventListener('beforeinput', handler);
27 };
28 editable.addEventListener('beforeinput', handler);
29
30 internals.replaceMisspelled(document, "apple");
31 },
32 '<div contenteditable="true" id="editable">apple| </div>'
33 );
34 }, "spellcheck-replace-in-contenteditable");
35
36 test(function () {
37 assert_not_equals(window.eventSender,
38 undefined,
39 'This test requires eventSender.');
40 assert_not_equals(window.internals,
41 undefined,
42 'This test requires internals.');
43
44 assert_selection(
45 '<textarea id="ta">^appla| </textarea>',
46 selection => {
47 console.log(selection.toString()); // selection is empty
chaopeng 2016/11/02 20:45:25 Hi Yosin, I changed the test to assert selection.
chongz 2016/11/03 15:48:34 I'm not exactly sure how |assert_selection()| work
yosin_UTC9 2016/11/08 04:34:27 I'm now updating assert_selection() to support INP
yosin_UTC9 2016/11/09 05:25:54 assert_selection() with TEXTAREA http://crrev.com/
48 var document = selection.document;
49 internals.setSpellingMarker(document);
50 var textarea = document.getElementById("ta");
51
52 var handler = function(event) {
53 assert_equals(event.inputType, "insertReplacementText");
54 assert_equals(event.data, "apple");
55 assert_equals(event.getTargetRanges().length, 0);
56 textarea.removeEventListener('beforeinput', handler);
57 };
58 textarea.addEventListener('beforeinput', handler);
59
60 internals.replaceMisspelled(document, "apple");
61 },
62 '<textarea id="ta">apple| </textarea>'
63 );
64 }, "spellcheck-replace-in-input");
65
66 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698