Skip to content

Commit

Permalink
FLOE-416: Updating from Infusion
Browse files Browse the repository at this point in the history
Updated to latest version of Infusion to get fix for FLUID-5756
  • Loading branch information
jobara committed Sep 9, 2015
1 parent a8b0b30 commit 6f430d3
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/infusion/VERSION.md
Expand Up @@ -2,7 +2,7 @@ The version of Infusion included in this folder was created using a custom build

https://github.com/fluid-project/infusion

commit#: cb316066f3fe3e1d4b144a4ba42e3cfe79143add
commit#: a1e3d601478e57276d4143fca5bcbe00f9c6b0cd

```
grunt custom --source=true --include="preferences, tooltip"
Expand All @@ -16,7 +16,8 @@ The following directories were stripped out of the build since they contain code
* src/lib/infusion/src/components/tableOfContents/js/
* src/lib/infusion/src/components/tableOfContents/tableOfContentsDependencies.json
* src/lib/infusion/src/components/textfieldSlider/
* src/lib/infusion/src/components/textToSpeech/
* src/lib/infusion/src/components/textToSpeech/js/TextToSpeech.js
* src/lib/infusion/src/components/textToSpeech/textToSpeechDependencies.json
* src/lib/infusion/src/components/tooltip/
* src/lib/infusion/src/framework/core/frameworkDependencies.json
* src/lib/infusion/src/framework/core/js/
Expand Down
2 changes: 1 addition & 1 deletion src/lib/infusion/infusion-custom.js
@@ -1,4 +1,4 @@
/*! infusion - v2.0.0-SNAPSHOT Wednesday, September 2nd, 2015, 10:16:49 AM*/
/*! infusion - v2.0.0-SNAPSHOT Wednesday, September 9th, 2015, 8:27:28 AM*/
/*!
* jQuery JavaScript Library v1.11.0
* http://jquery.com/
Expand Down
113 changes: 113 additions & 0 deletions src/lib/infusion/src/components/textToSpeech/js/MockTTS.js
@@ -0,0 +1,113 @@
/*
Copyright 2015 OCAD University
Licensed under the Educational Community License (ECL), Version 2.0 or the New
BSD license. You may not use this file except in compliance with one these
Licenses.
You may obtain a copy of the ECL 2.0 License and BSD License at
https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
*/

/* global fluid */

(function () {
"use strict";

// Mocks the fluid.textToSpeech component, removing calls to the
// Web Speech API. This will allow for tests to run in browsers
// that don't support the Web Speech API.
fluid.defaults("fluid.mock.textToSpeech", {
gradeNames: ["fluid.textToSpeech", "autoInit"],
members: {
// An archive of all the calls to queueSpeech.
// Will contain an ordered set of objects -- {text: String, options: Object}.
speechRecord: [],
// An archive of all the events fired
// Will contain a key/value pairing where key is the name of the event and the
// value is the number of times the event was fired.
eventRecord: {}
},
listeners: {
"onStart.recordEvent": {
listener: "{that}.recordEvent",
args: ["onStart"]
},
"onStop.recordEvent": {
listener: "{that}.recordEvent",
args: ["onStop"]
},
"onSpeechQueued.recordEvent": {
listener: "{that}.recordEvent",
args: ["onSpeechQueued"]
}
},
invokers: {
queueSpeech: {
funcName: "fluid.mock.textToSpeech.queueSpeech",
args: ["{that}", "{that}.handleStart", "{that}.handleEnd", "{that}.speechRecord", "{arguments}.0", "{arguments}.1", "{arguments}.2"]
},
cancel: {
funcName: "fluid.mock.textToSpeech.cancel",
args: ["{that}", "{that}.handleEnd"]
},
pause: {
"this": null, // TODO: This needs to be removed once FLUID-5714 is fixed
method: null,
func: "{that}.events.onPause.fire"
},
resume: {
"this": null,
method: null,
func: "{that}.events.onResume.fire"
},
getVoices: {
"this": null,
method: null,
funcName: "fluid.identity",
args: []
},
recordEvent: {
funcName: "fluid.mock.textToSpeech.recordEvent",
args: ["{that}.eventRecord", "{arguments}.0"]
}
}
});

fluid.mock.textToSpeech.queueSpeech = function (that, handleStart, handleEnd, speechRecord, text, interrupt, options) {
if (interrupt) {
that.cancel();
}

var record = {
text: text,
interrupt: !!interrupt
};

if (options) {
record.options = options;
}

speechRecord.push(record);

that.queue.push(text);
that.events.onSpeechQueued.fire(text);

// mocking speechSynthesis speak
handleStart();
// using setTimeout to preserve asynchronous behaviour
setTimeout(handleEnd, 0);

};

fluid.mock.textToSpeech.cancel = function (that, handleEnd) {
that.queue = [];
handleEnd();
};

fluid.mock.textToSpeech.recordEvent = function (eventRecord, name) {
eventRecord[name] = (eventRecord[name] || 0) + 1;
};

})();

0 comments on commit 6f430d3

Please sign in to comment.