Skip to content

Commit 354b5c5

Browse files
rkirovDiana Salsbury
authored and
Diana Salsbury
committed
chore(test-bed): add fromInjector constructor to TestBed
Some clients do not generate static factories for test code, and instead directly depend on TestBed constructor. This commit adds a new constructor is basically the injector factory method, requiring only injector vs a full set of parameters. Once clients have been moved to use fromInjector method (or even better a transformer run for test code), we can change the constructor dependencies in a non-breaking way. Closes dart-archive#1271
1 parent f8bbd35 commit 354b5c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/mock/test_bed.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class TestBed {
2020

2121
TestBed(this.injector, this.directiveInjector, this.rootScope, this.compiler, this._parser, this.expando);
2222

23+
TestBed.fromInjector(Injector i) :
24+
this(i, i.get(DirectiveInjector), i.get(RootScope), i.get(Compiler),
25+
i.get(Parser), i.get(Expando));
26+
2327

2428
/**
2529
* Use to compile HTML and activate its directives.

0 commit comments

Comments
 (0)