# HG changeset patch # User hamidouk # Date 1319813418 -7200 # Node ID 3ecb643627de3f4c18aa0fc28145f81685eb91b7 # Parent 2ef47ccb290fbd07ab28896a7eeab29bb0efd22e some conversions to use this.selector.find instead of .children(). diff -r 2ef47ccb290f -r 3ecb643627de src/js/widgets/playerWidget.js --- a/src/js/widgets/playerWidget.js Fri Oct 28 16:43:59 2011 +0200 +++ b/src/js/widgets/playerWidget.js Fri Oct 28 16:50:18 2011 +0200 @@ -115,22 +115,22 @@ if ( status == true ){ this._Popcorn.play(); - this.selector.children(".ui-icon-play").css( "background-position", "-16px -160px" ); - this.selector.children("#ldt-CtrlPlay").attr("title", "Play"); + this.selector.find(".ui-icon-play").css( "background-position", "-16px -160px" ); + this.selector.find("#ldt-CtrlPlay").attr("title", "Play"); } else { this._Popcorn.pause(); - this.selector.children(".ui-icon-play").css( "background-position","0px -160px" ); - this.selector.children("#ldt-CtrlPlay").attr("title", "Pause"); + this.selector.find(".ui-icon-play").css( "background-position","0px -160px" ); + this.selector.find("#ldt-CtrlPlay").attr("title", "Pause"); } }; IriSP.PlayerWidget.prototype.muteHandler = function() { if (!this._Popcorn.muted()) { this._Popcorn.mute(true); - this.selector.children(" .ui-icon-volume-on ").css("background-position", "-130px -160px"); + this.selector.find(" .ui-icon-volume-on ").css("background-position", "-130px -160px"); } else { this._Popcorn.mute(false); - this.selector.children( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" ); + this.selector.find( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" ); } }; diff -r 2ef47ccb290f -r 3ecb643627de unittests/tests/playerWidget.js --- a/unittests/tests/playerWidget.js Fri Oct 28 16:43:59 2011 +0200 +++ b/unittests/tests/playerWidget.js Fri Oct 28 16:50:18 2011 +0200 @@ -28,7 +28,7 @@ var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser); player.draw(); - equal(IriSP.jQuery("#widget-div #Ldt-Root").length, 1, "test if the div has been added correctly"); + equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly"); }); test("test play button event handler", function() { @@ -42,16 +42,6 @@ player.draw(); - /* - Code seems to work but test doesn't. It must be a subtle race condition - between Popcorn, the youtube plugin and QUnit. Anyway, it works for pause - so WONTFIX - - IriSP.jQuery("#widget-div .Ldt-Control1 button:first").trigger("click"); - ok(spy_callback.calledOnce, "test if play callback has been called"); - - */ - player.selector.find("#ldt-CtrlPlay").trigger("click"); player.selector.find("#ldt-CtrlPlay").trigger("click"); ok(player.playHandler.calledTwice, "play handler called");