| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>InputEvent have data when typing on textarea and contenteditable</title> |
| 4 <script src="/resources/testharness.js"></script> |
| 5 <script src="/resources/testharnessreport.js"></script> |
| 6 <p>To manually run this test, please follow the steps below:<br/> |
| 7 1. Focus the first box and press key 'a' and then 'b'.<br/> |
| 8 2. Focus the second box and press key 'c' and then 'd'.<br/> |
| 9 <br/> |
| 10 If a "PASS" result appears the test passes, otherwise it fails</p> |
| 11 <textarea id='plain'></textarea> |
| 12 <div id='rich' style='border-style: solid;' contenteditable></div> |
| 13 <script> |
| 14 async_test(t => { |
| 15 const expectedResult = [ |
| 16 'plain-beforeinput-a', |
| 17 'plain-input-a', |
| 18 'plain-beforeinput-b', |
| 19 'plain-input-b', |
| 20 'rich-beforeinput-c', |
| 21 'rich-input-c', |
| 22 'rich-beforeinput-d', |
| 23 'rich-input-d', |
| 24 ]; |
| 25 let eventCounter = 0; |
| 26 |
| 27 for (const targetId of ['plain', 'rich']) { |
| 28 for (const eventType of ['beforeinput', 'input']) { |
| 29 document.getElementById(targetId).addEventListener(eventType, t.step
_func(e => { |
| 30 assert_equals(`${targetId}-${eventType}-${e.data}`, expectedResu
lt[eventCounter]); |
| 31 ++eventCounter; |
| 32 if (eventCounter === expectedResult.length) |
| 33 t.done(); |
| 34 })); |
| 35 } |
| 36 } |
| 37 }) |
| 38 </script> |
| OLD | NEW |