|
111
|
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(); |
|
113
|
11 |
equal(lay._div, "LdtPlayer", "the default div is set correctly"); |
|
111
|
12 |
equal(lay._width, 640, "the default width is set correctly"); |
|
159
|
13 |
equal(lay._height, undefined, "the default height is set correctly"); |
|
111
|
14 |
|
|
159
|
15 |
equal(IriSP.jQuery("#" + lay._div).css("width"), lay._width + "px", "div width is set correctly"); |
|
111
|
16 |
}); |
|
|
17 |
|
|
|
18 |
test("test custom init of layout manager", function() { |
|
117
|
19 |
var lay = new IriSP.LayoutManager({container: "myDiv", width: 327, height: 542}); |
|
113
|
20 |
equal(lay._div, "myDiv", "the default div is set correctly"); |
|
111
|
21 |
equal(lay._width, 327, "the default width is set correctly"); |
|
|
22 |
equal(lay._height, 542, "the default height is set correctly"); |
|
|
23 |
|
|
113
|
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 divId = lay.createDiv(); |
|
|
31 |
|
|
|
32 |
equal(lay.selector.children("#" + divId).length, 1, "check that a subdiv is created"); |
|
|
33 |
|
|
111
|
34 |
}); |
|
|
35 |
|
|
|
36 |
}; |