67 var elem = IriSP.jQuery("#LdtPlayer").find("video"); |
67 var elem = IriSP.jQuery("#LdtPlayer").find("video"); |
68 notDeepEqual(elem, [], "the element is not null"); |
68 notDeepEqual(elem, [], "the element is not null"); |
69 equal(elem.attr("src"), popcornOptions.file, "the src attribute is set correctly"); |
69 equal(elem.attr("src"), popcornOptions.file, "the src attribute is set correctly"); |
70 }); |
70 }); |
71 |
71 |
|
72 test("test the instantiation of a single widget without dependencies", function() { |
|
73 |
|
74 var dt = new IriSP.DataLoader(); |
|
75 var serialFactory = new IriSP.SerializerFactory(dt); |
|
76 |
|
77 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
78 var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
|
79 var conf = {type: "PlayerWidget", |
|
80 mode: "radio", |
|
81 metadata:{ |
|
82 format:'cinelab', |
|
83 src:'test.json', |
|
84 type:'dummy'} |
|
85 }; |
|
86 |
|
87 var res = IriSP.instantiateWidget(pop, serialFactory, layoutManager, conf); |
|
88 ok(res instanceof IriSP.PlayerWidget, "the returned widget is of the correct instance"); |
|
89 }); |
|
90 |
|
91 test("test the instantiation of a single widget with one dependency", function() { |
|
92 var dt = new IriSP.DataLoader(); |
|
93 var serialFactory = new IriSP.SerializerFactory(dt); |
|
94 |
|
95 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
96 |
|
97 var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
|
98 var conf = {type: "PlayerWidget", |
|
99 mode: "radio", |
|
100 metadata:{ |
|
101 format:'cinelab', |
|
102 src:'test.json', |
|
103 type:'dummy'}, |
|
104 requires: [ |
|
105 {type: "PlayerWidget", |
|
106 mode: "radio", |
|
107 metadata:{ |
|
108 format:'cinelab', |
|
109 src:'test.json', |
|
110 type:'dummy' |
|
111 } }] |
|
112 }; |
|
113 |
|
114 |
|
115 var res = IriSP.instantiateWidget(pop, serialFactory, layoutManager, conf); |
|
116 |
|
117 ok(res instanceof IriSP.PlayerWidget, "the returned widget is of the correct instance"); |
|
118 ok(res.PlayerWidget instanceof IriSP.PlayerWidget, "the dependency widget is accessible from the parent"); |
|
119 }); |
|
120 |
72 test("test the instantiation of a bunch of widgets", function() { |
121 test("test the instantiation of a bunch of widgets", function() { |
73 |
122 |
74 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
123 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
75 var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
124 var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
76 |
125 |
79 ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget"); |
128 ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget"); |
80 ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget"); |
129 ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget"); |
81 ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget"); |
130 ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget"); |
82 equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created"); |
131 equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created"); |
83 }); |
132 }); |
|
133 |
|
134 |
84 } |
135 } |