| author | hamidouk |
| Mon, 21 Nov 2011 11:46:29 +0100 | |
| branch | popcorn-port |
| changeset 288 | 25fe0c8831de |
| parent 287 | 5c7495102bd7 |
| permissions | -rw-r--r-- |
| 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({}); |
|
|
287
5c7495102bd7
added a spacer div to simplify some graphic animations.
hamidouk
parents:
159
diff
changeset
|
30 |
var ret = lay.createDiv(); |
|
5c7495102bd7
added a spacer div to simplify some graphic animations.
hamidouk
parents:
159
diff
changeset
|
31 |
var divId = ret[0]; |
|
5c7495102bd7
added a spacer div to simplify some graphic animations.
hamidouk
parents:
159
diff
changeset
|
32 |
var spacerId = ret[1]; |
| 113 | 33 |
|
|
287
5c7495102bd7
added a spacer div to simplify some graphic animations.
hamidouk
parents:
159
diff
changeset
|
34 |
equal(lay.selector.children("#" + divId).length, 1, "check that a subdiv container is created"); |
|
5c7495102bd7
added a spacer div to simplify some graphic animations.
hamidouk
parents:
159
diff
changeset
|
35 |
equal(lay.selector.children("#" + spacerId).length, 1, "check that a spacer subdiv is created"); |
|
288
25fe0c8831de
made the spacer height configurable. set to 0 by default.
hamidouk
parents:
287
diff
changeset
|
36 |
equal(lay.selector.children("#" + spacerId).height() + "px", IriSP.widgetsDefaults.LayoutManager.spacer_div_height, "check that spacer height is set"); |
| 113 | 37 |
|
| 111 | 38 |
}); |
39 |
|
|
40 |
}; |