fix(di): removed default visibility

BREAKING CHANGE:
    Directives will use the Unbounded visibility by default, whereas before the change they used Self
This commit is contained in:
vsavkin
2015-07-13 15:48:28 -07:00
parent 4bdc91892a
commit 04baa46efe
10 changed files with 26 additions and 69 deletions
+1 -26
View File
@@ -16,9 +16,7 @@ import {
forwardRef,
DependencyMetadata,
Injectable,
InjectMetadata,
self,
unbounded
InjectMetadata
} from 'angular2/di';
import {InjectorInlineStrategy, InjectorDynamicStrategy} from 'angular2/src/di/injector';
@@ -29,15 +27,6 @@ class CustomDependencyMetadata extends DependencyMetadata {}
class Engine {}
@Injectable(self)
class EngineWithSetVisibility {
}
@Injectable()
class CarNeedsEngineWithSetVisibility {
constructor(engine: EngineWithSetVisibility) {}
}
class BrokenEngine {
constructor() { throw new BaseException("Broken Engine"); }
}
@@ -417,19 +406,5 @@ export function main() {
expect(binding.dependencies[0].properties).toEqual([new CustomDependencyMetadata()]);
});
});
describe("default visibility", () => {
it("should use the provided visibility", () => {
var bindings = Injector.resolve([CarNeedsEngineWithSetVisibility, EngineWithSetVisibility]);
var carBinding = bindings[0];
expect(carBinding.dependencies[0].visibility).toEqual(self);
});
it("should set the default visibility to unbounded", () => {
var bindings = Injector.resolve([Car, Engine]);
var carBinding = bindings[0];
expect(carBinding.dependencies[0].visibility).toEqual(unbounded);
});
});
});
}