unittests/tests/widgets/arrowWidget.js
branchpopcorn-port
changeset 305 e8d05c3f77ed
child 319 ad028d8c748b
equal deleted inserted replaced
304:a938013fc6ea 305:e8d05c3f77ed
       
     1 /* arrowWidget.js */
       
     2 
       
     3 function test_arrow_widget() {
       
     4   module("arrow widget testing", 
       
     5   {setup : function() {    
       
     6     this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
       
     7     
       
     8     this.dt = new IriSP.DataLoader();
       
     9     this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
       
    10         
       
    11     
       
    12     this.config = {
       
    13 							width:650,
       
    14 							height:1,
       
    15 							mode:'radio',
       
    16 							container:'widget-div',
       
    17 							debug:true,
       
    18 							css:'../src/css/LdtPlayer.css'};
       
    19     },
       
    20   teardown: function() {
       
    21     /* free the popcorn object because it has signal handlers attached to it */
       
    22     this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
       
    23   }
       
    24   });
       
    25   
       
    26   test("test widget initialization", function() {  
       
    27     var widget = new IriSP.ArrowWidget(this.Popcorn, this.config, this.ser);    
       
    28     widget.draw();
       
    29 
       
    30     equal(widget.selector.children(".Ldt-arrowWidget").length, 1, "test if the div has been added correctly");
       
    31 
       
    32     widget._Popcorn.trigger("IriSP.SegmentsWidget.segmentClick", 40);
       
    33     equal(widget.selector.children(".Ldt-arrowWidget").css("left"), "40%", "test if the widget responds correctly to messages.");
       
    34   });
       
    35  };