From: Daniel Ruf Date: Sat, 2 Nov 2019 22:57:15 +0000 (+0100) Subject: test: fix offcanvas race condition X-Git-Tag: v6.6.2^2~42^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11901%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git test: fix offcanvas race condition --- diff --git a/test/javascript/components/offcanvas.js b/test/javascript/components/offcanvas.js index d688047b5..34571ba89 100644 --- a/test/javascript/components/offcanvas.js +++ b/test/javascript/components/offcanvas.js @@ -302,14 +302,14 @@ describe('Off Canvas', function() { $html = $(template).appendTo('body'); plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {}); - $html.one('opened.zf.offCanvas', function() { - plugin.$element.focus() - .trigger(window.mockKeyboardEvent('ESCAPE')); - - plugin.$element.should.not.have.class('is-open'); + $html.one('openedEnd.zf.offCanvas', function() { $html.one('closed.zf.offCanvas', function () { + plugin.$element.should.not.have.class('is-open'); done(); }); + + plugin.$element.focus() + .trigger(window.mockKeyboardEvent('ESCAPE')); }); // Open it first