From: Marius Olbertz Date: Sat, 22 Oct 2016 15:17:48 +0000 (+0200) Subject: Rewrite event listener to make spying possible. X-Git-Tag: v6.3-rc1~47^2~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9286%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Rewrite event listener to make spying possible. Arrow notation makes `bind(this)` statement obsolete, so it can be replaced with an anonymous function calling `_reflow()`, which allows using a `sinon.spy` during the unit tests. --- diff --git a/js/foundation.interchange.js b/js/foundation.interchange.js index 2e5b969a6..b43fe93ec 100644 --- a/js/foundation.interchange.js +++ b/js/foundation.interchange.js @@ -46,7 +46,9 @@ class Interchange { * @private */ _events() { - $(window).on('resize.zf.interchange', Foundation.util.throttle(this._reflow.bind(this), 50)); + $(window).on('resize.zf.interchange', Foundation.util.throttle(() => { + this._reflow(); + }, 50)); } /** @@ -61,7 +63,6 @@ class Interchange { for (var i in this.rules) { if(this.rules.hasOwnProperty(i)) { var rule = this.rules[i]; - if (window.matchMedia(rule.query).matches) { match = rule; }