refactor(docs-infra): fix docs examples for tslint rules related to object properties (#38143)
This commit updates the docs examples to be compatible with the `no-string-literal`, `object-literal-key-quotes` and `object-literal-shorthand` 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:

committed by
Alex Rickabaugh

parent
d4a723a464
commit
ff72da60d3
@ -9,7 +9,7 @@ describe('Testing Example', () => {
|
||||
let navElts = element.all(by.css('app-root nav a'));
|
||||
|
||||
return {
|
||||
navElts: navElts,
|
||||
navElts,
|
||||
|
||||
appDashboard: element(by.css('app-root app-dashboard')),
|
||||
};
|
||||
|
@ -222,7 +222,7 @@ describe('demo (with TestBed):', () => {
|
||||
fixture.detectChanges();
|
||||
const ngForRow = fixture.debugElement.query(By.directive(IoComponent)); // first hero ngForRow
|
||||
|
||||
const hero = ngForRow.context['hero']; // the hero object passed into the row
|
||||
const hero = ngForRow.context.hero; // the hero object passed into the row
|
||||
expect(hero.name).toBe(heroName, 'ngRow.context.hero');
|
||||
|
||||
const rowComp = ngForRow.componentInstance;
|
||||
@ -514,11 +514,11 @@ describe('demo (with TestBed):', () => {
|
||||
expect(comp.children.toArray().length).toBe(4,
|
||||
'three different child components and an ElementRef with #content');
|
||||
|
||||
expect(el.references['nc']).toBe(comp, '#nc reference to component');
|
||||
expect(el.references.nc).toBe(comp, '#nc reference to component');
|
||||
|
||||
// #docregion custom-predicate
|
||||
// Filter for DebugElements with a #content reference
|
||||
const contentRefs = el.queryAll( de => de.references['content']);
|
||||
const contentRefs = el.queryAll( de => de.references.content);
|
||||
// #enddocregion custom-predicate
|
||||
expect(contentRefs.length).toBe(4, 'elements w/ a #content reference');
|
||||
});
|
||||
|
@ -72,7 +72,7 @@ describe('HttpClient testing', () => {
|
||||
|
||||
// Make an HTTP GET request with specific header
|
||||
httpClient.get<Data>(testUrl, {
|
||||
headers: new HttpHeaders({'Authorization': 'my-auth-token'})
|
||||
headers: new HttpHeaders({Authorization: 'my-auth-token'})
|
||||
})
|
||||
.subscribe(data =>
|
||||
expect(data).toEqual(testData)
|
||||
|
@ -7,7 +7,7 @@ describe('CanvasComponent', () => {
|
||||
// #enddocregion without-toBlob-macrotask
|
||||
// #docregion enable-toBlob-macrotask
|
||||
beforeEach(() => {
|
||||
window['__zone_symbol__FakeAsyncTestMacroTask'] = [
|
||||
(window as any).__zone_symbol__FakeAsyncTestMacroTask = [
|
||||
{
|
||||
source: 'HTMLCanvasElement.toBlob',
|
||||
callbackArgs: [{ size: 200 }],
|
||||
|
@ -69,7 +69,7 @@ describe('HighlightDirective', () => {
|
||||
|
||||
|
||||
it('bare <h2> should not have a customProperty', () => {
|
||||
expect(bareH2.properties['customProperty']).toBeUndefined();
|
||||
expect(bareH2.properties.customProperty).toBeUndefined();
|
||||
});
|
||||
// #enddocregion selected-tests
|
||||
|
||||
|
@ -23,13 +23,13 @@ bootstrap();
|
||||
|
||||
//
|
||||
|
||||
function bootstrap () {
|
||||
if (window['jasmineRef']) {
|
||||
function bootstrap() {
|
||||
if ((window as any).jasmineRef) {
|
||||
location.reload();
|
||||
return;
|
||||
} else {
|
||||
window.onload(undefined);
|
||||
window['jasmineRef'] = jasmine.getEnv();
|
||||
(window as any).jasmineRef = jasmine.getEnv();
|
||||
}
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
|
@ -1,3 +1,3 @@
|
||||
import jasmineRequire from 'jasmine-core/lib/jasmine-core/jasmine.js';
|
||||
|
||||
window['jasmineRequire'] = jasmineRequire;
|
||||
(window as any).jasmineRequire = jasmineRequire;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
export function addMatchers(): void {
|
||||
jasmine.addMatchers({
|
||||
toHaveText: toHaveText
|
||||
toHaveText
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user