refactor(docs-infra): fix docs examples for Angular-specific tslint rules (#38143)

This commit updates the docs examples to be compatible with the
following Angular-specific tslint rules:
- `component-selector`
- `directive-selector`
- `no-conflicting-lifecycle`
- `no-host-metadata-property`
- `no-input-rename`
- `no-output-native`
- `no-output-rename`

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:21 +03:00
committed by Alex Rickabaugh
parent 5303773daf
commit bfd13c06e1
27 changed files with 40 additions and 36 deletions

View File

@ -135,7 +135,7 @@ describe('Lifecycle hooks', () => {
const inputEle = element(by.css('spy-parent input'));
const addHeroButtonEle = element(by.cssContainingText('spy-parent button', 'Add Hero'));
const resetHeroesButtonEle = element(by.cssContainingText('spy-parent button', 'Reset Heroes'));
const heroEles = element.all(by.css('spy-parent div[mySpy'));
const heroEles = element.all(by.css('spy-parent div[appSpy'));
const logEles = element.all(by.css('spy-parent h4 ~ div'));
expect(heroEles.count()).toBe(2, 'should have two heroes displayed');

View File

@ -13,7 +13,7 @@ import { LoggerService } from './logger.service';
Counter = {{counter}}
<h5>-- Counter Change Log --</h5>
<div *ngFor="let chg of changeLog" mySpy>{{chg}}</div>
<div *ngFor="let chg of changeLog" appSpy>{{chg}}</div>
</div>
`,
styles: ['.counter {background: LightYellow; padding: 8px; margin-top: 8px}']

View File

@ -1,3 +1,5 @@
// tslint:disable: no-conflicting-lifecycle
// #docregion
import {
AfterContentChecked,
AfterContentInit,

View File

@ -7,7 +7,7 @@
<p></p>
<!-- #docregion template -->
<div *ngFor="let hero of heroes" mySpy class="heroes">
<div *ngFor="let hero of heroes" appSpy class="heroes">
{{hero}}
</div>
<!-- #enddocregion template -->

View File

@ -7,8 +7,8 @@ let nextId = 1;
// #docregion spy-directive
// Spy on any element to which it is applied.
// Usage: <div mySpy>...</div>
@Directive({selector: '[mySpy]'})
// Usage: <div appSpy>...</div>
@Directive({selector: '[appSpy]'})
export class SpyDirective implements OnInit, OnDestroy {
constructor(private logger: LoggerService) { }