Skip to content

Commit

Permalink
only test if we have voices, phetsims/aqua#179
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed May 15, 2023
1 parent fcb13ee commit 27e4a55
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions js/UtteranceQueueTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,32 +278,37 @@ QUnit.test( 'prioritize utterances on add to back', async assert => {
assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance5, 'utterance5 kicked utterance4 outta the park.' );
} );

QUnit.test( 'utterance.announcerOptions.voice', async assert => {
// CT and some headless browsers don't support SpeechSynthesis
if ( testVoicingManager.voicesProperty.value > 0 ) {

const done = assert.async();
QUnit.test( 'utterance.announcerOptions.voice', async assert => {

testVoicingManager.voiceProperty.value = null;
const done = assert.async();

const voice = testVoicingManager.voicesProperty.value[ 0 ];
const utterance = new Utterance( {
alert: 'one',
announcerOptions: {
voice: voice
}
} );
testVoicingManager.voiceProperty.value = null;

const voice = testVoicingManager.voicesProperty.value[ 0 ];
const utterance = new Utterance( {
alert: 'one',
announcerOptions: {
voice: voice
}
} );

testVoicingManager.endSpeakingEmitter.addListener( function myListener() {

testVoicingManager.endSpeakingEmitter.addListener( function myListener() {
const x = testVoicingManager[ 'speakingSpeechSynthesisUtteranceWrapper' ]!;
assert.ok( x, 'we should have one' );
assert.ok( x.speechSynthesisUtterance.voice === voice, 'voice should match the provided utterance\'s' );
testVoicingManager.endSpeakingEmitter.removeListener( myListener );
done();
} );
testVoicingManager.speakIgnoringEnabled( utterance );

const x = testVoicingManager[ 'speakingSpeechSynthesisUtteranceWrapper' ]!;
assert.ok( x, 'we should have one' );
assert.ok( x.speechSynthesisUtterance.voice === voice, 'voice should match the provided utterance\'s' );
testVoicingManager.endSpeakingEmitter.removeListener( myListener );
done();
testVoicingManager.voiceProperty.value = voice;
} );
testVoicingManager.speakIgnoringEnabled( utterance );
}

testVoicingManager.voiceProperty.value = voice;
} );

if ( queryParameters.manualInput ) {

Expand Down

0 comments on commit 27e4a55

Please sign in to comment.