Skip to content

Commit c4e9b05

Browse files
committed
chore(tests): remove inject() calls
1 parent 14d657b commit c4e9b05

52 files changed

Lines changed: 802 additions & 807 deletions

Some content is hidden

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

test/core/core_directive_spec.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
module..type(AnnotatedIoComponent);
1010
});
1111

12-
it('should extract attr map from annotated component', inject((DirectiveMap directives) {
12+
it('should extract attr map from annotated component', (DirectiveMap directives) {
1313
var annotations = directives.annotationsFor(AnnotatedIoComponent);
1414
expect(annotations.length).toEqual(1);
1515
expect(annotations[0] is NgComponent).toBeTruthy();
@@ -35,7 +35,7 @@ void main() {
3535
'expr-one-way2': '=>exprOneWay2',
3636
'expr-two-way': '<=>exprTwoWay'
3737
});
38-
}));
38+
});
3939

4040
describe('exceptions', () {
4141
var baseModule;

test/core/interpolate_spec.dart

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,104 +10,104 @@ main() {
1010
describe('\$interpolate', () {
1111

1212
it('should return undefined when there are no bindings and textOnly is set to true',
13-
inject((Interpolate $interpolate) {
13+
(Interpolate $interpolate) {
1414
expect($interpolate('some text', true)).toBe(null);
15-
}));
15+
});
1616

17-
it('should suppress falsy objects', inject((Interpolate $interpolate) {
17+
it('should suppress falsy objects', (Interpolate $interpolate) {
1818
expect($interpolate('{{undefined}}')([null])).toEqual('');
1919
expect($interpolate('{{undefined+undefined}}')([null])).toEqual('');
2020
expect($interpolate('{{null}}')([null])).toEqual('');
2121
expect($interpolate('{{a.b}}')([null])).toEqual('');
22-
}));
22+
});
2323

24-
it('should jsonify objects', inject((Interpolate $interpolate) {
24+
it('should jsonify objects', (Interpolate $interpolate) {
2525
expect($interpolate('{{ {} }}')([{}])).toEqual('{}');
2626
expect($interpolate('{{ true }}')([true])).toEqual('true');
2727
expect($interpolate('{{ false }}')([false])).toEqual('false');
28-
}));
28+
});
2929

3030

31-
it('should return interpolation function', inject((Interpolate $interpolate, Scope rootScope) {
31+
it('should return interpolation function', (Interpolate $interpolate, Scope rootScope) {
3232
rootScope.context['name'] = 'Misko';
3333
var fn = $interpolate('Hello {{name}}!');
3434
expect(fn(['Misko'])).toEqual('Hello Misko!');
35-
}));
35+
});
3636

3737

38-
it('should ignore undefined model', inject((Interpolate $interpolate) {
38+
it('should ignore undefined model', (Interpolate $interpolate) {
3939
expect($interpolate("Hello {{'World' + foo}}")(['World'])).toEqual('Hello World');
40-
}));
40+
});
4141

4242

43-
it('should use toString to conver objects to string', inject((Interpolate $interpolate, Scope rootScope) {
43+
it('should use toString to conver objects to string', (Interpolate $interpolate, Scope rootScope) {
4444
expect($interpolate("Hello, {{obj}}!")([new ToStringableObject()])).toEqual('Hello, World!');
45-
}));
45+
});
4646

4747

4848
describe('parseBindings', () {
49-
it('should Parse Text With No Bindings', inject((Interpolate $interpolate) {
49+
it('should Parse Text With No Bindings', (Interpolate $interpolate) {
5050
var parts = $interpolate("a").separators;
5151
expect(parts.length).toEqual(1);
5252
expect(parts[0]).toEqual("a");
53-
}));
53+
});
5454

55-
it('should Parse Empty Text', inject((Interpolate $interpolate) {
55+
it('should Parse Empty Text', (Interpolate $interpolate) {
5656
var parts = $interpolate("").separators;
5757
expect(parts.length).toEqual(1);
5858
expect(parts[0]).toEqual("");
59-
}));
59+
});
6060

61-
it('should Parse Inner Binding', inject((Interpolate $interpolate) {
61+
it('should Parse Inner Binding', (Interpolate $interpolate) {
6262
var parts = $interpolate("a{{b}}C").separators;
6363
expect(parts.length).toEqual(2);
6464
expect(parts[0]).toEqual("a");
6565
expect(parts[1]).toEqual("C");
66-
}));
66+
});
6767

68-
it('should Parse Ending Binding', inject((Interpolate $interpolate) {
68+
it('should Parse Ending Binding', (Interpolate $interpolate) {
6969
var parts = $interpolate("a{{b}}").separators;
7070
expect(parts.length).toEqual(2);
7171
expect(parts[0]).toEqual("a");
7272
expect(parts[1]).toEqual("");
73-
}));
73+
});
7474

75-
it('should Parse Begging Binding', inject((Interpolate $interpolate) {
75+
it('should Parse Begging Binding', (Interpolate $interpolate) {
7676
var parts = $interpolate("{{b}}c").separators;
7777
expect(parts.length).toEqual(2);
7878
expect(parts[0]).toEqual("");
7979
expect(parts[1]).toEqual("c");
80-
}));
80+
});
8181

82-
it('should Parse Loan Binding', inject((Interpolate $interpolate) {
82+
it('should Parse Loan Binding', (Interpolate $interpolate) {
8383
var parts = $interpolate("{{b}}").separators;
8484
expect(parts.length).toEqual(2);
8585
expect(parts[0]).toEqual("");
8686
expect(parts[1]).toEqual("");
87-
}));
87+
});
8888

89-
it('should Parse Two Bindings', inject((Interpolate $interpolate) {
89+
it('should Parse Two Bindings', (Interpolate $interpolate) {
9090
var parts = $interpolate("{{b}}{{c}}").separators;
9191
expect(parts.length).toEqual(3);
9292
expect(parts[0]).toEqual("");
9393
expect(parts[1]).toEqual("");
9494
expect(parts[2]).toEqual("");
95-
}));
95+
});
9696

97-
it('should Parse Two Bindings With Text In Middle', inject((Interpolate $interpolate) {
97+
it('should Parse Two Bindings With Text In Middle', (Interpolate $interpolate) {
9898
var parts = $interpolate("{{b}}x{{c}}").separators;
9999
expect(parts.length).toEqual(3);
100100
expect(parts[0]).toEqual("");
101101
expect(parts[1]).toEqual("x");
102102
expect(parts[2]).toEqual("");
103-
}));
103+
});
104104

105-
it('should Parse Multiline', inject((Interpolate $interpolate) {
105+
it('should Parse Multiline', (Interpolate $interpolate) {
106106
var parts = $interpolate('"X\nY{{A\n+B}}C\nD"').separators;
107107
expect(parts.length).toEqual(2);
108108
expect(parts[0]).toEqual('"X\nY');
109109
expect(parts[1]).toEqual('C\nD"');
110-
}));
110+
});
111111
});
112112
});
113113
}

test/core/parser/lexer_spec.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ expect(actual) => new LexerExpect(actual);
5353
main() {
5454
describe('lexer', () {
5555
Lexer lex;
56-
beforeEach(inject((Lexer lexer) {
56+
beforeEach((Lexer lexer) {
5757
lex = lexer;
58-
}));
58+
});
5959

6060
// New test case
6161
it('should tokenize a simple identifier', () {

test/core/parser/parser_spec.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ main() {
5252
module.type(IncrementFilter);
5353
module.type(SubstringFilter);
5454
});
55-
beforeEach(inject((Parser injectedParser, FilterMap injectedFilters) {
55+
beforeEach((Parser injectedParser, FilterMap injectedFilters) {
5656
parser = injectedParser;
5757
filters = injectedFilters;
58-
}));
58+
});
5959

6060
eval(String text, [FilterMap f])
6161
=> parser(text).eval(context, f == null ? filters : f);
@@ -154,9 +154,9 @@ main() {
154154
describe('error handling', () {
155155
Parser<Expression> parser;
156156

157-
beforeEach(inject((Parser p) {
157+
beforeEach((Parser p) {
158158
parser = p;
159-
}));
159+
});
160160

161161
// We only care about the error strings in the DynamicParser.
162162
var errStr = (x) {
@@ -960,10 +960,10 @@ main() {
960960
});
961961

962962

963-
it('should work with scopes', inject((Scope scope) {
963+
it('should work with scopes', (Scope scope) {
964964
scope.context['a'] = {'b': 6};
965965
expect(parser('a.b').bind(scope.context, ScopeLocals.wrapper)({'a': {'b':1}})).toEqual(1);
966-
}));
966+
});
967967

968968
it('should expose assignment function', () {
969969
var fn = parser('a.b');
@@ -1000,7 +1000,7 @@ main() {
10001000
expect(eval("'abcd'|substring:1:3|uppercase")).toEqual("BC");
10011001
});
10021002

1003-
it('should only use filters that are passed as an argument', inject((Injector injector) {
1003+
it('should only use filters that are passed as an argument', (Injector injector) {
10041004
var expression = parser("'World'|hello");
10051005
expect(() {
10061006
expression.eval({}, filters);
@@ -1013,7 +1013,7 @@ main() {
10131013
var newFilters = childInjector.get(FilterMap);
10141014

10151015
expect(expression.eval({}, newFilters)).toEqual('Hello, World!');
1016-
}));
1016+
});
10171017

10181018
it('should not allow filters in a chain', () {
10191019
expect(() {

test/core/parser/static_parser_spec.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ main() {
1818
});
1919

2020

21-
it('should run a static function', inject((Parser parser) {
21+
it('should run a static function', (Parser parser) {
2222
expect(parser('1').eval(null)).toEqual(1);
23-
}));
23+
});
2424

2525

26-
it('should call the fallback if there is not function', inject((Parser parser) {
26+
it('should call the fallback if there is not function', (Parser parser) {
2727
expect(() => parser('not 1')).toThrow('x');
28-
}));
28+
});
2929
});
3030
}

0 commit comments

Comments
 (0)