style(docs-infra): fix docs examples for tslint rules related to whitespace (#38143)

This commit updates the docs examples to be compatible with the `align`,
`space-before-function-paren` and `typedef-whitespace` tslint rules.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
This commit is contained in:
George Kalpakas 2020-07-30 13:03:10 +03:00 committed by Michael Prentice
parent c980caecac
commit da0129b83e
31 changed files with 147 additions and 142 deletions

View File

@ -11,8 +11,8 @@ describe('Binding syntax e2e tests', () => {
// helper function used to test what's logged to the console // helper function used to test what's logged to the console
async function logChecker(button, contents) { async function logChecker(button, contents) {
const logs = await browser.manage().logs().get(logging.Type.BROWSER); const logs = await browser.manage().logs().get(logging.Type.BROWSER);
const message = logs.filter(({ message }) => message.indexOf(contents) !== -1 ? true : false); const messages = logs.filter(({ message }) => message.indexOf(contents) !== -1 ? true : false);
expect(message.length).toBeGreaterThan(0); expect(messages.length).toBeGreaterThan(0);
} }

View File

@ -1,4 +1,4 @@
/* tslint:disable:no-unused-variable component-selector-name one-line check-open-brace */ /* tslint:disable: no-unused-variable component-selector-name one-line space-before-function-paren */
/* tslint:disable:*/ /* tslint:disable:*/
// #docplaster // #docplaster
// #docregion // #docregion

View File

@ -20,6 +20,7 @@ export function simpleCar() {
constructor(public cylinders: number) { } constructor(public cylinders: number) { }
} }
// #enddocregion car-ctor-instantiation-with-param // #enddocregion car-ctor-instantiation-with-param
export function superCar() { export function superCar() {
// #docregion car-ctor-instantiation-with-param // #docregion car-ctor-instantiation-with-param
// Super car with 12 cylinders and Flintstone tires. // Super car with 12 cylinders and Flintstone tires.

View File

@ -1,9 +1,7 @@
import { browser, element, by } from 'protractor'; import { browser, element, by } from 'protractor';
describe('Getting Started V0', () => { describe('Getting Started V0', () => {
beforeEach(() => { beforeEach(() => browser.get('/'));
return browser.get('/');
});
it('should display "My Store" in the top bar', async () => { it('should display "My Store" in the top bar', async () => {
const title = await element(by.css('app-root app-top-bar h1')).getText(); const title = await element(by.css('app-root app-top-bar h1')).getText();

View File

@ -15,8 +15,10 @@ export class HttpErrorHandler {
constructor(private messageService: MessageService) { } constructor(private messageService: MessageService) { }
/** Create curried handleError function that already knows the service name */ /** Create curried handleError function that already knows the service name */
createHandleError = (serviceName = '') => <T> createHandleError = (serviceName = '') => {
(operation = 'operation', result = {} as T) => this.handleError(serviceName, operation, result); return <T>(operation = 'operation', result = {} as T) =>
this.handleError(serviceName, operation, result);
}
/** /**
* Returns a function that handles Http operation failures. * Returns a function that handles Http operation failures.

View File

@ -12,8 +12,9 @@ import { Observable } from 'rxjs';
<div [hidden]="!visible"> <div [hidden]="!visible">
<ng-content></ng-content> <ng-content></ng-content>
</div> </div>
</div>`}) </div>
`,
})
export class ZippyComponent { export class ZippyComponent {
visible = true; visible = true;
@Output() open = new EventEmitter<any>(); @Output() open = new EventEmitter<any>();

View File

@ -4,18 +4,21 @@ import { Routes, RouterModule } from '@angular/router'; // CLI imports router
// #docregion child-routes // #docregion child-routes
const routes: Routes = [ const routes: Routes = [
{ path: 'first-component', {
path: 'first-component',
component: FirstComponent, // this is the component with the <router-outlet> in the template component: FirstComponent, // this is the component with the <router-outlet> in the template
children: [ children: [
{ {
path: 'child-a', // child route path path: 'child-a', // child route path
component: ChildAComponent // child route component that the router renders component: ChildAComponent, // child route component that the router renders
}, },
{ {
path: 'child-b', path: 'child-b',
component: ChildBComponent // another child route component that the router renders component: ChildBComponent, // another child route component that the router renders
} },
] }, ],
},
];
// #enddocregion child-routes // #enddocregion child-routes