]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Adjusted tests for Toggler because they interfered with the tests for Reveal.
authorMarius Olbertz <marius.olbertz@gmail.com>
Sun, 2 Oct 2016 09:36:41 +0000 (11:36 +0200)
committerMarius Olbertz <marius.olbertz@gmail.com>
Sun, 2 Oct 2016 09:36:41 +0000 (11:36 +0200)
The global [data-open] query used failed for the Reveal anchor.

test/javascript/components/toggler.js

index 12538c17e1ee701234c63e69fe98241e0e5299d3..e55817b370e41d26b1bcc585cadfadbe2725dd86 100644 (file)
@@ -42,16 +42,16 @@ describe('Toggler', function() {
 
     it('adds Aria attributes to click triggers', function() {
       $html = $('<div id="toggler" data-toggler="class"></div>').appendTo('body');
-      var $triggers = $(`
-        <a data-open="toggler">Open</a>
-        <a data-close="toggler">Close</a>
-        <a data-toggle="toggler">Toggle</a>
-        `).appendTo('body');
+      var $triggers = $(`<div>
+          <a data-open="toggler">Open</a>
+          <a data-close="toggler">Close</a>
+          <a data-toggle="toggler">Toggle</a>
+        </div>`).appendTo('body');
       plugin = new Foundation.Toggler($html, {});
 
-      $('[data-open]').should.have.attr('aria-controls', 'toggler');
-      $('[data-close]').should.have.attr('aria-controls', 'toggler');
-      $('[data-toggle]').should.have.attr('aria-controls', 'toggler');
+      $triggers.find('[data-open]').should.have.attr('aria-controls', 'toggler');
+      $triggers.find('[data-close]').should.have.attr('aria-controls', 'toggler');
+      $triggers.find('[data-toggle]').should.have.attr('aria-controls', 'toggler');
 
       $triggers.remove();
     });