event-onshow.https.html (936B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Notification.onshow (basic)</title> 4 <link rel="author" title="Intel" href="http://www.intel.com/"> 5 <link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script> 11 promise_setup(() => { 12 return test_driver.set_permission({ name: "notifications" }, "granted") 13 }) 14 15 promise_test(async t => { 16 const notification = new Notification("New Email Received") 17 const event = await new Promise(resolve => { 18 notification.onshow = resolve; 19 }) 20 notification.close() 21 assert_equals(Object.prototype.toString.call(event), "[object Event]") 22 assert_equals(event.type, "show", "Checked the event type.") 23 }, "Invoked the onshow event handler.") 24 </script>