Chromium Code Reviews| OLD | NEW |
|---|---|
| (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(() => { | |
| 8 assert_not_equals(window.internals, | |
| 9 undefined, | |
|
yosin_UTC9
2016/11/21 01:48:30
nit: align arguments to "(", like:
assert_not_e
| |
| 10 'This test requires internals.'); | |
| 11 | |
| 12 assert_selection( | |
| 13 '<div contenteditable id="editable">|appla^ </div>', | |
| 14 selection => { | |
| 15 const document = selection.document; | |
| 16 internals.setMarker(document, selection.getRangeAt(0), 'Spelling'); | |
| 17 const editable = document.getElementById('editable'); | |
| 18 | |
| 19 editable.addEventListener('beforeinput', (event) => { | |
| 20 assert_equals(event.inputType, 'insertReplacementText'); | |
| 21 assert_equals(event.dataTransfer.getData('text/plain'), 'apple'); | |
| 22 assert_equals(event.getTargetRanges().length, 1); | |
| 23 }); | |
| 24 | |
| 25 internals.replaceMisspelled(document, 'apple'); | |
| 26 }, | |
| 27 '<div contenteditable id="editable">apple| </div>'); | |
| 28 }, 'spellcheck-replace-in-contenteditable'); | |
| 29 | |
| 30 test(() => { | |
| 31 assert_not_equals(window.internals, | |
|
yosin_UTC9
2016/11/21 01:48:30
nit: align arguments to "(", like:
assert_not_e
| |
| 32 undefined, | |
| 33 'This test requires internals.'); | |
| 34 | |
| 35 assert_selection( | |
| 36 '<textarea id="ta">^appla| </textarea>', | |
| 37 selection => { | |
| 38 const document = selection.document; | |
| 39 const textarea = document.getElementById('ta'); | |
| 40 | |
| 41 const shadowRoot = internals.shadowRoot(textarea); | |
| 42 const selection1 = shadowRoot.getSelection(); | |
| 43 const range = selection1.getRangeAt(0); | |
| 44 internals.setMarker(document, range, 'Spelling'); | |
| 45 | |
| 46 textarea.addEventListener('beforeinput', (event) => { | |
| 47 assert_equals(event.inputType, 'insertReplacementText'); | |
| 48 assert_equals(event.data, 'apple'); | |
| 49 assert_equals(event.getTargetRanges().length, 0); | |
| 50 }); | |
| 51 | |
| 52 internals.replaceMisspelled(document, 'apple'); | |
| 53 }, | |
| 54 '<textarea id="ta">apple| </textarea>'); | |
| 55 }, 'spellcheck-replace-in-textarea'); | |
| 56 </script> | |
| OLD | NEW |