captured-mouse-event-constructor-inherited.html (1199B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <link rel='help' href='https://screen-share.github.io/captured-mouse-events/#captured-mouse-change-event'> 4 <link rel='help' href='https://dom.spec.whatwg.org/#event'> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script> 8 test(() => { 9 assert_equals((new CapturedMouseEvent("custom")).type, "custom"); 10 }, "type argument is passed to the Event's constructor"); 11 12 const inherited_options = ["bubbles", "cancelable", "composed"]; 13 test(() => { 14 const event = new CapturedMouseEvent(""); 15 inherited_options.forEach(name => { 16 assert_equals(event[name], false, `event.${name} with default eventInitDict`); 17 }); 18 19 inherited_options.forEach(name => { 20 const options = {}; 21 options[name] = true; 22 const event = new CapturedMouseEvent("", options); 23 inherited_options.forEach(other_name => { 24 assert_equals(event[other_name], other_name == name, 25 `event.${other_name} with eventInitDict={${name}: true}`); 26 }); 27 }); 28 }, "EventInit options are passed to the Event's constructor"); 29 </script>