unittests/tests/segmentsWidget.js
branchpopcorn-port
changeset 164 d335ee5533c5
parent 157 73bce42a3ed3
child 217 ec3e6d34462c
--- a/unittests/tests/segmentsWidget.js	Fri Oct 28 16:50:18 2011 +0200
+++ b/unittests/tests/segmentsWidget.js	Fri Oct 28 16:51:35 2011 +0200
@@ -7,35 +7,30 @@
     
     this.dt = new IriSP.DataLoader();
     this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
-    
-    
-    IriSP.jQuery("#widget-div").append("<div id='Ldt-Annotations'></div>");
+            
     this.config = {
 						metadata:{
 							format:'cinelab',
 							src:'test.json',
 							load:'json'},
-						gui:{
 							width:650,
 							height:1,
 							mode:'radio',
 							container:'widget-div',
 							debug:true,
-							css:'../src/css/LdtPlayer.css'},
-					};
-    },
+							css:'../src/css/LdtPlayer.css'}
+    },  
   teardown: function() {
     /* free the popcorn object because it has signal handlers attached to it */
     this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }
-  });
+  }});
   
   test("test widget initialization", function() {  
     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);    
     widget.draw();
   
-    equal(IriSP.jQuery("#Ldt-Annotations").length, 1, "test if the div has been added correctly");
-    equal(IriSP.jQuery("#Ldt-Annotations").children().length, this.ser._data.annotations.length, "test if children have been added correctly");     
+    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly");
+    equal(IriSP.jQuery("#widget-div").children().length, this.ser._data.annotations.length, "test if children have been added correctly");
   });
   
   test("test click on a random segment", function() {
@@ -46,7 +41,7 @@
     var spy_handler = sinon.spy(widget, "clickHandler");
     this.Popcorn.listen("timeupdate", spy_callback);    
     
-    var selector = IriSP.jQuery("#Ldt-Annotations :not(first-child)");
+    var selector = IriSP.jQuery("#widget-div :not(first-child)");
     var random = Math.round(Math.random() * selector.length) + 1;
     selector.eq(random).click();
         
@@ -61,9 +56,9 @@
     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
     widget.draw();    
 
-    var oldStyle = IriSP.jQuery("#Ldt-Annotations").children(tag_id).attr("style");
+    var oldStyle = IriSP.jQuery("#widget-div").children(tag_id).attr("style");
     widget._Popcorn.trigger("IriSP.search", "sociologie");
-    var newStyle = IriSP.jQuery("#Ldt-Annotations").children(tag_id).attr("style");
+    var newStyle = IriSP.jQuery("#widget-div").children(tag_id).attr("style");
     notEqual(oldStyle, newStyle, "the segment style has been modified");
   });
 }; 
\ No newline at end of file