]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
added external href test for tabs
authorMatt Scheurich <matt@lvl99.com>
Tue, 5 Sep 2017 12:19:38 +0000 (14:19 +0200)
committerMatt Scheurich <matt@lvl99.com>
Tue, 5 Sep 2017 12:19:38 +0000 (14:19 +0200)
test/javascript/components/tabs.js

index 1d4157ea405d99f4c71f2826f7f7f033324cc81d..f0a06c4fd5b141adf259dfe5f526889e3a23c66e 100644 (file)
@@ -78,6 +78,7 @@ describe('Tabs', function() {
       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]'), {});
@@ -85,6 +86,36 @@ describe('Tabs', function() {
       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() {