some conversions to use this.selector.find instead of .children(). popcorn-port
authorhamidouk
Fri, 28 Oct 2011 16:50:18 +0200
branchpopcorn-port
changeset 163 3ecb643627de
parent 162 2ef47ccb290f
child 164 d335ee5533c5
some conversions to use this.selector.find instead of .children().
src/js/widgets/playerWidget.js
unittests/tests/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" );
     }
 };
 
--- 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");