1 | describe("toggleWithLegend method (admin/js/common.js)", function() { |
---|
2 | it("Click arrow must make target visible", function() { |
---|
3 | loadStyleFixtures('default.css'); |
---|
4 | loadFixtures('menu.html'); |
---|
5 | $('#post_status').parent().toggleWithLegend($('#post_status'),{ }); |
---|
6 | |
---|
7 | var $arrow = $('#post_status').parent().find('img'); |
---|
8 | $arrow.click(); |
---|
9 | expect($('#post_status')).toBeVisible(); |
---|
10 | }); |
---|
11 | it("Click arrow twice,must make target visible and after second click hidden", function() { |
---|
12 | loadFixtures('menu.html'); |
---|
13 | loadStyleFixtures('default.css'); |
---|
14 | $('#post_status').parent().toggleWithLegend($('#post_status'),{ }); |
---|
15 | |
---|
16 | var $arrow = $('#post_status').parent().find('img'); |
---|
17 | $arrow.click(); |
---|
18 | expect($('#post_status')).toBeVisible(); |
---|
19 | |
---|
20 | $arrow.click(); |
---|
21 | expect($('#post_status')).toBeHidden(); |
---|
22 | }); |
---|
23 | it("Chick target must not hide target", function() { |
---|
24 | loadFixtures('menu.html'); |
---|
25 | loadStyleFixtures('default.css'); |
---|
26 | $('#post_status').parent().toggleWithLegend($('#post_status'),{ }); |
---|
27 | |
---|
28 | var $arrow = $('#post_status').parent().find('img'); |
---|
29 | $arrow.click(); |
---|
30 | expect($('#post_status')).toBeVisible(); |
---|
31 | |
---|
32 | $('#post_status option[value="-2"]').attr('selected', 'selected'); |
---|
33 | expect($('#post_status')).toBeVisible(); |
---|
34 | }); |
---|
35 | it("Chick target must not hide target, when legend_click is true", function() { |
---|
36 | loadFixtures('menu.html'); |
---|
37 | loadStyleFixtures('default.css'); |
---|
38 | var $label = $('#post_status').parent().children('label'); |
---|
39 | $label.toggleWithLegend($('#post_status'),{'legend_click':true, a_container:false}); |
---|
40 | |
---|
41 | $label.click(); |
---|
42 | expect($('#post_status')).toBeVisible(); |
---|
43 | |
---|
44 | var $arrow = $('#post_status').parent().find('img'); |
---|
45 | $arrow.click(); |
---|
46 | expect($('#post_status')).toBeVisible(); |
---|
47 | |
---|
48 | $('#post_status').val(-2).trigger('change'); |
---|
49 | expect($('#post_status')).toBeVisible(); |
---|
50 | }); |
---|
51 | }); |
---|