2017-09-25 19:59:44 +01:00
|
|
|
|
import { ApiPage } from './api.po';
|
|
|
|
|
|
|
|
|
|
describe('Api pages', function() {
|
|
|
|
|
it('should show direct subclasses of a class', () => {
|
|
|
|
|
const page = new ApiPage('api/forms/AbstractControlDirective');
|
2017-11-02 21:31:31 +02:00
|
|
|
|
expect(page.getDescendants('class', true)).toEqual(['ControlContainer', 'NgControl']);
|
2017-09-25 19:59:44 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should show direct and indirect subclasses of a class', () => {
|
|
|
|
|
const page = new ApiPage('api/forms/AbstractControlDirective');
|
2017-11-02 21:31:31 +02:00
|
|
|
|
expect(page.getDescendants('class')).toEqual(['ControlContainer', 'AbstractFormGroupDirective', 'NgControl']);
|
2017-09-25 19:59:44 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should show child interfaces that extend an interface', () => {
|
|
|
|
|
const page = new ApiPage('api/forms/Validator');
|
2017-11-02 21:31:31 +02:00
|
|
|
|
expect(page.getDescendants('interface')).toEqual(['AsyncValidator']);
|
2017-09-25 19:59:44 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should show classes that implement an interface', () => {
|
|
|
|
|
const page = new ApiPage('api/animations/AnimationPlayer');
|
2017-11-02 21:31:31 +02:00
|
|
|
|
expect(page.getDescendants('class')).toEqual(['NoopAnimationPlayer', 'MockAnimationPlayer']);
|
2017-09-25 19:59:44 +01:00
|
|
|
|
});
|
2017-09-28 13:01:37 +01:00
|
|
|
|
|
|
|
|
|
it('should show type params of type-aliases', () => {
|
|
|
|
|
const page = new ApiPage('api/common/http/HttpEvent');
|
|
|
|
|
expect(page.getOverview('type-alias').getText()).toContain('type HttpEvent<T>');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should show readonly properties as getters', () => {
|
|
|
|
|
const page = new ApiPage('api/common/http/HttpRequest');
|
2017-11-28 13:02:33 +00:00
|
|
|
|
expect(page.getOverview('class').getText()).toContain('get body: T | null');
|
2017-09-28 13:01:37 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not show parenthesis for getters', () => {
|
|
|
|
|
const page = new ApiPage('api/core/NgModuleRef');
|
|
|
|
|
expect(page.getOverview('class').getText()).toContain('get injector: Injector');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should show both type and initializer if set', () => {
|
|
|
|
|
const page = new ApiPage('api/common/HashLocationStrategy');
|
|
|
|
|
expect(page.getOverview('class').getText()).toContain('path(includeHash: boolean = false): string');
|
|
|
|
|
});
|
2018-02-27 11:07:29 +02:00
|
|
|
|
|
|
|
|
|
it('should show a "Properties" section if there are public properties', () => {
|
|
|
|
|
const page = new ApiPage('api/core/ViewContainerRef');
|
|
|
|
|
expect(page.getSection('instance-properties').isPresent()).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not show a "Properties" section if there are only internal properties', () => {
|
|
|
|
|
const page = new ApiPage('api/forms/FormControl');
|
|
|
|
|
expect(page.getSection('instance-properties').isPresent()).toBe(false);
|
|
|
|
|
});
|
2017-09-25 19:59:44 +01:00
|
|
|
|
});
|