refactor(ct-angular): fix mount
Co-authored-by: Edouard Bozon <bozonedouard@gmail.com>
This commit is contained in:
parent
12ed2e761a
commit
c27a034d8a
|
|
@ -87,12 +87,12 @@ const __pwFixtureRegistry = new Map();
|
||||||
* @param {Component} component
|
* @param {Component} component
|
||||||
*/
|
*/
|
||||||
async function __pwRenderComponent(component) {
|
async function __pwRenderComponent(component) {
|
||||||
const Component = await __pwResolveComponent(component);
|
const componentClass = component.type;
|
||||||
if (!Component)
|
if (!componentClass)
|
||||||
throw new Error(`Unregistered component: ${component.type}. Following components are registered: ${[...__pwRegistry.keys()]}`);
|
throw new Error(`Unregistered component: ${componentClass}. Following components are registered: ${[...__pwRegistry.keys()]}`);
|
||||||
|
|
||||||
|
|
||||||
const componentMetadata = reflectComponentType(Component);
|
const componentMetadata = reflectComponentType(componentClass);
|
||||||
if (!componentMetadata?.isStandalone)
|
if (!componentMetadata?.isStandalone)
|
||||||
throw new Error('Only standalone components are supported');
|
throw new Error('Only standalone components are supported');
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ async function __pwRenderComponent(component) {
|
||||||
})(class {});
|
})(class {});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [Component],
|
imports: [componentClass],
|
||||||
declarations: [WrapperComponent]
|
declarations: [WrapperComponent]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -124,9 +124,10 @@ async function __pwRenderComponent(component) {
|
||||||
return fixture;
|
return fixture;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function __pwResolveComponent(component) {
|
// async function __pwResolveComponent(component) {
|
||||||
return await window.__pwRegistry.resolveImportRef(component.type);
|
// // const component = await window.__pwRegistry.resolveImportRef(component.type);
|
||||||
}
|
// return await
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@angular/core/testing').ComponentFixture} fixture
|
* @param {import('@angular/core/testing').ComponentFixture} fixture
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue