angular/devtools/cypress/integration/view-component-metadata.e2e.js
AleksanderBodurri 2a1ff17b42 refactor(devtools): run tslint --fix on devtools codebase
This commit runs tslint --fix with the angular/angular tslint configuration on the files inside the devtools codebase.

Notably, the file-header rule in `tslint.json` was missing a default attribute. This commit adds that default attribute and sets it to the
license header that is present in all files in this repo. After running tslint --fix with this default added, this commit added the license header to all files in the devtools directory. Note for the reviewer: the automatically added license headers were added as comments with the "/*!" prefix. Since we want these comments removed in builds, and the rest of the codebase uses "/**", a simple find and replace was performed on the devtools directory to change these prefixes to "/**".
2022-01-26 16:35:31 -05:00

64 lines
2.3 KiB
JavaScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const prepareHeaderExpansionPanelForAssertions = (selector) => {
cy.get('.tree-wrapper').find(selector).first().click({force: true});
cy.get('.element-header .component-name').click();
};
describe('Viewing component metadata', () => {
beforeEach(() => {
cy.visit('/');
});
describe('viewing TodoComponent', () => {
beforeEach(
() => prepareHeaderExpansionPanelForAssertions(
'.tree-node:contains("app-todo[TooltipDirective]")'));
it('should display view encapsulation', () => {
cy.contains('.meta-data-container .mat-button:first', 'View Encapsulation: Emulated');
});
it('should display change detection strategy', () => {
cy.contains('.meta-data-container .mat-button:last', 'Change Detection Strategy: OnPush');
});
});
describe('viewing DemoAppComponent', () => {
beforeEach(
() =>
prepareHeaderExpansionPanelForAssertions('.tree-node:contains("app-demo-component")'));
it('should display view encapsulation', () => {
cy.contains('.meta-data-container .mat-button:first', 'View Encapsulation: None');
});
it('should display change detection strategy', () => {
cy.contains('.meta-data-container .mat-button:last', 'Change Detection Strategy: Default');
});
it('should display correct set of inputs', () => {
cy.contains('.cy-inputs', '@Inputs');
cy.contains('.cy-inputs mat-tree-node:first span:first', 'inputOne');
cy.contains('.cy-inputs mat-tree-node:last span:first', 'inputTwo');
});
it('should display correct set of outputs', () => {
cy.contains('.cy-outputs', '@Outputs');
cy.contains('.cy-outputs mat-tree-node:first span:first', 'outputOne');
cy.contains('.cy-outputs mat-tree-node:last span:first', 'outputTwo');
});
it('should display correct set of properties', () => {
cy.contains('.cy-properties', 'Properties');
cy.contains('.cy-properties mat-tree-node:first span:first', 'elementRef');
cy.contains('.cy-properties mat-tree-node:last span:first', 'zippy');
});
});
});