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

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

Issue 2457523003: Support 'insertReplacementText' for spellcheck (Closed)
Patch Set: fix range 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/Source/core/clipboard/DataObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
yosin_UTC9 2016/11/16 04:14:45 Please get rid of this statement since this test c
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 id="editable">|appla^ </div>',
17 selection => {
18 const document = selection.document;
19 internals.setMarker(document, selection.getRangeAt(0), 'Spelling');
20 const editable = document.getElementById("editable");
21
22 const handler = function(event) {
yosin_UTC9 2016/11/16 04:14:45 nit: s/const handler/function handler(event)/
23 assert_equals(event.inputType, "insertReplacementText");
yosin_UTC9 2016/11/16 04:14:45 nit: Please use single-quote since other parts of
24 assert_equals(event.dataTransfer.getData("text/plain"), "apple");
25 assert_equals(event.getTargetRanges().length, 1);
26 editable.removeEventListener('beforeinput', handler);
yosin_UTC9 2016/11/16 04:14:45 Q: Do we really need to remove event listener?
27 };
28 editable.addEventListener('beforeinput', handler);
29
30 internals.replaceMisspelled(document, 'apple');
31 },
32 '<div contenteditable id="editable">apple| </div>'
33 );
34 }, "spellcheck-replace-in-contenteditable");
35
36 test(function () {
37 assert_not_equals(window.eventSender,
yosin_UTC9 2016/11/16 04:14:46 Please get rid of this statement since this test c
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 const document = selection.document;
48 const textarea = document.getElementById("ta");
49
50 const shadowRoot = internals.shadowRoot(textarea);
51 const selection1 = shadowRoot.getSelection();
52 const range = selection1.getRangeAt(0);
53 internals.setMarker(document, range, 'Spelling');
54
55 const handler = function(event) {
yosin_UTC9 2016/11/16 04:14:45 nit: s/const handler/function handler(event)/
56 assert_equals(event.inputType, "insertReplacementText");
57 assert_equals(event.data, "apple");
58 assert_equals(event.getTargetRanges().length, 0);
59 textarea.removeEventListener('beforeinput', handler);
yosin_UTC9 2016/11/16 04:14:46 Q: Do we really need to remove event listener?
60 };
61 textarea.addEventListener('beforeinput', handler);
62
63 internals.replaceMisspelled(document, 'apple');
64 },
65 '<textarea id="ta">apple| </textarea>'
66 );
67 }, "spellcheck-replace-in-textarea");
68
69 </script>
OLDNEW
« 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