Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions packages/@glimmer-workspace/integration-tests/lib/render-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export class RenderTest implements IRenderTest {
let key = Array.isArray(items[index]) ? items[index][0] : index;
let value = Array.isArray(items[index]) ? items[index][1] : items[index];

QUnit.assert.equal(el.textContent, `${key}.${value}`);
QUnit.assert.equal(el.textContent, `${key}.${value}`, `Comparing the rendered key.value`);
}
);
}
Expand Down Expand Up @@ -497,7 +497,10 @@ export class RenderTest implements IRenderTest {
}

protected assertEachInReactivity(
Klass: new (...args: any[]) => { collection: number[]; update: () => void }
Klass: new (...args: any[]) => {
collection: (string | number)[] | Map<unknown, string | number>;
update: () => void;
}
) {
let instance: TestComponent | undefined;

Expand Down Expand Up @@ -533,20 +536,31 @@ export class RenderTest implements IRenderTest {
let { collection } = instance;

this.assertEachCompareResults(
Symbol.iterator in collection ? Array.from(collection) : Object.entries(collection)
Symbol.iterator in collection
? Array.from(collection as string[])
: Object.entries(collection)
);

instance.update();

this.rerender();

this.assertEachCompareResults(
Symbol.iterator in collection ? Array.from(collection) : Object.entries(collection)
Symbol.iterator in collection
? Array.from(collection as string[])
: Object.entries(collection)
);
}

protected assertEachReactivity(
Klass: new (...args: any[]) => { collection: number[]; update: () => void }
Klass: new (...args: any[]) => {
collection:
| (string | number)[]
| Set<number | string>
| Map<unknown, unknown>
| Record<string, unknown>;
update: () => void;
}
) {
let instance: TestComponent | undefined;

Expand Down Expand Up @@ -579,13 +593,23 @@ export class RenderTest implements IRenderTest {
throw new Error('The instance is not defined');
}

this.assertEachCompareResults(Array.from(instance.collection).map((v, i) => [i, v]));
function getEntries() {
if (!instance) return [];

if (instance.collection instanceof Map) {
return Array.from(instance.collection.entries());
}

return Array.from(instance.collection as (string | number)[]);
Comment thread
NullVoxPopuli marked this conversation as resolved.
Outdated
}

this.assertEachCompareResults((getEntries() as string[]).map((v, i) => [i, v]));

instance.update();

this.rerender();

this.assertEachCompareResults(Array.from(instance.collection).map((v, i) => [i, v]));
this.assertEachCompareResults((getEntries() as string[]).map((v, i) => [i, v]));

this.assertStableRerender();
}
Expand Down
Loading
Loading