2016-01-24 22:27:15 +03:00
|
|
|
'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';
|
2016-01-24 22:27:15 +03:00
|
|
|
|
|
|
|
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';
|
2016-01-24 22:27:15 +03:00
|
|
|
|
|
|
|
describe('Redoc components', () => {
|
2016-09-02 23:18:31 +03:00
|
|
|
beforeEach(() => {
|
|
|
|
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
|
|
|
});
|
|
|
|
|
2016-01-24 22:27:15 +03:00
|
|
|
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();
|
2016-01-24 22:27:15 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
2016-01-24 22:27:15 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** Test component that contains a Method. */
|
2016-03-27 18:25:46 +03:00
|
|
|
@Component({
|
|
|
|
selector: 'test-app',
|
2016-01-24 22:27:15 +03:00
|
|
|
template:
|
|
|
|
`<json-schema-lazy></json-schema-lazy>`
|
|
|
|
})
|
2016-06-13 20:54:24 +03:00
|
|
|
class TestAppComponent {
|
2016-01-24 22:27:15 +03:00
|
|
|
}
|