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