From ee8ecd365dcb634cd799411346ab9d33fe7b8470 Mon Sep 17 00:00:00 2001 From: Rado Kirov Date: Mon, 28 Jul 2014 11:32:51 -0700 Subject: [PATCH] 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 #1271 --- lib/mock/test_bed.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mock/test_bed.dart b/lib/mock/test_bed.dart index d1c54da81..e0cf5064d 100644 --- a/lib/mock/test_bed.dart +++ b/lib/mock/test_bed.dart @@ -20,6 +20,10 @@ class TestBed { TestBed(this.injector, this.directiveInjector, this.rootScope, this.compiler, this._parser, this.expando); + TestBed.fromInjector(Injector i) : + this(i, i.get(DirectiveInjector), i.get(RootScope), i.get(Compiler), + i.get(Parser), i.get(Expando)); + /** * Use to compile HTML and activate its directives.