Skip to content

Commit 7485a60

Browse files
committed
Avoid Array.fill
1 parent f4df466 commit 7485a60

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

test/unit/debounce.html

+15-9
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,22 @@
216216
const timeoutCallback = sinon.spy(() => actualCallbacks.push(timeoutCallback));
217217
Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.timeOut, timeoutCallback));
218218
// Set of short-running debouncers enqueued in the middle of first set
219-
const nestedCallbacks = new Array(150).fill().map((_, i) => sinon.spy(() =>
220-
actualCallbacks.push(nestedCallbacks[i])));
219+
const nestedCallbacks = [];
220+
for (let i=0; i<150; i++) {
221+
nestedCallbacks.push(sinon.spy(() =>
222+
actualCallbacks.push(nestedCallbacks[i])));
223+
}
221224
// First set of short-running debouncers
222-
const microtaskCallbacks = new Array(150).fill().map((_, i) => sinon.spy(() => {
223-
actualCallbacks.push(microtaskCallbacks[i]);
224-
if (i === 125) {
225-
nestedCallbacks.forEach(cb =>
226-
Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb)));
227-
}
228-
}));
225+
const microtaskCallbacks = [];
226+
for (let i=0; i<150; i++) {
227+
microtaskCallbacks.push(sinon.spy(() => {
228+
actualCallbacks.push(microtaskCallbacks[i]);
229+
if (i === 125) {
230+
nestedCallbacks.forEach(cb =>
231+
Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb)));
232+
}
233+
}));
234+
}
229235
microtaskCallbacks.forEach(cb =>
230236
Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb)));
231237
// Expect short before long

0 commit comments

Comments
 (0)