Skip to content

Commit

Permalink
FLUID-5936: add some tests for the currentUtterance implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
waharnum committed Aug 30, 2016
1 parent 71bc4ec commit 5b2c2da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/textToSpeech/js/TextToSpeech.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ var fluid_2_0_0 = fluid_2_0_0 || {};
},
members: {
queue: {
texts: [],
currentUtterance: {}
texts: []
// currentUtterance:
}
},
// Model paths: speaking, pending, paused, utteranceOpts, pauseRequested, resumeRequested
Expand Down Expand Up @@ -199,6 +199,10 @@ var fluid_2_0_0 = fluid_2_0_0 || {};
paused: false
};

if (that.queue.currentUtterance) {
that.queue.currentUtterance = undefined;
}

if (!that.queue.texts.length) {
var newModel = $.extend({}, that.model, resetValues);
that.applier.change("", newModel);
Expand Down
8 changes: 6 additions & 2 deletions tests/component-tests/textToSpeech/js/TextToSpeechTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
{
name: "Start and Stop Events",
tests: [{
expect: 10,
expect: 13,
name: "Test Start and Stop Events",
sequence:
[{
Expand All @@ -88,7 +88,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
{
name: "Test Including Pause and Resume Events",
tests: [{
expect: 21,
expect: 22,
name: "Test Including Pause and Resume Events",
sequence:
[
Expand Down Expand Up @@ -209,6 +209,9 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
jqUnit.assertFalse("Nothing should be pending", that.model.pending);
jqUnit.assertFalse("Shouldn't be paused", that.model.paused);
jqUnit.assertDeepEq("The queue of texts should be empty", [], that.queue.texts);
jqUnit.assertTrue("A currentUtterance is present in the queue", that.queue.currentUtterance);
jqUnit.assertTrue("The currentUtterance is a SpeechSynthesisUtterance object", "SpeechSynthesisUtterance", that.queue.currentUtterance.constructor.name);

};

fluid.tests.textToSpeech.testStop = function (tts) {
Expand All @@ -218,6 +221,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
jqUnit.assertFalse("Nothing should be pending", that.model.pending);
jqUnit.assertFalse("Shouldn't be paused", that.model.paused);
jqUnit.assertDeepEq("The queue of texts should be empty", [], that.queue.texts);
jqUnit.assertFalse("No currentUtterance is present in the queue", that.queue.currentUtterance);
that.cancel();
};

Expand Down

0 comments on commit 5b2c2da

Please sign in to comment.