Dotclear

Changeset 2162:ff2e89cb94bb


Ignore:
Timestamp:
09/30/13 10:59:51 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Children:
2164:ea097afa23e4, 2166:6f409aa25386
Message:

[pageTabs] when using history (back button) until hash is empty, it didn't open default tab. Fix it.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/js/jquery/jquery.pageTabs.js

    r2113 r2162  
    7272      
    7373     $.pageTabs.clickTab = function(tab) { 
     74          if (tab=='') { 
     75               tab = getHash($('ul li a', '.'+$.pageTabs.options.containerClass+':eq(0)').attr('href')); 
     76          } 
     77 
    7478          $('ul li a', '.'+$.pageTabs.options.containerClass).filter(function() { 
    7579               return getHash($(this).attr('href'))==tab; 
  • tests/functional/spec/page_tabs.js

    r2113 r2162  
    131131          expect($('#part-user-favorites')).not.toBeVisible(); 
    132132     }); 
     133 
     134     it("Must open first tab when clicking back until hash is empty", function() { 
     135          loadFixtures('tabs.html'); 
     136          loadStyleFixtures('default.css'); 
     137 
     138          var navigation = ['', 'user-profile', 'user-favorites']; 
     139          var current_index = 0; 
     140 
     141          $.pageTabs(); 
     142          current_index++; 
     143          $.pageTabs.clickTab(navigation[current_index]); 
     144          // tab is now user-profile 
     145 
     146          // simulate back : window.history.back(); 
     147          current_index--; 
     148          spyOn(jQuery.pageTabs, 'getLocationHash').andReturn(navigation[current_index]); 
     149          jQuery.event.trigger('hashchange'); 
     150 
     151          expect($('#part-user-options')).toBeVisible(); 
     152          expect($('#part-user-profile')).not.toBeVisible(); 
     153          expect($('#part-user-favorites')).not.toBeVisible(); 
     154     }); 
    133155}); 
    134156 
Note: See TracChangeset for help on using the changeset viewer.

Sites map