]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
test: fix offcanvas close test
authorDaniel Ruf <mac1@daniel-ruf.de>
Sat, 2 Nov 2019 22:19:59 +0000 (23:19 +0100)
committerDaniel Ruf <mac1@daniel-ruf.de>
Sat, 2 Nov 2019 22:20:31 +0000 (23:20 +0100)
test/javascript/components/offcanvas.js

index cb9b2a6564f5e55908a0843411f6a50b9d3ab951..d688047b5da52600eb283a19d6f5cd276dc2f7e8 100644 (file)
@@ -284,11 +284,12 @@ describe('Off Canvas', function() {
       $html = $(template).appendTo('body');
       plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
 
-      $html.one('opened.zf.offCanvas', function() {
+      $html.one('openedEnd.zf.offCanvas', function() {
+        $html.one('closed.zf.offCanvas', function () {
+          plugin.$element.should.not.have.class('is-open');
+          done();
+        });
         plugin.toggle();
-
-        plugin.$element.should.not.have.class('is-open');
-        done();
       });
 
       // Open it first
@@ -306,7 +307,9 @@ describe('Off Canvas', function() {
           .trigger(window.mockKeyboardEvent('ESCAPE'));
 
         plugin.$element.should.not.have.class('is-open');
-        done();
+        $html.one('closed.zf.offCanvas', function () {
+          done();
+        });
       });
 
       // Open it first