Skip to content

Commit

Permalink
FLUID-4608: Added some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
acheetham committed Feb 19, 2012
1 parent 091c6ee commit 464bd57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion js/VideoPlayer_controllers.js
Expand Up @@ -544,6 +544,8 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
Used for Captions, Transcripts, Audio Descriptions.
Starts with a list of languages and adds the "none, please" options.
Eventually, we'll add the "Make new" and "Request new" buttons.
Note that the language menu cannot share the model of the controls: it
needs the list of captions (or transcripts, etc) as its model for rendering.
*****************************************************************************/
fluid.defaults("fluid.videoPlayer.controllers.languageMenu", {
gradeNames: ["fluid.rendererComponent", "autoInit"],
Expand Down Expand Up @@ -584,6 +586,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
hideOnInit: true
});

// TODO: Could this be specified declaratively, in a "protoTree" option?
fluid.videoPlayer.controllers.languageMenu.produceTree = function (that) {
var tree = {
// create a menu item for each language in the model
Expand All @@ -596,7 +599,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
value: "${{lang}.label}"
}
},

// add the 'turn off' option
showHide: {
value: that.options.strings.showLanguage
Expand Down Expand Up @@ -736,6 +738,9 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
/*****************************************************************************
Language Controls subcomponent: a button and its associated languageMenu
Used for Captions, Transcripts, Audio Descriptions.
Note that the "pressed/released" state of the button reflects the show/hide
state of the captions, and so does not become "pressed" when activated;
activation only shows the menu
*****************************************************************************/
fluid.defaults("fluid.videoPlayer.controllers.languageControls", {
gradeNames: ["fluid.viewComponent", "autoInit"],
Expand Down Expand Up @@ -838,6 +843,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
that.events.onRenderingComplete.fire(that);

that.applier.modelChanged.addListener(that.options.showHidePath, function (model, oldModel, changeRequest) {
// TODO: This assumes an API for the button subcomponent: Should this be accomplished though and event?
that.button.updatePressedState();
});
that.events.onReady.fire(that);
Expand Down
9 changes: 5 additions & 4 deletions tests/js/VideoPlayerControlsTests.js
Expand Up @@ -21,9 +21,10 @@ fluid.registerNamespace("fluid.tests");
(function ($) {
$(document).ready(function () {

// TODO: The various "fluid.tests.initXXX" functions could probably be refactored to reduce duplication

var videoPlayerControlsTests = new jqUnit.TestCase("Video Player Controls Tests");

/*
fluid.tests.toggleButtonDefaults = fluid.defaults("fluid.videoPlayer.controllers.toggleButton");

fluid.tests.onPressEventHandler = function () {
Expand Down Expand Up @@ -311,7 +312,6 @@ fluid.registerNamespace("fluid.tests");
}
});
});
*/

var baseLanguageControlsOpts = {
languages: [{
Expand Down Expand Up @@ -342,6 +342,8 @@ fluid.registerNamespace("fluid.tests");
$.extend(true, opts, testOpts);
return fluid.videoPlayer.controllers.languageControls("#basic-languageControls-test", opts);
};

// TODO: These tests could possibly be refactored to reduce duplication
videoPlayerControlsTests.asyncTest("Language Controls: default functionality", function () {
var numLangs = baseLanguageControlsOpts.languages.length;
var testControls = fluid.tests.initLangControls({
Expand Down Expand Up @@ -377,6 +379,7 @@ fluid.registerNamespace("fluid.tests");
jqUnit.assertEquals("'show language' text should be updated", that.options.strings.showLanguage, showHideOption.text());
jqUnit.assertFalse("Button state should be released", fluid.get(that.button.model, baseLanguageControlsOpts.showHidePath));
jqUnit.assertEquals("'current langauge' should be not be changed", 1, fluid.get(that.model, that.options.currentLanguagePath)[0]);

button[0].click();
showHideOption[0].click();
jqUnit.assertTrue("Click the show/hide option, 'show language' model flag should be true again", fluid.get(that.model, that.options.showHidePath));
Expand All @@ -390,7 +393,6 @@ fluid.registerNamespace("fluid.tests");
});
});

/*
videoPlayerControlsTests.asyncTest("Play button", function () {
var testPlayer = fluid.tests.initVideoPlayer({
listeners: {
Expand Down Expand Up @@ -477,7 +479,6 @@ fluid.registerNamespace("fluid.tests");
}
});
});
*/


});
Expand Down

0 comments on commit 464bd57

Please sign in to comment.