redoc/lib/components/JsonSchema/json-schema-lazy.spec.ts

56 lines
1.3 KiB
TypeScript
Raw Normal View History

'use strict';
2016-06-12 20:44:34 +03:00
import { getChildDebugElement } from '../../../tests/helpers';
2016-07-01 15:53:16 +03:00
import { Component } from '@angular/core';
import {
inject,
2016-09-02 23:18:31 +03:00
TestBed
2016-05-06 00:48:41 +03:00
} from '@angular/core/testing';
2016-06-12 20:44:34 +03:00
import { JsonSchemaLazy } from './json-schema-lazy';
describe('Redoc components', () => {
2016-09-02 23:18:31 +03:00
beforeEach(() => {
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
});
describe('JsonSchemaLazy Component', () => {
let builder;
let component;
let fixture;
2016-07-01 15:53:16 +03:00
beforeEach(() => {
2016-09-02 23:18:31 +03:00
fixture = TestBed.createComponent(TestAppComponent);
2016-07-01 15:53:16 +03:00
let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema-lazy');
component = <JsonSchemaLazy>debugEl.componentInstance;
2016-08-22 12:12:13 +03:00
spyOn(component, '_loadAfterSelf').and.stub();
2016-07-01 15:53:16 +03:00
});
afterEach(() => {
component._loadAfterSelf.and.callThrough();
});
it('should init component', () => {
expect(component).not.toBeNull();
});
it('should run loadNextToLocation on load', () => {
component.pointer = '#/def';
fixture.detectChanges();
component.load();
2016-06-29 19:06:42 +03:00
expect(component._loadAfterSelf).toHaveBeenCalled();
});
});
});
/** Test component that contains a Method. */
@Component({
selector: 'test-app',
template:
`<json-schema-lazy></json-schema-lazy>`
})
2016-06-13 20:54:24 +03:00
class TestAppComponent {
}