Files
Paul Gschwendtner beda8f490c build: updates to account for github primary branch rename (#45717)
This is the commit accounting for the Github primary branch
rename when we actually perform the update.

We have three change phases: Prepare, Direct, Cleanup. This commit
is for the `direct` phase.

PR Close #45717
2022-04-28 17:27:37 +00:00

90 lines
3.6 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { ApiPage } from './api.po';
describe('Api pages', () => {
let page: ApiPage;
beforeEach(() => page = new ApiPage());
it('should show direct subclasses of a class', async () => {
await page.navigateTo('api/forms/AbstractControlDirective');
expect(await page.getDescendants('class', true)).toEqual(['ControlContainer', 'NgControl']);
});
it('should show direct and indirect subclasses of a class', async () => {
await page.navigateTo('api/forms/AbstractControlDirective');
expect(await page.getDescendants('class')).toEqual([
'ControlContainer',
'AbstractFormGroupDirective',
'NgModelGroup',
'FormGroupName',
'NgForm',
'FormGroupDirective',
'FormArrayName',
'NgControl',
'NgModel',
'FormControlDirective',
'FormControlName'
]);
});
it('should show child interfaces that extend an interface', async () => {
await page.navigateTo('api/forms/Validator');
expect(await page.getDescendants('interface')).toEqual(['AsyncValidator']);
});
it('should show classes that implement an interface', async () => {
await page.navigateTo('api/animations/AnimationPlayer');
expect(await page.getDescendants('class')).toEqual(['NoopAnimationPlayer', 'MockAnimationPlayer']);
});
it('should show type params of type-aliases', async () => {
await page.navigateTo('api/common/http/HttpEvent');
expect(await page.getOverview('type-alias').getText()).toContain('type HttpEvent<T>');
});
it('should not show parenthesis for getters', async () => {
await page.navigateTo('api/core/NgModuleRef');
expect(await page.getOverview('class').getText()).toContain('injector: Injector');
});
it('should show both type and initializer if set', async () => {
await page.navigateTo('api/common/HashLocationStrategy');
expect(await page.getOverview('class').getText()).toContain('path(includeHash: boolean = false): string');
});
it('should show a "Properties" section if there are public properties', async () => {
await page.navigateTo('api/core/ViewContainerRef');
expect(await page.getSection('instance-properties').isPresent()).toBe(true);
});
it('should not show a "Properties" section if there are only internal properties', async () => {
await page.navigateTo('api/forms/FormControl');
expect(await page.getSection('instance-properties').isPresent()).toBe(false);
});
it('should show "impure" badge if pipe is not pure', async () => {
await page.navigateTo('api/common/AsyncPipe');
expect(await page.getBadge('impure-pipe').isPresent()).toBe(true);
});
it('should show links to github', async () => {
await page.navigateTo('api/core/EventEmitter');
/* eslint-disable max-len */
expect(await page.ghLinks.get(0).getAttribute('href'))
.toMatch(/https:\/\/github\.com\/angular\/angular\/edit\/main\/packages\/core\/src\/event_emitter\.ts\?message=docs\(core\)%3A%20describe%20your%20change\.\.\.#L\d+-L\d+/);
expect(await page.ghLinks.get(1).getAttribute('href'))
.toMatch(/https:\/\/github\.com\/angular\/angular\/tree\/[^/]+\/packages\/core\/src\/event_emitter\.ts#L\d+-L\d+/);
/* eslint-enable max-len */
});
it('should show all overloads of interface methods', async () => {
await page.navigateTo('api/core/testing/TestBedStatic');
expect(await (await page.getInstanceMethodOverloads('initTestEnvironment')).length).toEqual(2);
});
it('should show all overloads of pseudo-class methods', async () => {
await page.navigateTo('api/core/testing/TestBed');
expect(await (await page.getInstanceMethodOverloads('initTestEnvironment')).length).toEqual(2);
});
});