| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../assert_selection.js"></script> |
| <script src="spellcheck_test.js"></script> |
| <script> |
| function runIdleTimeSpellCheckerIfNeeded(document) { |
| if (!window.internals) |
| return; |
| internals.runIdleTimeSpellChecker(document); |
| } |
| |
| spellcheck_test( |
| '<div><textarea id="destination"></textarea></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| destination.remove(); |
| }, |
| '<div></div><div id="move-target"></div>', |
| 'Delete <textarea> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><textarea id="destination"></textarea></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| document.getElementById('move-target').appendChild(destination); |
| }, |
| '<div></div><div id="move-target"><textarea id="destination">#zz# #zz# #zz#</textarea></div>', |
| 'Move <textarea> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><textarea id="destination"></textarea></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| destination.value = 'zzz'; |
| }, |
| '<div><textarea id="destination">zzz</textarea></div><div id="move-target"></div>', |
| 'Mutate content of <textarea> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><input id="destination"></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| destination.remove(); |
| }, |
| '<div></div><div id="move-target"></div>', |
| 'Delete <input> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><input id="destination"></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| document.getElementById('move-target').appendChild(destination); |
| }, |
| // No marker because focus is lost after moving. |
| '<div></div><div id="move-target"><input id="destination" value="zz zz zz"></div>', |
| 'Move <input> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><input id="destination"></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| destination.value = 'zzz'; |
| }, |
| '<div><input id="destination" value="zzz"></div><div id="move-target"></div>', |
| 'Mutate content of <input> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><div contenteditable id="destination"></div></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| destination.remove(); |
| }, |
| '<div></div><div id="move-target"></div>', |
| 'Delete <div> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><div contenteditable id="destination"></div></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| document.getElementById('move-target').appendChild(destination); |
| }, |
| // No marker because checking range stays in the original <div> after moving. |
| '<div></div><div id="move-target"><div contenteditable id="destination">zz zz zz</div></div>', |
| 'Move <div> with pending spell check request.'); |
| |
| spellcheck_test( |
| '<div><div contenteditable id="destination"></div></div><div id="move-target"></div>', |
| document => { |
| document.getSelection().setClipboardData('zz zz zz'); |
| const destination = document.getElementById('destination'); |
| destination.focus(); |
| document.execCommand('paste'); |
| runIdleTimeSpellCheckerIfNeeded(document); |
| destination.innerHTML = 'zzz'; |
| }, |
| '<div><div contenteditable id="destination">zzz</div></div><div id="move-target"></div>', |
| 'Mutate content of <div> with pending spell check request.'); |
| </script> |