]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
test: add OffCanvas tests for openedEnd and closedEnd events 10408/head
authorNicolas Coden <nicolas@ncoden.fr>
Fri, 7 Sep 2018 06:36:45 +0000 (08:36 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Fri, 7 Sep 2018 06:36:45 +0000 (08:36 +0200)
test/javascript/components/offcanvas.js

index aa7ad5586c36b066978f4f71d1a138c98fe6b423..15f32d55e30bd0fc2d1e93cd55d744e120b246d4 100644 (file)
@@ -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 });