From: Nicolas Coden Date: Fri, 7 Sep 2018 06:36:45 +0000 (+0200) Subject: test: add OffCanvas tests for openedEnd and closedEnd events X-Git-Tag: v6.6.0~3^2~25^2^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10408%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git test: add OffCanvas tests for openedEnd and closedEnd events --- diff --git a/test/javascript/components/offcanvas.js b/test/javascript/components/offcanvas.js index aa7ad5586..15f32d55e 100644 --- a/test/javascript/components/offcanvas.js +++ b/test/javascript/components/offcanvas.js @@ -146,6 +146,19 @@ describe('Off Canvas', function() { plugin.open(); }); + + it('fires openedEnd.zf.offCanvas event', function(done) { + $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 () { + done(); + }); + }); + + plugin.open(); + }); }); describe('close()', function() { @@ -196,6 +209,22 @@ describe('Off Canvas', function() { plugin.open(); }); + it('fires closedEnd.zf.offCanvas event', function(done) { + $html = $(template).appendTo('body'); + plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {}); + + $html.one('openedEnd.zf.offCanvas', function() { + $html.one('closedEnd.zf.offCanvas', function() { + done(); + }); + + plugin.close(); + }); + + // Open it first + plugin.open(); + }); + it('releases focus if trapFocus option is true', function(done) { $html = $(template).appendTo('body'); plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), { trapFocus: true });