');
@@ -193,9 +193,9 @@ void main() {
backend.flush();
microLeap();
expect(element[0]).toHaveText('.hello{}');
- })));
+ }));
- it('should load the CSS before the template is loaded', async(inject(
+ it('should load the CSS before the template is loaded', async(
(Http http, Compiler compile, Scope rootScope, Injector injector,
MockHttpBackend backend, DirectiveMap directives) {
backend
@@ -209,7 +209,7 @@ void main() {
backend.flush();
microLeap();
expect(element.first).toHaveText('.hello{}Simple!');
- })));
+ }));
});
describe('multiple css loading', () {
@@ -219,7 +219,7 @@ void main() {
..bind(HtmlAndMultipleCssComponent);
});
- it('should load multiple CSS files into a style', async(inject(
+ it('should load multiple CSS files into a style', async(
(Http http, Compiler compile, Scope rootScope, Logger log,
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
backend
@@ -241,7 +241,7 @@ void main() {
rootScope.apply();
// Note: There is no ordering. It is who ever comes off the wire first!
expect(log.result()).toEqual('LOG; SIMPLE');
- })));
+ }));
});
describe('style cache', () {
@@ -251,7 +251,7 @@ void main() {
..bind(TemplateCache, toValue: new TemplateCache(capacity: 0));
});
- it('should load css from the style cache for the second component', async(inject(
+ it('should load css from the style cache for the second component', async(
(Http http, Compiler compile, MockHttpBackend backend,
DirectiveMap directives, Injector injector) {
backend
@@ -277,7 +277,7 @@ void main() {
expect(element2.children[0].shadowRoot).toHaveHtml(
'
Simple!
'
);
- })));
+ }));
});
});
}
diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart
index 97c19d325..fba9c8a73 100644
--- a/test/core_dom/compiler_spec.dart
+++ b/test/core_dom/compiler_spec.dart
@@ -55,7 +55,7 @@ void main() {
..bind(SimpleComponent);
});
- beforeEach(inject((TestBed tb) => _ = tb));
+ beforeEach((TestBed tb) => _ = tb);
it('should correctly detach transcluded content when scope destroyed', async(() {
var scope = _.rootScope.createChild({});
@@ -88,7 +88,7 @@ void main() {
..bind(MyChildController);
});
- beforeEach(inject((TestBed tb) => _ = tb));
+ beforeEach((TestBed tb) => _ = tb);
it('should compile basic hello world', () {
var element = _.compile('
');
@@ -778,7 +778,7 @@ void main() {
Expando expando;
- beforeEach(inject((Expando _expando) => expando = _expando));
+ beforeEach((Expando _expando) => expando = _expando);
['shadowy', 'shadowless'].forEach((selector) {
it('should release expando when a node is freed ($selector)', async(() {
diff --git a/test/core_dom/event_handler_spec.dart b/test/core_dom/event_handler_spec.dart
index 43b3b9149..aba26591c 100644
--- a/test/core_dom/event_handler_spec.dart
+++ b/test/core_dom/event_handler_spec.dart
@@ -45,7 +45,7 @@ main() {
return ngAppElement.firstChild;
}
- it('should register and handle event', inject((TestBed _) {
+ it('should register and handle event', (TestBed _) {
var e = compile(_,
'''
@@ -53,9 +53,9 @@ main() {
_.triggerEvent(e.querySelector('[on-abc]'), 'abc');
expect(_.getScope(e).context['ctrl'].invoked).toEqual(true);
- }));
+ });
- it('shoud register and handle event with long name', inject((TestBed _) {
+ it('shoud register and handle event with long name', (TestBed _) {
var e = compile(_,
'''
@@ -64,9 +64,9 @@ main() {
_.triggerEvent(e.querySelector('[on-my-new-event]'), 'myNewEvent');
var fooScope = _.getScope(e);
expect(fooScope.context['ctrl'].invoked).toEqual(true);
- }));
+ });
- it('shoud have model updates applied correctly', inject((TestBed _) {
+ it('shoud have model updates applied correctly', (TestBed _) {
var e = compile(_,
'''
{{ctrl.description}}
@@ -75,7 +75,7 @@ main() {
el.dispatchEvent(new Event('abc'));
_.rootScope.apply();
expect(el.text).toEqual("new description");
- }));
+ });
it('shoud register event when shadow dom is used', async((TestBed _) {
var e = compile(_,'
');
@@ -89,7 +89,7 @@ main() {
expect(ctrl.invoked).toEqual(true);
}));
- it('shoud handle event within content only once', async(inject((TestBed _) {
+ it('shoud handle event within content only once', async((TestBed _) {
var e = compile(_,
'''
@@ -106,6 +106,6 @@ main() {
var fooScope = _.getScope(document.querySelector('[foo]'));
expect(fooScope.context['ctrl'].invoked).toEqual(true);
- })));
+ }));
});
}
diff --git a/test/core_dom/mustache_spec.dart b/test/core_dom/mustache_spec.dart
index ba47f09b6..e30a69b39 100644
--- a/test/core_dom/mustache_spec.dart
+++ b/test/core_dom/mustache_spec.dart
@@ -9,10 +9,10 @@ main() {
module.bind(_HelloFormatter);
module.bind(_FooDirective);
});
- beforeEach(inject((TestBed tb) => _ = tb));
+ beforeEach((TestBed tb) => _ = tb);
- it('should replace {{}} in text', inject((Compiler compile,
- Scope rootScope, Injector injector, DirectiveMap directives)
+ it('should replace {{}} in text', (Compiler compile, Scope rootScope,
+ Injector injector, DirectiveMap directives)
{
var element = es('{{name}}!
');
var template = compile(element, directives);
@@ -24,7 +24,7 @@ main() {
rootScope.apply();
expect(element).toHaveText('OK!');
- }));
+ });
describe('observe/flush phase', () {
it('should first only when then value has settled', async((Logger log) {
@@ -44,9 +44,8 @@ main() {
}));
});
- it('should replace {{}} in attribute', inject((Compiler compile,
- Scope rootScope, Injector injector, DirectiveMap directives)
- {
+ it('should replace {{}} in attribute', (Compiler compile, Scope rootScope,
+ Injector injector, DirectiveMap directives) {
Element element =
e('');
var template = compile([element], directives);
@@ -60,12 +59,11 @@ main() {
rootScope.apply();
expect(element.attributes['some-attr']).toEqual('OK');
expect(element.attributes['other-attr']).toEqual('23');
- }));
+ });
- it('should allow newlines in attribute', inject((Compiler compile,
- RootScope rootScope, Injector injector, DirectiveMap directives)
- {
+ it('should allow newlines in attribute', (Compiler compile,
+ RootScope rootScope, Injector injector, DirectiveMap directives) {
Element element =
e('');
var template = compile([element], directives);
@@ -79,12 +77,11 @@ main() {
rootScope.apply();
expect(element.attributes['multiline-attr'])
.toEqual('line1: L1\nline2: L2');
- }));
+ });
- it('should handle formatters', inject((Compiler compile, RootScope rootScope,
- Injector injector, DirectiveMap directives)
- {
+ it('should handle formatters', (Compiler compile, RootScope rootScope,
+ Injector injector, DirectiveMap directives) {
var element = es('{{"World" | hello}}
');
var template = compile(element, directives);
var view = template(injector);
@@ -93,13 +90,13 @@ main() {
element = view.nodes;
expect(element).toHaveHtml('Hello, World!');
- }));
+ });
});
describe('NgShow', () {
TestBed _;
- beforeEach(inject((TestBed tb) => _ = tb));
+ beforeEach((TestBed tb) => _ = tb);
it('should add/remove ng-hide class', () {
var element = _.compile('');
diff --git a/test/directive/ng_repeat_spec.dart b/test/directive/ng_repeat_spec.dart
index 4b35f9528..d85a66102 100644
--- a/test/directive/ng_repeat_spec.dart
+++ b/test/directive/ng_repeat_spec.dart
@@ -531,7 +531,7 @@ main() {
});
it(r'should not move blocks when elements only added or removed',
- inject((Injector injector) {
+ (Injector injector) {
var throwOnMove = new MockAnimate();
var child = injector.createChild(
[new Module()..bind(Animate, toValue: throwOnMove)]);
@@ -566,6 +566,6 @@ main() {
..apply();
expect(element).toHaveText('bc');
- }));
+ });
});
}
diff --git a/test/directive/ng_switch_spec.dart b/test/directive/ng_switch_spec.dart
index e289113aa..2c26666ca 100644
--- a/test/directive/ng_switch_spec.dart
+++ b/test/directive/ng_switch_spec.dart
@@ -94,8 +94,7 @@ void main() {
});
- it('should always display the elements that do not match a switch',
- inject(() {
+ it('should always display the elements that do not match a switch', () {
var element = _.compile(
'' +
'- always
' +
@@ -109,7 +108,7 @@ void main() {
_.rootScope.context['select'] = 1;
_.rootScope.apply();
expect(element.text).toEqual('always one ');
- }));
+ });
it('should display the elements that do not have ngSwitchWhen nor ' +
@@ -137,8 +136,7 @@ void main() {
it('should display the elements that do not have ngSwitchWhen nor ' +
'ngSwitchDefault at the position specified in the template when the ' +
- 'first and last elements in the ngSwitch have a ngSwitch* directive',
- inject(() {
+ 'first and last elements in the ngSwitch have a ngSwitch* directive', () {
var element = _.compile(
'' +
'- 2
' +
@@ -153,7 +151,7 @@ void main() {
_.rootScope.context['select'] = 1;
_.rootScope.apply();
expect(element.text).toEqual('236');
- }));
+ });
it('should call change on switch', () {
diff --git a/test/formatter/json_spec.dart b/test/formatter/json_spec.dart
index c3c62597c..5dff8886b 100644
--- a/test/formatter/json_spec.dart
+++ b/test/formatter/json_spec.dart
@@ -4,9 +4,9 @@ import '../_specs.dart';
void main() {
describe('json', () {
- it('should convert primitives, array, map to json', inject((Scope scope, Parser parser, FormatterMap formatters) {
+ it('should convert primitives, array, map to json', (Scope scope, Parser parser, FormatterMap formatters) {
scope.context['foo'] = [{"string":'foo', "number": 123, "bool": false}];
expect(parser('foo | json').eval(scope.context, formatters)).toEqual('[{"string":"foo","number":123,"bool":false}]');
- }));
+ });
});
}
diff --git a/test/formatter/lowercase_spec.dart b/test/formatter/lowercase_spec.dart
index 03d465b90..2370cae08 100644
--- a/test/formatter/lowercase_spec.dart
+++ b/test/formatter/lowercase_spec.dart
@@ -4,9 +4,9 @@ import '../_specs.dart';
void main() {
describe('lowercase', () {
- it('should convert string to lowercase', inject((Parser parse, FormatterMap formatters) {
+ it('should convert string to lowercase', (Parser parse, FormatterMap formatters) {
expect(parse('null | lowercase').eval(null, formatters)).toEqual(null);
expect(parse('"FOO" | lowercase').eval(null, formatters)).toEqual('foo');
- }));
+ });
});
}
diff --git a/test/mock/test_bed_spec.dart b/test/mock/test_bed_spec.dart
index a35872f5f..661c5f4ac 100644
--- a/test/mock/test_bed_spec.dart
+++ b/test/mock/test_bed_spec.dart
@@ -14,20 +14,17 @@ void main() {
return (TestBed tb) => _ = tb;
});
- it('should allow for a scope-based compile', () {
+ it('should allow for a scope-based compile', (Scope scope) {
+ Scope childScope = scope.createChild({});
- inject((Scope scope) {
- Scope childScope = scope.createChild({});
+ _.compile('', scope: childScope);
- _.compile('', scope: childScope);
+ Probe probe = _.rootScope.context['i'];
+ var directiveInst = probe.directive(MyTestBedDirective);
- Probe probe = _.rootScope.context['i'];
- var directiveInst = probe.directive(MyTestBedDirective);
+ childScope.destroy();
- childScope.destroy();
-
- expect(directiveInst.destroyed).toBe(true);
- });
+ expect(directiveInst.destroyed).toBe(true);
});
});