unittests/tests/widgets/segmentsWidget.js
branchbugslaying-after-r417-merge
changeset 427 440ffc18f827
parent 321 21d840371c6b
child 428 9246dce433f8
equal deleted inserted replaced
424:dcf7121b1202 427:440ffc18f827
     1 /* segmentsWidget.js */
     1 /* segmentsWidget.js */
     2 
     2 
     3 function test_segments_widget() {
     3 function test_segments_widget() {
     4   module("segments widget testing", 
     4   module("segments widget testing", 
     5   {setup : function() {    
     5   {setup : function() {    
     6     this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
     6     this.Popcorn = Popcorn("#popcorn-div");
     7     
     7     
     8     this.dt = new IriSP.DataLoader();
     8     this.dt = new IriSP.DataLoader();
     9     this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
     9     this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
    10             
    10             
    11     this.config = {
    11     this.config = {
    20 							debug:true,
    20 							debug:true,
    21 							css:'../src/css/LdtPlayer.css'}
    21 							css:'../src/css/LdtPlayer.css'}
    22     },  
    22     },  
    23   teardown: function() {
    23   teardown: function() {
    24     /* free the popcorn object because it has signal handlers attached to it */
    24     /* free the popcorn object because it has signal handlers attached to it */
    25     this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
    25     this.Popcorn = Popcorn("#popcorn-div");
    26   }});
    26   }});
    27   
    27   
    28   test("test widget initialization", function() {  
    28   test("test widget initialization", function() {  
    29     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);    
    29     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);    
    30     widget.draw();
    30     widget.draw();
    37   });
    37   });
    38   
    38   
    39   test("test click on a random segment", function() {
    39   test("test click on a random segment", function() {
    40     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
    40     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
    41     widget.draw();
    41     widget.draw();
    42     
    42 
    43     var spy_timeupdate = this.spy();
    43     var spy_timeupdate = this.spy();
    44     var spy_segmentClick = this.spy();
    44     var spy_segmentClick = this.spy();
    45     var spy_handler = sinon.spy(widget, "clickHandler");
    45     var spy_handler = sinon.spy(widget, "clickHandler");
    46     this.Popcorn.listen("timeupdate", spy_timeupdate);    
    46     this.Popcorn.listen("timeupdate", spy_timeupdate);    
    47     
    47     
    50     selector.eq(random).click();
    50     selector.eq(random).click();
    51         
    51         
    52     ok(spy_timeupdate.called, "the timeupdate signal has been sent");         
    52     ok(spy_timeupdate.called, "the timeupdate signal has been sent");         
    53     ok(spy_handler.called, "handling function has been called");           
    53     ok(spy_handler.called, "handling function has been called");           
    54   });
    54   });
    55   
    55 
    56   test("test search highlight features", function() {
    56   test("test search highlight features", function() {
    57   
    57   
    58     var tag_id = "#s_" + "82613B88-9578-DC2C-D7D0-B2C5BE0B7BDA".toUpperCase();
    58     var tag_id = "#s_" + "82613B88-9578-DC2C-D7D0-B2C5BE0B7BDA".toUpperCase();
    59     
    59     
    60     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
    60     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);