Skip to content

Commit 00aa7a7

Browse files
authored
chore(tests): enable lint, make it green. (angular#10224)
1 parent 27b87ef commit 00aa7a7

File tree

106 files changed

+1561
-1596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1561
-1596
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ gulp.task('lint', ['format:enforce', 'tools:build'], () => {
9797
// Built-in rules are at
9898
// https://github.com/palantir/tslint#supported-rules
9999
const tslintConfig = require('./tslint.json');
100-
return gulp.src(['modules/@angular/**/*.ts', '!modules/@angular/*/test/**'])
100+
return gulp.src(['modules/@angular/**/*.ts'])
101101
.pipe(tslint({
102102
tslint: require('tslint').default,
103103
configuration: tslintConfig,

modules/@angular/common/test/directives/ng_class_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ export function main() {
581581
}));
582582

583583
});
584-
})
584+
});
585585
}
586586

587587
@Component({selector: 'test-cmp', directives: [NgClass, NgFor], template: ''})

modules/@angular/common/test/directives/ng_for_spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
10-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
1110
import {TestComponentBuilder} from '@angular/core/testing';
1211
import {ListWrapper} from '../../src/facade/collection';
1312
import {IS_DART} from '../../src/facade/lang';
@@ -182,7 +181,7 @@ export function main() {
182181
.then((fixture) => {
183182
fixture.debugElement.componentInstance.items = 'whaaa';
184183
try {
185-
fixture.detectChanges()
184+
fixture.detectChanges();
186185
} catch (e) {
187186
expect(e.message).toContain(
188187
`Cannot find a differ supporting object 'whaaa' of type 'string'. NgFor only supports binding to Iterables such as Arrays.`);

modules/@angular/common/test/directives/ng_if_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEach, ddescribe, describe, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEach, ddescribe, describe, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
1010
import {TestComponentBuilder} from '@angular/core/testing';
11-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1211
import {expect} from '@angular/platform-browser/testing/matchers';
1312
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
1413

modules/@angular/common/test/directives/ng_plural_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEachProviders, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
10-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEachProviders, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
1110
import {TestComponentBuilder} from '@angular/core/testing';
1211

1312
import {Component, Injectable} from '@angular/core';

modules/@angular/common/test/directives/ng_style_spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEach, beforeEachProviders, ddescribe, xdescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, xdescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
1010
import {TestComponentBuilder} from '@angular/core/testing';
11-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1211

1312
import {StringMapWrapper} from '../../src/facade/collection';
1413

@@ -191,7 +190,7 @@ export function main() {
191190
async.done();
192191
});
193192
}));
194-
})
193+
});
195194
}
196195

197196
@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})

modules/@angular/common/test/directives/ng_switch_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
10-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
10+
1111
import {Component} from '@angular/core';
1212
import {TestComponentBuilder} from '@angular/core/testing';
1313

modules/@angular/common/test/directives/ng_template_outlet_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
1010
import {TestComponentBuilder} from '@angular/core/testing';
11-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1211
import {Component, Directive, TemplateRef, ContentChildren, QueryList} from '@angular/core';
1312
import {NgTemplateOutlet} from '@angular/common';
1413

modules/@angular/common/test/directives/non_bindable_spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal';
1010
import {TestComponentBuilder} from '@angular/core/testing';
1111
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
1212
import {Component, Directive} from '@angular/core';
1313
import {ElementRef} from '@angular/core/src/linker/element_ref';
14-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1514

1615
export function main() {
1716
describe('non-bindable', () => {
@@ -61,7 +60,7 @@ export function main() {
6160
async.done();
6261
});
6362
}));
64-
})
63+
});
6564
}
6665

6766
@Directive({selector: '[test-dec]'})

modules/@angular/common/test/forms-deprecated/integration_spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88

