]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
properly camelcase offCanvas and smoothScroll events
authorDaniel Ruf <daniel@daniel-ruf.de>
Mon, 26 Feb 2018 23:00:37 +0000 (00:00 +0100)
committerDaniel Ruf <daniel@daniel-ruf.de>
Mon, 26 Feb 2018 23:00:37 +0000 (00:00 +0100)
js/foundation.offcanvas.js
js/foundation.smoothScroll.js
test/javascript/components/offcanvas.js

index 995bf91d4036568f3e865a33f5dbd0cb6faa64f8..06076eac89c63697057be6be2a441b7a0edf4d3a 100644 (file)
@@ -10,7 +10,7 @@ import { Triggers } from './foundation.util.triggers';
 
 /**
  * OffCanvas module.
- * @module foundation.offcanvas
+ * @module foundation.offCanvas
  * @requires foundation.util.keyboard
  * @requires foundation.util.mediaQuery
  * @requires foundation.util.triggers
@@ -146,16 +146,16 @@ class OffCanvas extends Plugin {
    * @private
    */
   _events() {
-    this.$element.off('.zf.trigger .zf.offcanvas').on({
+    this.$element.off('.zf.trigger .zf.offCanvas').on({
       'open.zf.trigger': this.open.bind(this),
       'close.zf.trigger': this.close.bind(this),
       'toggle.zf.trigger': this.toggle.bind(this),
-      'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
+      'keydown.zf.offCanvas': this._handleKeyboard.bind(this)
     });
 
     if (this.options.closeOnClick === true) {
       var $target = this.options.contentOverlay ? this.$overlay : this.$content;
-      $target.on({'click.zf.offcanvas': this.close.bind(this)});
+      $target.on({'click.zf.offCanvas': this.close.bind(this)});
     }
   }
 
@@ -172,7 +172,7 @@ class OffCanvas extends Plugin {
       } else {
         _this.reveal(false);
       }
-    }).one('load.zf.offcanvas', function() {
+    }).one('load.zf.offCanvas', function() {
       if (MediaQuery.atLeast(_this.options.revealOn)) {
         _this.reveal(true);
       }
@@ -233,7 +233,7 @@ class OffCanvas extends Plugin {
   }
 
   /**
-   * Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers.
+   * Stops scrolling of the body when OffCanvas is open on mobile Safari and other troublesome browsers.
    * @private
    */
   _stopScrolling(event) {
@@ -309,7 +309,7 @@ class OffCanvas extends Plugin {
 
     this.$triggers.attr('aria-expanded', 'true');
     this.$element.attr('aria-hidden', 'false')
-        .trigger('opened.zf.offcanvas');
+        .trigger('opened.zf.offCanvas');
 
     this.$content.addClass('is-open-' + this.position);
 
@@ -368,7 +368,7 @@ class OffCanvas extends Plugin {
        * Fires when the off-canvas menu opens.
        * @event OffCanvas#closed
        */
-        .trigger('closed.zf.offcanvas');
+        .trigger('closed.zf.offCanvas');
 
     this.$content.removeClass('is-open-left is-open-top is-open-right is-open-bottom');
 
@@ -436,13 +436,13 @@ class OffCanvas extends Plugin {
   }
 
   /**
-   * Destroys the offcanvas plugin.
+   * Destroys the OffCanvas plugin.
    * @function
    */
   _destroy() {
     this.close();
-    this.$element.off('.zf.trigger .zf.offcanvas');
-    this.$overlay.off('.zf.offcanvas');
+    this.$element.off('.zf.trigger .zf.offCanvas');
+    this.$overlay.off('.zf.offCanvas');
   }
 }
 
@@ -496,7 +496,7 @@ OffCanvas.defaults = {
   transitionTime: null,
 
   /**
-   * Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'.
+   * Type of transition for the OffCanvas menu. Options are 'push', 'detached' or 'slide'.
    * @option
    * @type {string}
    * @default push
@@ -512,7 +512,7 @@ OffCanvas.defaults = {
   forceTo: null,
 
   /**
-   * Allow the offcanvas to remain open for certain breakpoints.
+   * Allow the OffCanvas to remain open for certain breakpoints.
    * @option
    * @type {boolean}
    * @default false
@@ -528,7 +528,7 @@ OffCanvas.defaults = {
   revealOn: null,
 
   /**
-   * Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
+   * Force focus to the OffCanvas on open. If true, will focus the opening trigger on close.
    * @option
    * @type {boolean}
    * @default true
@@ -536,7 +536,7 @@ OffCanvas.defaults = {
   autoFocus: true,
 
   /**
-   * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
+   * Class used to force an OffCanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
    * @option
    * @type {string}
    * @default reveal-for-
@@ -545,7 +545,7 @@ OffCanvas.defaults = {
   revealClass: 'reveal-for-',
 
   /**
-   * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
+   * Triggers optional focus trapping when opening an OffCanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
    * @option
    * @type {boolean}
    * @default false
index bec7cebc104a18144cfbc318976463e5e2adc4ef..5f15c9cd0b731221f5d9b078391caf9d396f8458 100644 (file)
@@ -6,7 +6,7 @@ import { Plugin } from './foundation.plugin';
 
 /**
  * SmoothScroll module.
- * @module foundation.smooth-scroll
+ * @module foundation.smoothScroll
  */
 class SmoothScroll extends Plugin {
   /**
index a031723316844bd91d57625e9ce1eb592cc7f9fc..d4a74f22bf76e0e0869aac0e4274bde1ed1b0834 100644 (file)
@@ -70,7 +70,7 @@ describe('Off Canvas', function() {
 
       plugin.$overlay.should.be.an('object');
 
-      $html.one('opened.zf.offcanvas', function() {
+      $html.one('opened.zf.offCanvas', function() {
         plugin.$overlay.trigger('click');
         plugin.$element.should.not.have.class('is-open');
         done();
@@ -86,7 +86,7 @@ describe('Off Canvas', function() {
       plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
 
       //$html.one(Foundation.transitionend($html), function() {
-      $html.one('opened.zf.offcanvas', function() {
+      $html.one('opened.zf.offCanvas', function() {
         plugin.$triggers.should.have.attr('aria-expanded', 'true');
         plugin.$element.should.have.attr('aria-hidden', 'false');
         done();
@@ -99,7 +99,7 @@ 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('opened.zf.offCanvas', function() {
         setTimeout(function() {
           plugin.$element.should.have.class('is-open');
           $('body').should.have.class('is-off-canvas-open');
@@ -143,11 +143,11 @@ describe('Off Canvas', function() {
     });
 
 
-    it('fires opened.zf.offcanvas event', function(done) {
+    it('fires opened.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('opened.zf.offCanvas', function() {
         done();
       });
 
@@ -160,7 +160,7 @@ 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('opened.zf.offCanvas', function() {
         plugin.close();
 
         plugin.$triggers.should.have.attr('aria-expanded', 'false');
@@ -176,7 +176,7 @@ 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('opened.zf.offCanvas', function() {
         setTimeout(function() {
           plugin.close();
 
@@ -190,12 +190,12 @@ describe('Off Canvas', function() {
       plugin.open();
     });
 
-    it('fires closed.zf.offcanvas event', function(done) {
+    it('fires closed.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('closed.zf.offcanvas', function() {
+      $html.one('opened.zf.offCanvas', function() {
+        $html.one('closed.zf.offCanvas', function() {
           done();
         });
 
@@ -229,7 +229,7 @@ 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('opened.zf.offCanvas', function() {
         plugin.$element.should.have.class('is-open');
         done();
       });
@@ -241,7 +241,7 @@ 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('opened.zf.offCanvas', function() {
         plugin.toggle();
 
         plugin.$element.should.not.have.class('is-open');
@@ -258,7 +258,7 @@ 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('opened.zf.offCanvas', function() {
         plugin.$element.focus()
           .trigger(window.mockKeyboardEvent('ESCAPE'));