plugin.selectTab('#panel2');
$html.find('#panel2').should.be.visible;
});
+
it('opens the selected tab with data-tabs-target attribute', function() {
$html = $(template).appendTo('body');
plugin = new Foundation.Tabs($html.find('[data-tabs]'), {});
plugin.selectTab('#/panel3');
$html.find('#panel3').should.be.visible;
});
+
+ it('opens the selected tab with data-tabs-target attribute and external href', function () {
+ $html = $(`
+ <div>
+ <ul class="tabs" data-tabs id="example-tabs">
+ <li class="tabs-title is-active"><a href="#panel1" aria-selected="true">Tab 1</a></li>
+ <li class="tabs-title"><a href="#panel2">Tab 2</a></li>
+ <li class="tabs-title"><a data-tabs-target="panel3" href="http://example.com">Tab 3</a></li>
+ </ul>
+
+ <div class="tabs-content" data-tabs-content="example-tabs">
+ <div class="tabs-panel is-active" id="panel1">
+ <p>one</p>
+ <p>Check me out! I'm a super cool Tab panel with text content!</p>
+ </div>
+ <div class="tabs-panel" id="panel2">
+ <p>two</p>
+ <p>Check me out! I'm a super cool Tab panel with text content!</p>
+ </div>
+ <div class="tabs-panel" id="panel3">
+ <p>three</p>
+ <p>Check me out! I'm a super cool Tab panel with text content!</p>
+ </div>
+ </div>
+ </div>`).appendTo('body');
+ plugin = new Foundation.Tabs($html.find('[data-tabs]'), {});
+
+ plugin.selectTab('#panel3');
+ $html.find('#panel3').should.be.visible;
+ })
});
describe('_handleTabChange()', function() {