OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>SpeechSynthesisUtterance voice attribute</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 test(() => { |
| 7 const u = new SpeechSynthesisUtterance(); |
| 8 assert_equals(u.voice, null); |
| 9 }, 'initial state'); |
| 10 |
| 11 test(() => { |
| 12 const u = new SpeechSynthesisUtterance(); |
| 13 u.voice = null; |
| 14 assert_equals(u.voice, null); |
| 15 u.voice = undefined; |
| 16 assert_equals(u.voice, null); |
| 17 }, 'setting to null/undefined'); |
| 18 |
| 19 test(() => { |
| 20 const u = new SpeechSynthesisUtterance(); |
| 21 for (const value of [{}, "", window]) { |
| 22 assert_throws(new TypeError, () => { u.voice = value; } ); |
| 23 assert_equals(u.voice, null); |
| 24 } |
| 25 }, 'setting to non-SpeechSynthesisVoice values'); |
| 26 |
| 27 test(() => { |
| 28 internals.enableMockSpeechSynthesizer(document); |
| 29 |
| 30 const u = new SpeechSynthesisUtterance(); |
| 31 const voice = speechSynthesis.getVoices()[0]; |
| 32 // TODO(foolip): This should test instanceof SpeechSynthesisVoice when that |
| 33 // interface is exposed. |
| 34 assert_equals(typeof voice, "object"); |
| 35 u.voice = voice; |
| 36 assert_equals(u.voice, voice); |
| 37 }, 'setting to SpeechSynthesisVoice'); |
| 38 </script> |
OLD | NEW |