unittests/tests/init.js
branchpopcorn-port
changeset 143 2b962708dff6
parent 142 caefb8b4218f
child 158 1813e6e4f0d6
equal deleted inserted replaced
142:caefb8b4218f 143:2b962708dff6
     1 function test_init() {
     1 function test_init() {
     2 	module("test initialization routines", 
     2 	module("test initialization routines", 
     3   {
     3   {
     4     setup: function() {
     4     setup: function() {
     5       IriSP.jQuery("#widget-div").append("<div id='player_container'></div>");
     5       IriSP.jQuery("#widget-div").append("<div id='LdtPlayer'></div>");
     6       this.popcornOptions = {
     6       this.popcornOptions = {
     7           container: "player_container",
     7           container: "widget-div",
     8           type: "jwplayer", file : "video/franceculture/franceculture_retourdudimanche20100620.flv", 
     8           type: "jwplayer", file : "video/franceculture/franceculture_retourdudimanche20100620.flv", 
     9           streamer: "rtmp://media.iri.centrepompidou.fr/ddc_player/", 
     9           streamer: "rtmp://media.iri.centrepompidou.fr/ddc_player/", 
    10           flashplayer : '../libs/player.swf',
    10           flashplayer : '../libs/player.swf',
    11           live: true, 
    11           live: true, 
    12           "controlbar.position" : "none", 
    12           "controlbar.position" : "none", 
    55   });
    55   });
    56   
    56   
    57   test("test the instantiation of a bunch of widgets", function() {
    57   test("test the instantiation of a bunch of widgets", function() {
    58     var pop = IriSP.configurePopcorn(this.popcornOptions);
    58     var pop = IriSP.configurePopcorn(this.popcornOptions);
    59     var widgets = IriSP.configureWidgets(pop, this.widgetOptions);
    59     var widgets = IriSP.configureWidgets(pop, this.widgetOptions);
    60     
    60 
    61     ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget");
    61     ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget");       
    62     equal(widgets[0].selector.length, 1, "the first widget has a created a dom element");    
       
    63     ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget");
    62     ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget");
    64     ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget");
    63     ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget");
       
    64     equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created");
    65   });
    65   });
    66 }
    66 }