1 /* tests for layout.js */ |
|
2 function test_layout() { |
|
3 module("layout manager", {setup: |
|
4 function() { |
|
5 IriSP.jQuery("#widget-div").append("<div id='LdtPlayer'></div>"); |
|
6 IriSP.jQuery("#widget-div").append("<div id='myDiv'></div>"); |
|
7 }}); |
|
8 |
|
9 test("test the default initialization of layout manager", function() { |
|
10 var lay = new IriSP.LayoutManager(); |
|
11 equal(lay._div, "LdtPlayer", "the default div is set correctly"); |
|
12 equal(lay._width, 640, "the default width is set correctly"); |
|
13 equal(lay._height, undefined, "the default height is set correctly"); |
|
14 |
|
15 equal(IriSP.jQuery("#" + lay._div).css("width"), lay._width + "px", "div width is set correctly"); |
|
16 }); |
|
17 |
|
18 test("test custom init of layout manager", function() { |
|
19 var lay = new IriSP.LayoutManager({container: "myDiv", width: 327, height: 542}); |
|
20 equal(lay._div, "myDiv", "the default div is set correctly"); |
|
21 equal(lay._width, 327, "the default width is set correctly"); |
|
22 equal(lay._height, 542, "the default height is set correctly"); |
|
23 |
|
24 equal(IriSP.jQuery("#" + lay._div).css("width"), lay._width + "px", "div width is set correctly"); |
|
25 equal(IriSP.jQuery("#" + lay._div).css("height"), lay._height + "px", "div height is set correctly"); |
|
26 }); |
|
27 |
|
28 test("test widget div creation", function() { |
|
29 var lay = new IriSP.LayoutManager({}); |
|
30 var ret = lay.createDiv(); |
|
31 var divId = ret[0]; |
|
32 var spacerId = ret[1]; |
|
33 |
|
34 equal(lay.selector.children("#" + divId).length, 1, "check that a subdiv container is created"); |
|
35 equal(lay.selector.children("#" + spacerId).length, 1, "check that a spacer subdiv is created"); |
|
36 equal(lay.selector.children("#" + spacerId).height() + "px", IriSP.widgetsDefaults.LayoutManager.spacer_div_height, "check that spacer height is set"); |
|
37 |
|
38 }); |
|
39 |
|
40 }; |
|