15 height:1, |
15 height:1, |
16 mode:'radio', |
16 mode:'radio', |
17 container:'widget-div', |
17 container:'widget-div', |
18 debug:true, |
18 debug:true, |
19 css:'../src/css/LdtPlayer.css'} |
19 css:'../src/css/LdtPlayer.css'} |
20 }, |
20 }, |
21 teardown: function() { |
21 teardown: function() { |
22 /* free the popcorn object because it has signal handlers attached to it */ |
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"); |
23 this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4"); |
24 }}); |
24 }}); |
25 |
25 |
26 test("test widget initialization", function() { |
26 test("test widget initialization", function() { |
27 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
27 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
28 widget.draw(); |
28 widget.draw(); |
29 |
29 |
30 ok(IriSP.jQuery("#widget-div").children().hasClass("sliderBackground"), "test if the div has been set-up"); |
30 ok(IriSP.jQuery("#widget-div").children().hasClass("Ldt-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"); |
31 ok(IriSP.jQuery("#widget-div").children().hasClass("Ldt-sliderForeground"), "test if the div has been set-up"); |
32 |
32 |
33 }); |
33 }); |
34 |
34 |
35 test("test slider seeking", function() { |
35 test("test slider seeking", function() { |
36 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
36 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
37 widget.draw(); |
37 widget.draw(); |
38 |
38 |
39 var spy_callback = this.spy(); |
39 var spy_callback = this.spy(); |
40 widget._Popcorn.listen("timeupdate", spy_callback); |
40 widget._Popcorn.listen("timeupdate", spy_callback); |
41 IriSP.jQuery("#widget-div").children().click(); |
41 IriSP.jQuery("#widget-div").children().click(); |
42 ok(spy_callback.called, "handling function has been called"); |
42 ok(spy_callback.called, "handling function has been called"); |
43 }); |
43 }); |
44 |
44 |
45 test("test slider dragging", function() { |
45 test("test slider dragging", function() { |
46 |
46 |
47 /* comes from the jquery unit tests */ |
47 /* comes from the jquery unit tests */ |
48 var drag = function(handle, dx, dy) { |
48 var drag = function(handle, dx, dy) { |
49 var element = el.data("draggable").element; |
49 var element = el.data("draggable").element; |
50 $(handle).simulate("drag", { |
50 $(handle).simulate("drag", { |
51 dx: dx || 0, |
51 dx: dx || 0, |
52 dy: dy || 0 |
52 dy: dy || 0 |
53 }); |
53 }); |
54 dragged = { dx: dx, dy: dy }; |
54 dragged = { dx: dx, dy: dy }; |
55 } |
55 } |
56 |
56 |
57 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
57 var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser); |
58 widget.draw(); |
58 widget.draw(); |
59 |
59 |
60 var spy_callback = this.spy(); |
60 var spy_callback = this.spy(); |
61 widget._Popcorn.listen("timeupdate", spy_callback); |
61 widget._Popcorn.listen("timeupdate", spy_callback); |
62 |
62 |
63 IriSP.jQuery("#widget-div").children(".positionMarker").simulate("drag", 70, 50); |
63 IriSP.jQuery("#widget-div").children(".Ldt-sliderPositionMarker").simulate("drag", 70, 50); |
64 ok(spy_callback.called, "handling function has been called"); |
64 ok(spy_callback.called, "handling function has been called"); |
65 }); |
65 }); |
66 } |
66 } |