Skip to content

Commit

Permalink
Avoid syntax that is not IE11 compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Dec 4, 2020
1 parent 3c0a25e commit 8269910
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ export function registerHook(helperName: string, label: HookLabel, hook: Hook):
*/
export function runHooks(helperName: string, label: HookLabel, ...args: any[]): Promise<void> {
let hooks = registeredHooks.get(getHelperKey(helperName, label)) || new Set<Hook>();
let promises = [...hooks].map(hook => hook(...args));
let promises = [];

hooks.forEach(hook => {
let hookResult = hook(...args);

promises.push(hookResult);
});

return Promise.all(promises).then(() => {});
}
2 changes: 1 addition & 1 deletion tests/unit/dom/click-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ module('DOM Helper: click', function (hooks) {

await setupContext(context);
assert.rejects(
click(`#${element.id}`, 'foo'),
click(`#${element.id}`),
new Error('Can not `click` disabled [object HTMLInputElement]')
);
});
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/setup-context-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,10 @@ module('setupContext', function (hooks) {
await teardownContext(context);
}
} finally {
let lastChild = rootEl().lastChild;
// Don't leave #ember-testing polluted for other tests
if (rootEl().lastChild) {
rootEl().lastChild.remove();
if (lastChild) {
rootEl().removeChild(lastChild);
}
}
});
Expand Down
13 changes: 11 additions & 2 deletions tests/unit/utils/test-isolation-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,23 @@ export function getMockDebugInfo(autorun = null, timersCount = 0, queues) {
debugInfo.autorun = autorun;
}

debugInfo.timers = Array(timersCount).fill(queueItem, 0, timersCount);
let timers = [];
for (let i = 0; i < timersCount; i++) {
timers.push(queueItem);
}
debugInfo.timers = timers;

let instanceStack = {};
debugInfo.instanceStack = [instanceStack];

queues &&
queues.forEach(queue => {
instanceStack[queue.name] = Array(queue.count).fill(queueItem, 0, queue.count);
let queueValue = [];
for (let i = 0; i < queue.count; i++) {
queueValue.push(queueItem);
}

instanceStack[queue.name] = queueValue;
});

return debugInfo;
Expand Down

0 comments on commit 8269910

Please sign in to comment.