]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
test: check the Drilldrown wrapper height instead of the element height
authorNicolas Coden <nicolas@ncoden.fr>
Tue, 31 Jul 2018 22:24:36 +0000 (00:24 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Tue, 31 Jul 2018 22:24:36 +0000 (00:24 +0200)
Test the dynamic height of the wrapper instead of the static height of the element (data-drilldrown inside the wrapper).

test/javascript/components/drilldown.js

index 9d805a7a1d714dbbccbde4c130d6b72c2e2bf903..f8f8bd8689f19abab7b3ff678ef7d7b50e053cd5 100644 (file)
@@ -230,23 +230,25 @@ describe('Drilldown Menu', function() {
   describe('toggle events', function () {
 
     this.timeout(0);
-    var $trigger, $target, $menu, togglerPlugin;
+    var $trigger, $target, $wrapper, togglerPlugin;
 
     beforeEach(function () {
       $html = $(templateWithToggler).appendTo('body');
       $trigger = $html.find('#trigger');
       $target = $html.find('#target');
-      $menu = $html.find('#m1');
+      $target = $html.find('#target');
 
       togglerPlugin = new Foundation.Toggler($target, {});
-      plugin = new Foundation.Drilldown($menu, {});
+      plugin = new Foundation.Drilldown($html.find('[data-drilldown]'), { autoHeight: true });
+
+      $wrapper = $html.find('.is-drilldown');
     });
 
     it('correctly resize when opened', function () {
       // Open the Drilldown
       $trigger.focus().trigger('click');
 
-      $menu.height().should.be.within(110, 120);
+      $wrapper.height().should.be.within(110, 120);
     });
 
     it('correctly resize when closed', function () {
@@ -254,7 +256,7 @@ describe('Drilldown Menu', function() {
       $trigger.focus().trigger('click');
       $trigger.focus().trigger('click');
 
-      $menu.height().should.be.equal(0);
+      $wrapper.height().should.be.equal(0);
     });
 
     afterEach(function () {