Bug 1598648 [wpt PR 20401] - Rename variable and call preventDefault(), a=testonly draft
authorAlexey Shvayka <shvaikalesh@gmail.com>
Sat, 23 Nov 2019 09:18:08 +0000
changeset 2496008 2867fdb8695ed49b7723518d328426bbb33fc387
parent 2496007 931419f26849430ac4d2db3b0dd44bf74427a3da
child 2496009 819c975810cc8169937ace6be6f3ea80e0029f2f
push id455263
push userwptsync@mozilla.com
push dateMon, 25 Nov 2019 19:36:14 +0000
treeherdertry@e7eb01746159 [default view] [failures only]
reviewerstestonly
bugs1598648, 20401
milestone72.0a1
Bug 1598648 [wpt PR 20401] - Rename variable and call preventDefault(), a=testonly wpt-commit: 528eb9b7deb4bbcb373e48b5d4b87dd28154cb05 wpt-pr: 20401
testing/web-platform/tests/css/cssom-view/MediaQueryList-extends-EventTarget.html
--- a/testing/web-platform/tests/css/cssom-view/MediaQueryList-extends-EventTarget.html
+++ b/testing/web-platform/tests/css/cssom-view/MediaQueryList-extends-EventTarget.html
@@ -97,21 +97,22 @@ promise_test(async t => {
 }, "removeEventListener removes listener");
 
 test(() => {
     const mql = window.matchMedia("all");
 
     let receivedEvent;
     mql.addEventListener("custom", event => {
         receivedEvent = event;
+        event.preventDefault();
     }, true);
 
     const dispatchedEvent = new CustomEvent("custom", {
-        // cancelable: true.
+        cancelable: true,
         detail: {},
     });
 
-    const isCanceled = mql.dispatchEvent(dispatchedEvent);
+    const defaultAction = mql.dispatchEvent(dispatchedEvent);
 
     assert_equals(receivedEvent, dispatchedEvent);
-    assert_true(isCanceled);
+    assert_false(defaultAction);
 }, "dispatchEvent works as expected");
 </script>