Dotclear

Changeset 2471:c1ec37564ab9


Ignore:
Timestamp:
10/21/13 16:45:01 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
2.6
Message:

Must not change tab when ones if openend and clicking an anchor
Add tests.
Closes #1794

Files:
2 edited

Legend:

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

    r2457 r2471  
    7474      
    7575     $.pageTabs.clickTab = function(tab) { 
    76           if (tab=='' || $('#'+$.pageTabs.options.idTabPrefix+tab, '.'+$.pageTabs.options.containerClass).length==0) { 
     76          if (tab=='') { 
     77               tab = getHash($('ul li a', '.'+$.pageTabs.options.containerClass+':eq(0)').attr('href')); 
     78          } else if (($('#'+$.pageTabs.options.idTabPrefix+tab, '.'+$.pageTabs.options.containerClass).length==0) 
     79                  && ($('ul li.'+$.pageTabs.options.activeClass, '.'+$.pageTabs.options.containerClass).length==0)){ 
    7780               tab = getHash($('ul li a', '.'+$.pageTabs.options.containerClass+':eq(0)').attr('href')); 
    7881          } 
  • tests/functional/spec/page_tabs.js

    r2348 r2471  
    154154     }); 
    155155 
     156     /* ticket 1794 */ 
     157     /* 
     158      * The problem occurs when cliking an anchor in the page  
     159      */ 
     160     it("Must not change opened tab when hash does not refer to an existing div content", function() { 
     161          loadFixtures('tabs.html'); 
     162          loadStyleFixtures('default.css'); 
     163           
     164          $.pageTabs('user-profile'); 
     165          expect($('#part-user-options')).not.toBeVisible(); 
     166          expect($('#part-user-profile')).toBeVisible(); 
     167          expect($('#part-user-favorites')).not.toBeVisible(); 
     168 
     169          spyOn(jQuery.pageTabs, 'getLocationHash').andReturn('dummy'); 
     170          jQuery.event.trigger('hashchange'); 
     171          expect($('#part-user-options')).not.toBeVisible(); 
     172          expect($('#part-user-profile')).toBeVisible(); 
     173          expect($('#part-user-favorites')).not.toBeVisible(); 
     174     }); 
     175 
    156176     /* ticket 1723 */ 
    157      it("Must open first tab when hash does not refer to an existing div content", function() { 
     177     it("Must open first tab when hash does not refer to an existing div content and no tab is opened", function() { 
    158178          loadFixtures('tabs.html'); 
    159179          loadStyleFixtures('default.css'); 
     
    164184          expect($('#part-user-profile')).not.toBeVisible(); 
    165185          expect($('#part-user-favorites')).not.toBeVisible(); 
    166      }); 
     186     });   
    167187}); 
    168188 
Note: See TracChangeset for help on using the changeset viewer.

Sites map