Skip to content

Commit f75917f

Browse files
committed
Add tests
1 parent ef440d3 commit f75917f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/tests/Base/utils.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@ describe('The `addToRegistry` helper', () => {
142142
}
143143
});
144144

145+
it('should register child components', async () => {
146+
const registry = (globalThis.__JS_TOOLKIT_REGISTRY__ ??= new Map());
147+
const Child = withName(Base, 'Child');
148+
const Parent = withName(Base, 'Parent');
149+
Parent.config.components = { Child, div: Child };
150+
151+
addToRegistry('Parent', Parent);
152+
153+
expect(registry.has('Parent')).toBe(true);
154+
expect(registry.get('Parent')).toBe(Parent);
155+
156+
expect(registry.has('Child')).toBe(true);
157+
expect(registry.get('Child')).toBe(Child);
158+
159+
expect(registry.has('div')).toBe(true);
160+
expect(registry.get('div')).toBe(Child);
161+
});
162+
145163
it('should mount components newly injected in the DOM', async () => {
146164
const DynamicComponent = withName(Base, 'DynamicComponent');
147165

0 commit comments

Comments
 (0)