|
226
|
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").hasClass("ui-slider"), "test if the div has been set-up"); |
|
|
31 |
|
|
|
32 |
}); |
|
|
33 |
|
|
|
34 |
test("test slider seeking", function() { |
|
|
35 |
var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
|
|
36 |
widget.draw(); |
|
|
37 |
|
|
|
38 |
var spy_callback = this.spy(); |
|
|
39 |
widget._Popcorn.listen("test.fixture", spy_callback); |
|
|
40 |
IriSP.jQuery("#widget-div").slider("value", 30); |
|
|
41 |
ok(spy_callback.called, "handling function has been called"); |
|
|
42 |
}); |
|
|
43 |
} |