Dotclear


Ignore:
Timestamp:
09/04/13 21:55:21 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

[Tests] Add tests for media uploader
Refactoring of _media.js : put all code in a jquery plugin to make
it easy to test and to avoid polluting global namespace.
Use same jquery for tests and for admin

Need to add more tests for media uploader
Fix indentation for all js

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/functional/spec/toggle_with_legend.js

    r1703 r1724  
    11describe("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'),{  }); 
     2     it("Click arrow must make target visible", function() { 
     3          loadFixtures('menu.html'); 
     4          $('#post_status').parent().toggleWithLegend($('#post_status'),{  }); 
    55 
    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'),{  }); 
     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'),{  }); 
    1313 
    14      var $arrow = $('#post_status').parent().find('img'); 
    15      $arrow.click(); 
    16      expect($('#post_status')).toBeVisible(); 
     14          var $arrow = $('#post_status').parent().find('img'); 
     15          $arrow.click(); 
     16          expect($('#post_status')).toBeVisible(); 
    1717 
    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'),{  }); 
     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'),{  }); 
    2424 
    25      var $arrow = $('#post_status').parent().find('img'); 
    26      $arrow.click(); 
    27      expect($('#post_status')).toBeVisible(); 
     25          var $arrow = $('#post_status').parent().find('img'); 
     26          $arrow.click(); 
     27          expect($('#post_status')).toBeVisible(); 
    2828 
    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}); 
     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}); 
    3636 
    37      $label.click(); 
    38      expect($('#post_status')).toBeVisible(); 
     37          $label.click(); 
     38          expect($('#post_status')).toBeVisible(); 
    3939 
    40      var $arrow = $('#post_status').parent().find('img'); 
    41      $arrow.click(); 
    42      expect($('#post_status')).toBeVisible(); 
     40          var $arrow = $('#post_status').parent().find('img'); 
     41          $arrow.click(); 
     42          expect($('#post_status')).toBeVisible(); 
    4343 
    44      $('#post_status').val(-2).trigger('change'); 
    45      expect($('#post_status')).toBeVisible(); 
    46     }); 
     44          $('#post_status').val(-2).trigger('change'); 
     45          expect($('#post_status')).toBeVisible(); 
     46     }); 
    4747}); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map