1 function test_slider_widget() { |
|
2 module("slider widget testing", |
|
3 {setup : function() { |
|
4 this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4"); |
|
5 |
|
6 this.dt = new IriSP.DataLoader(); |
|
7 this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */ |
|
8 |
|
9 this.config = { |
|
10 metadata:{ |
|
11 format:'cinelab', |
|
12 src:'test.json', |
|
13 load:'json'}, |
|
14 width:650, |
|
15 height:1, |
|
16 mode:'radio', |
|
17 container:'widget-div', |
|
18 debug:true, |
|
19 css:'../src/css/LdtPlayer.css'} |
|
20 }, |
|
21 teardown: function() { |
|
22 /* free the popcorn object because it has signal handlers attached to it */ |
|
23 this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4"); |
|
24 }}); |
|
25 |
|
26 test("test widget initialization", function() { |
|
27 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
|
28 widget.draw(); |
|
29 |
|
30 ok(IriSP.jQuery("#widget-div").children().hasClass("sliderBackground"), "test if the div has been set-up"); |
|
31 ok(IriSP.jQuery("#widget-div").children().hasClass("sliderForeground"), "test if the div has been set-up"); |
|
32 |
|
33 }); |
|
34 |
|
35 test("test slider seeking", function() { |
|
36 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
|
37 widget.draw(); |
|
38 |
|
39 var spy_callback = this.spy(); |
|
40 widget._Popcorn.listen("timeupdate", spy_callback); |
|
41 IriSP.jQuery("#widget-div").children().click(); |
|
42 ok(spy_callback.called, "handling function has been called"); |
|
43 }); |
|
44 } |
|