unittests/tests/segmentsWidget.js
branchpopcorn-port
changeset 157 73bce42a3ed3
parent 104 d571e9020092
child 164 d335ee5533c5
equal deleted inserted replaced
156:0e6a4d1e4dbe 157:73bce42a3ed3
    45     var spy_callback = this.spy();
    45     var spy_callback = this.spy();
    46     var spy_handler = sinon.spy(widget, "clickHandler");
    46     var spy_handler = sinon.spy(widget, "clickHandler");
    47     this.Popcorn.listen("timeupdate", spy_callback);    
    47     this.Popcorn.listen("timeupdate", spy_callback);    
    48     
    48     
    49     var selector = IriSP.jQuery("#Ldt-Annotations :not(first-child)");
    49     var selector = IriSP.jQuery("#Ldt-Annotations :not(first-child)");
    50     var random = Math.round(Math.random() * selector.length);
    50     var random = Math.round(Math.random() * selector.length) + 1;
    51     selector.eq(random).click();
    51     selector.eq(random).click();
    52         
    52         
    53     ok(spy_callback.called, "the currenttime was changed");         
    53     ok(spy_callback.called, "the currenttime was changed");         
    54     ok(spy_handler.called, "handling function has been called");           
    54     ok(spy_handler.called, "handling function has been called");           
    55   });
    55   });
       
    56   
       
    57   test("test search highlight features", function() {
       
    58   
       
    59     var tag_id = "#s_" + "82613B88-9578-DC2C-D7D0-B2C5BE0B7BDA".toUpperCase();
       
    60     
       
    61     var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
       
    62     widget.draw();    
       
    63 
       
    64     var oldStyle = IriSP.jQuery("#Ldt-Annotations").children(tag_id).attr("style");
       
    65     widget._Popcorn.trigger("IriSP.search", "sociologie");
       
    66     var newStyle = IriSP.jQuery("#Ldt-Annotations").children(tag_id).attr("style");
       
    67     notEqual(oldStyle, newStyle, "the segment style has been modified");
       
    68   });
    56 }; 
    69 };