mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 18:43:43 +03:00
fix tests
This commit is contained in:
parent
186ce7ab6f
commit
17dc1c46df
|
@ -23,11 +23,15 @@ describe('Redoc components', () => {
|
||||||
fixture = builder.createSync(TestAppComponent);
|
fixture = builder.createSync(TestAppComponent);
|
||||||
let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema-lazy');
|
let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema-lazy');
|
||||||
component = <JsonSchemaLazy>debugEl.componentInstance;
|
component = <JsonSchemaLazy>debugEl.componentInstance;
|
||||||
spyOn(component, '_loadAfterSelf').and.stub();
|
spyOn(component, '_loadAfterSelf').and.callThrough();
|
||||||
|
spyOn(component.resolver, 'resolveComponent').and.returnValue({ then: () => {
|
||||||
|
return { catch: () => {/**/} };
|
||||||
|
}});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
component._loadAfterSelf.and.callThrough();
|
component._loadAfterSelf.and.callThrough();
|
||||||
|
component.resolver.resolveComponent.and.callThrough();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should init component', () => {
|
it('should init component', () => {
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadAfterSelf() {
|
_loadAfterSelf() {
|
||||||
// FIXME: get rid of DynamicComponentLoader as it is deprecated
|
this.loaded = true;
|
||||||
return this.resolver.resolveComponent(JsonSchema).then(componentFactory => {
|
return this.resolver.resolveComponent(JsonSchema).then(componentFactory => {
|
||||||
let contextInjector = this.location.parentInjector;
|
let contextInjector = this.location.parentInjector;
|
||||||
let compRef = this.location.createComponent(
|
let compRef = this.location.createComponent(
|
||||||
|
@ -42,7 +42,6 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
|
||||||
this.initComponent(compRef.instance);
|
this.initComponent(compRef.instance);
|
||||||
this._renderer.setElementAttribute(compRef.location.nativeElement, 'class', this.location.element.nativeElement.className);
|
this._renderer.setElementAttribute(compRef.location.nativeElement, 'class', this.location.element.nativeElement.className);
|
||||||
compRef.changeDetectorRef.detectChanges();
|
compRef.changeDetectorRef.detectChanges();
|
||||||
this.loaded = true;
|
|
||||||
return compRef;
|
return compRef;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user