99
import {NgFor, NgIf} from '@angular/common';
1010
import {Control, ControlGroup, ControlValueAccessor, DeprecatedFormsModule, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgControl, NgForm, RadioButtonState, Validator, Validators} from '@angular/common/src/forms-deprecated';
11-
import {Component, Directive, EventEmitter, Output} from '@angular/core';
12-
import {Input, Provider, forwardRef} from '@angular/core';
11+
import {Component, Directive, EventEmitter, Input, Output, Provider, forwardRef} from '@angular/core';
1312
import {ComponentFixture, TestComponentBuilder, configureModule, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
14-
import {afterEach, beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
15-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
13+
import {AsyncTestCompleter, afterEach, beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
1614
import {By} from '@angular/platform-browser/src/dom/debug/by';
1715
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
1816
import {dispatchEvent} from '@angular/platform-browser/testing/browser_util';
@@ -24,7 +22,7 @@ import {PromiseWrapper} from '../../src/facade/promise';
2422
export function main() {
2523
describe('integration tests', () => {
2624

27-
beforeEach(() => {configureModule({modules: [DeprecatedFormsModule]})});
25+
beforeEach(() => { configureModule({modules: [DeprecatedFormsModule]}); });
2826

2927
it('should initialize DOM elements with the given form object',
3028
inject(

modules/@angular/common/test/forms-deprecated/model_spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
1010
import {fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
11-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1211
import {ControlGroup, Control, ControlArray, Validators} from '@angular/common/src/forms-deprecated';
1312
import {IS_DART, isPresent} from '../../src/facade/lang';
1413
import {PromiseWrapper} from '../../src/facade/promise';
@@ -430,7 +429,7 @@ export function main() {
430429

431430
// rename contains into has
432431
it('should return false when the component is not included',
433-
() => { expect(group.contains('optional')).toEqual(false); })
432+
() => { expect(group.contains('optional')).toEqual(false); });
434433

435434
it('should return false when there is no component with the given name',
436435
() => { expect(group.contains('something else')).toEqual(false); });
@@ -605,7 +604,7 @@ export function main() {
605604
expect(g.errors).toEqual({'async': true});
606605
expect(g.find(['one']).errors).toEqual({'async': true});
607606
}));
608-
})
607+
});
609608
});
610609

611610
describe('ControlArray', () => {
@@ -829,7 +828,7 @@ export function main() {
829828
expect(g.errors).toEqual({'async': true});
830829
expect(g.pending).toEqual(false);
831830
}));
832-
})
831+
});
833832
});
834833
});
835834
}

modules/@angular/common/test/forms-deprecated/validators_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export function main() {
1919
function validator(key: string, error: any) {
2020
return function(c: AbstractControl) {
2121
var r = {};
22-
(r as any /** TODO #9100 */)[key] = error;
22+
(r as any)[key] = error;
2323
return r;
24-
}
24+
};
2525
}
2626

2727
class AsyncValidatorDirective {

modules/@angular/common/test/pipes/async_pipe_spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
10-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
1110
import {SpyChangeDetectorRef} from '../spies';
1211
import {isBlank} from '../../src/facade/lang';
1312
import {AsyncPipe} from '@angular/common';
@@ -45,7 +44,7 @@ export function main() {
4544
TimerWrapper.setTimeout(() => {
4645
expect(pipe.transform(emitter)).toEqual(new WrappedValue(message));
4746
async.done();
48-
}, 0)
47+
}, 0);
4948
}));
5049

5150

@@ -58,7 +57,7 @@ export function main() {
5857
pipe.transform(emitter);
5958
expect(pipe.transform(emitter)).toBe(message);
6059
async.done();
61-
}, 0)
60+
}, 0);
6261
}));
6362

6463
it('should dispose of the existing subscription when subscribing to a new observable',
@@ -74,7 +73,7 @@ export function main() {
7473
TimerWrapper.setTimeout(() => {
7574
expect(pipe.transform(newEmitter)).toBe(null);
7675
async.done();
77-
}, 0)
76+
}, 0);
7877
}));
7978

8079
it('should request a change detection check upon receiving a new value',
@@ -85,7 +84,7 @@ export function main() {
8584
TimerWrapper.setTimeout(() => {
8685
expect(ref.spy('markForCheck')).toHaveBeenCalled();
8786
async.done();
88-
}, 10)
87+
}, 10);
8988
}));
9089
});
9190

@@ -103,7 +102,7 @@ export function main() {
103102
TimerWrapper.setTimeout(() => {
104103
expect(pipe.transform(emitter)).toBe(null);
105104
async.done();
106-
}, 0)
105+
}, 0);
107106
}));
108107
});
109108
});
@@ -135,7 +134,7 @@ export function main() {
135134
TimerWrapper.setTimeout(() => {
136135
expect(pipe.transform(completer.promise)).toEqual(new WrappedValue(message));
137136
async.done();
138-
}, timer)
137+
}, timer);
139138
}));
140139

141140
it('should return unwrapped value when nothing has changed since the last call',
@@ -147,7 +146,7 @@ export function main() {
147146
pipe.transform(completer.promise);
148147
expect(pipe.transform(completer.promise)).toBe(message);
149148
async.done();
150-
}, timer)
149+
}, timer);
151150
}));
152151

153152
it('should dispose of the existing subscription when subscribing to a new promise',
@@ -163,7 +162,7 @@ export function main() {
163162
TimerWrapper.setTimeout(() => {
164163
expect(pipe.transform(newCompleter.promise)).toBe(null);
165164
async.done();
166-
}, timer)
165+
}, timer);
167166
}));
168167

