From c2c1c45add757629efbc161250b109a7f1cba0e5 Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Sat, 22 Oct 2016 17:17:48 +0200 Subject: [PATCH] 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. --- js/foundation.interchange.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; } -- 2.47.2