SpeechSynthesisEvent-properties.html (1126B)
1 <!doctype html> 2 <title>Properties of SpeechSynthesisEvent</title> 3 <link rel="help" href="https://wicg.github.io/speech-api/#utterance-events"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <body> 9 <script> 10 // Written for https://github.com/WICG/speech-api/issues/103 11 promise_test(async (t) => { 12 const utterance = new SpeechSynthesisUtterance('test'); 13 const eventWatcher = new EventWatcher(t, utterance, ['start', 'end', 'error']); 14 await test_driver.bless('speechSynthesis.speak', 15 () => { speechSynthesis.speak(utterance) }); 16 const events = await eventWatcher.wait_for(['start', 'end'], { record: 'all' }); 17 assert_equals(events.length, 2, 'number of events'); 18 for (const event of events) { 19 assert_true(event instanceof SpeechSynthesisEvent, 'is SpeechSynthesisEvent'); 20 assert_false(event.bubbles, 'bubbles'); 21 assert_false(event.cancelable, 'cancelable'); 22 assert_equals(event.utterance, utterance, 'utterance'); 23 } 24 }); 25 </script>