169168
it('should request a change detection check upon receiving a new value',
@@ -175,7 +174,7 @@ export function main() {
175174
TimerWrapper.setTimeout(() => {
176175
expect(markForCheck).toHaveBeenCalled();
177176
async.done();
178-
}, timer)
177+
}, timer);
179178
}));
180179

181180
describe('ngOnDestroy', () => {
@@ -186,7 +185,7 @@ export function main() {
186185
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
187186
pipe.transform(completer.promise);
188187
expect(pipe.transform(completer.promise)).toBe(null);
189-
completer.resolve(message)
188+
completer.resolve(message);
190189

191190

192191
TimerWrapper.setTimeout(() => {

modules/@angular/common/test/pipes/json_pipe_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
10-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
1110
import {TestComponentBuilder} from '@angular/core/testing';
1211
import {Json, StringWrapper} from '../../src/facade/lang';
1312

modules/@angular/common/test/pipes/replace_pipe_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
10-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1110

1211
import {ReplacePipe} from '@angular/common';
1312
import {RegExpWrapper, StringJoiner} from '../../src/facade/lang';

modules/@angular/common/test/pipes/slice_pipe_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
9+
import {AsyncTestCompleter, ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, inject,} from '@angular/core/testing/testing_internal';
1010
import {TestComponentBuilder} from '@angular/core/testing';
11-
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
1211
import {browserDetection} from '@angular/platform-browser/testing/browser_util';
1312

1413
import {Component} from '@angular/core';

modules/@angular/compiler-cli/test/mocks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import * as ts from 'typescript';
1010

11-
import {ReflectorHost, ReflectorHostContext} from '../src/reflector_host';
11+
import {ReflectorHostContext} from '../src/reflector_host';
1212

1313
export type Entry = string | Directory;
1414

@@ -19,7 +19,7 @@ export class MockContext implements ReflectorHostContext {
1919

2020
fileExists(fileName: string): boolean { return typeof this.getEntry(fileName) === 'string'; }
2121

22-
directoryExists(path: string): boolean { return typeof this.getEntry(path) === 'object' }
22+
directoryExists(path: string): boolean { return typeof this.getEntry(path) === 'object'; }
2323

2424
readFile(fileName: string): string|undefined {
2525
let data = this.getEntry(fileName);

modules/@angular/compiler-cli/test/reflector_host_spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('reflector_host', () => {
2121

2222
beforeEach(() => {
2323
context = new MockContext('/tmp/src', clone(FILES));
24-
host = new MockCompilerHost(context)
24+
host = new MockCompilerHost(context);
2525
program = ts.createProgram(
2626
['main.ts'], {
2727
module: ts.ModuleKind.CommonJS,
@@ -93,10 +93,10 @@ describe('reflector_host', () => {
9393
expect(reflectorHost.getStaticSymbol('angularjs', 'SomeAngularSymbol')).toBeDefined();
9494
});
9595

96-
it('should be able to read a metadata file',
97-
() => {
98-
expect(reflectorHost.getMetadataFor('node_modules/@angular/core.d.ts'))
99-
.toEqual({__symbolic: 'module', version: 1, metadata: {foo: {__symbolic: 'class'}}})});
96+
it('should be able to read a metadata file', () => {
97+
expect(reflectorHost.getMetadataFor('node_modules/@angular/core.d.ts'))
98+
.toEqual({__symbolic: 'module', version: 1, metadata: {foo: {__symbolic: 'class'}}});
99+
});
100100

101101
it('should be able to read metadata from an otherwise unused .d.ts file ', () => {
102102
expect(reflectorHost.getMetadataFor('node_modules/@angular/unused.d.ts')).toBeUndefined();
@@ -107,7 +107,8 @@ describe('reflector_host', () => {
107107
});
108108
});
109109

110-
const dummyModule = 'export let foo: any[];'
110+
const dummyModule = 'export let foo: any[];';
111+
111112
const FILES: Entry = {
112113
'tmp': {
113114
'src': {
@@ -134,7 +135,7 @@ const FILES: Entry = {
134135
}
135136
}
136137
}
137-
}
138+
};
138139

139140
function clone(entry: Entry): Entry {
140141
if (typeof entry === 'string') {

modules/@angular/compiler/test/animation/animation_parser_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function main() {
5151
};
5252

5353
var getAnimationAstFromEntryAst =
54-
(ast: AnimationEntryAst) => { return ast.stateTransitions[0].animation; }
54+
(ast: AnimationEntryAst) => { return ast.stateTransitions[0].animation; };
5555

5656
var parseAnimationAst = (data: AnimationMetadata[]) => {
5757
return getAnimationAstFromEntryAst(parseAnimation(data).ast);

0 commit comments

Comments
 (0)