| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/gesture-util.js"></script> |
| <script src="../resources/testdriver.js"></script> |
| <script src="../resources/testdriver-actions.js"></script> |
| <script src="../resources/testdriver-vendor.js"></script> |
| |
| <form> |
| <input id="input" type="text"> |
| <input id="input2"> |
| </form> |
| |
| <script> |
| const input = document.querySelector('#input'); |
| const input2 = document.querySelector('#input2'); |
| |
| const composedEventTypes = [ |
| // UI Events |
| 'blur', 'focus', 'focusin', 'focusout', |
| 'click', 'dblclick', |
| 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup', |
| 'wheel', |
| 'beforeinput', 'input', |
| 'keydown', 'keyup', |
| 'compositionstart', 'compositionupdate', 'compositionend', |
| // Legacy UI Events |
| 'DOMActivate', 'DOMFocusIn', 'DOMFocusOut', 'keypress', |
| // See LayoutTests/fast/events/touch/basic-single-touch-events.html for Touch Events. |
| ]; |
| |
| promise_test( async (t) => { |
| |
| let received_events = new Set(); |
| |
| for (const eventType of composedEventTypes) { |
| input.addEventListener(eventType, t.step_func((e) => { |
| received_events.add(eventType); |
| assert_true(e.composed, `A ${eventType} event should be a composed event`); |
| })); |
| } |
| |
| await mouseClickOn(input.offsetLeft, input.offsetTop); |
| await mouseDoubleClickOn(input.offsetLeft, input.offsetTop); |
| |
| // For mouseenter/mouseleave |
| await mouseMoveTo(input2.offsetLeft, input2.offsetTop); |
| |
| input.blur(); |
| input.focus(); |
| input.blur(); |
| |
| // For keypress |
| input.focus(); |
| await new test_driver.send_keys(input, ' '); |
| |
| // For wheel event |
| await smoothScrollWithXY(1, 2, input.offsetLeft + 5, input.offsetTop +5, GestureSourceType.MOUSE_INPUT); |
| |
| // For composition |
| input.focus(); |
| textInputController.setMarkedText('1', 0, 1); |
| textInputController.insertText('1'); |
| |
| await waitUntil( () => {return received_events.size == composedEventTypes.length;} ); |
| |
| }, "Checked composed bit for events"); |
| |
| </script> |