From 7485a60d0a258ebef1e88b06cd55152e828b7c18 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 27 Feb 2019 15:57:01 -0800 Subject: [PATCH] Avoid Array.fill --- test/unit/debounce.html | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/test/unit/debounce.html b/test/unit/debounce.html index 1c6e1520e5..f2fbc81935 100644 --- a/test/unit/debounce.html +++ b/test/unit/debounce.html @@ -216,16 +216,22 @@ const timeoutCallback = sinon.spy(() => actualCallbacks.push(timeoutCallback)); Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.timeOut, timeoutCallback)); // Set of short-running debouncers enqueued in the middle of first set - const nestedCallbacks = new Array(150).fill().map((_, i) => sinon.spy(() => - actualCallbacks.push(nestedCallbacks[i]))); + const nestedCallbacks = []; + for (let i=0; i<150; i++) { + nestedCallbacks.push(sinon.spy(() => + actualCallbacks.push(nestedCallbacks[i]))); + } // First set of short-running debouncers - const microtaskCallbacks = new Array(150).fill().map((_, i) => sinon.spy(() => { - actualCallbacks.push(microtaskCallbacks[i]); - if (i === 125) { - nestedCallbacks.forEach(cb => - Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb))); - } - })); + const microtaskCallbacks = []; + for (let i=0; i<150; i++) { + microtaskCallbacks.push(sinon.spy(() => { + actualCallbacks.push(microtaskCallbacks[i]); + if (i === 125) { + nestedCallbacks.forEach(cb => + Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb))); + } + })); + } microtaskCallbacks.forEach(cb => Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb))); // Expect short before long