38 |
38 |
39 test("test click on a random segment", function() { |
39 test("test click on a random segment", function() { |
40 var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser); |
40 var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser); |
41 widget.draw(); |
41 widget.draw(); |
42 |
42 |
43 var spy_callback = this.spy(); |
43 var spy_timeupdate = this.spy(); |
|
44 var spy_segmentClick = this.spy(); |
44 var spy_handler = sinon.spy(widget, "clickHandler"); |
45 var spy_handler = sinon.spy(widget, "clickHandler"); |
45 this.Popcorn.listen("timeupdate", spy_callback); |
46 this.Popcorn.listen("timeupdate", spy_timeupdate); |
|
47 this.Popcorn.listen("IriSP.SegmentsWidget.segmentClick", spy_segmentClick); |
46 |
48 |
47 var selector = IriSP.jQuery("#widget-div :not(first-child)"); |
49 var selector = IriSP.jQuery("#widget-div :not(first-child)"); |
48 var random = Math.round(Math.random() * selector.length) + 1; |
50 var random = Math.round(Math.random() * selector.length) + 1; |
49 selector.eq(random).click(); |
51 selector.eq(random).click(); |
50 |
52 |
51 ok(spy_callback.called, "the currenttime was changed"); |
53 ok(spy_timeupdate.called, "the timeupdate signal has been sent"); |
|
54 ok(spy_segmentClick.called, "the IriSP.segmentClick signal has been sent"); |
52 ok(spy_handler.called, "handling function has been called"); |
55 ok(spy_handler.called, "handling function has been called"); |
53 }); |
56 }); |
54 |
57 |
55 test("test search highlight features", function() { |
58 test("test search highlight features", function() { |
56 |
59 |