| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <textarea onfocus=handleFocus() id="plain" onbeforeinput=handlePlainInput(event,true) oninput=handlePlainInput(event,false)>testing</textarea> |
| <div id="rich" contenteditable onbeforeinput=handleRichInput(event,true) oninput=handleRichInput(event,false)></div> |
| <script type="text/javascript"> |
| description(`To manually test this, copy the word 'testing' and paste into both the textarea and contenteditable. Verify that two PASS messages are printed out per paste (one for the beforeinput, the other for input).`); |
| (function() { |
| if (!window.internals || !window.eventSender || !window.testRunner) |
| return; |
| document.querySelector("#plain").focus(); |
| })(); |
| |
| function handleFocus() |
| { |
| document.querySelector("#plain").select(); |
| testRunner.execCommand("Cut"); |
| |
| debug("pasting 'testing' in the plain textarea. data should be nonnull"); |
| testRunner.execCommand("Paste"); |
| |
| document.querySelector("#rich").focus(); |
| debug("pasting 'testing' in the rich contenteditable. data should be null"); |
| testRunner.execCommand("Paste"); |
| } |
| |
| function handleRichInput(event, isbefore) |
| { |
| if (event.inputType === "insertFromPaste") |
| shouldBeNull("event.data"); |
| } |
| |
| function handlePlainInput(event, isbefore) |
| { |
| if (event.inputType === "insertFromPaste") |
| shouldBe("event.data", "'testing'"); |
| } |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| |
| </html> |