From 1c4cb12e59ed08c96c39e7a5409ae566534d32c7 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Fri, 7 Sep 2018 08:36:45 +0200 Subject: [PATCH] test: add OffCanvas tests for openedEnd and closedEnd events --- test/javascript/components/offcanvas.js | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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 }); -- 2.47.2