Skip to content

Commit 1edb17b

Browse files
kevmoojelbourn
authored andcommitted
chore(test): add config for pub serve testing.
Closes angular#5580 Closes angular#5580
1 parent 1710272 commit 1edb17b

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

modules_dart/angular2_testing/lib/angular2_testing.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ void setUpProviders(Iterable<Provider> providerFactory()) {
5454
});
5555
}
5656

57-
5857
dynamic _runInjectableFunction(Function fn) {
5958
var params = reflector.parameters(fn);
6059
List<dynamic> tokens = <dynamic>[];
@@ -111,15 +110,18 @@ void ngTest(String description, Function fn,
111110
}, testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform);
112111
}
113112

114-
final _providersExpando = new Expando<List<Provider>>('Providers for the current test');
115-
final _injectorExpando = new Expando<Injector>('Angular Injector for the current test');
113+
final _providersExpando =
114+
new Expando<List<Provider>>('Providers for the current test');
115+
final _injectorExpando =
116+
new Expando<Injector>('Angular Injector for the current test');
116117

117118
List get _currentTestProviders {
118119
if (_providersExpando[_currentTest] == null) {
119120
return _providersExpando[_currentTest] = [];
120121
}
121122
return _providersExpando[_currentTest];
122123
}
124+
123125
Injector get _currentInjector => _injectorExpando[_currentTest];
124126
void set _currentInjector(Injector newInjector) {
125127
_injectorExpando[_currentTest] = newInjector;

modules_dart/angular2_testing/pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ dependencies:
66
path: ../../dist/dart/angular2
77
dev_dependencies:
88
test: '^0.12.6'
9+
transformers:
10+
# Allows testing with `pub serve`
11+
# See https://github.com/dart-lang/test#testing-with-barback
12+
- test/pub_serve:
13+
$include: test/**_test.dart

modules_dart/angular2_testing/test/angular2_testing_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ void main() {
4141
expect(string.split(','), equals(['foo', 'bar', 'baz']));
4242
});
4343

44-
ngTest('can grab injected values', (@Inject(MyToken) token, TestService testService) {
44+
ngTest('can grab injected values',
45+
(@Inject(MyToken) token, TestService testService) {
4546
expect(token, equals('my string'));
4647
expect(testService.status, equals('not ready'));
4748
});
@@ -56,7 +57,8 @@ void main() {
5657
});
5758
});
5859

59-
ngTest('create a component using the TestComponentBuilder', (TestComponentBuilder tcb) async {
60+
ngTest('create a component using the TestComponentBuilder',
61+
(TestComponentBuilder tcb) async {
6062
var rootTC = await tcb
6163
.overrideTemplate(TestComponent, TEMPLATE)
6264
.createAsync(TestComponent);

0 commit comments

Comments
 (0)