@ -76,8 +76,10 @@ export function main() {
|
||||
describe("createDirectiveVariableBindings", () => {
|
||||
it("should calculate directive variable bindings", () => {
|
||||
var dvbs = createDirectiveVariableBindings(
|
||||
new renderApi.ElementBinder(
|
||||
{variableBindings: MapWrapper.createFromStringMap({"exportName": "templateName"})}),
|
||||
new renderApi.ElementBinder({
|
||||
variableBindings:
|
||||
MapWrapper.createFromStringMap<string>({"exportName": "templateName"})
|
||||
}),
|
||||
[
|
||||
directiveBinding(
|
||||
{metadata: renderApi.DirectiveMetadata.create({exportAs: 'exportName'})}),
|
||||
@ -85,13 +87,15 @@ export function main() {
|
||||
{metadata: renderApi.DirectiveMetadata.create({exportAs: 'otherName'})})
|
||||
]);
|
||||
|
||||
expect(dvbs).toEqual(MapWrapper.createFromStringMap({"templateName": 0}));
|
||||
expect(dvbs).toEqual(MapWrapper.createFromStringMap<number>({"templateName": 0}));
|
||||
});
|
||||
|
||||
it("should set exportAs to $implicit for component with exportAs = null", () => {
|
||||
var dvbs = createDirectiveVariableBindings(
|
||||
new renderApi.ElementBinder(
|
||||
{variableBindings: MapWrapper.createFromStringMap({"$implicit": "templateName"})}),
|
||||
new renderApi.ElementBinder({
|
||||
variableBindings:
|
||||
MapWrapper.createFromStringMap<string>({"$implicit": "templateName"})
|
||||
}),
|
||||
[
|
||||
directiveBinding({
|
||||
metadata: renderApi.DirectiveMetadata.create(
|
||||
@ -99,7 +103,7 @@ export function main() {
|
||||
})
|
||||
]);
|
||||
|
||||
expect(dvbs).toEqual(MapWrapper.createFromStringMap({"templateName": 0}));
|
||||
expect(dvbs).toEqual(MapWrapper.createFromStringMap<number>({"templateName": 0}));
|
||||
});
|
||||
|
||||
it("should throw we no directive exported with this name", () => {
|
||||
@ -107,7 +111,7 @@ export function main() {
|
||||
createDirectiveVariableBindings(
|
||||
new renderApi.ElementBinder({
|
||||
variableBindings:
|
||||
MapWrapper.createFromStringMap({"someInvalidName": "templateName"})
|
||||
MapWrapper.createFromStringMap<string>({"someInvalidName": "templateName"})
|
||||
}),
|
||||
[
|
||||
directiveBinding(
|
||||
@ -120,7 +124,8 @@ export function main() {
|
||||
expect(() => {
|
||||
createDirectiveVariableBindings(
|
||||
new renderApi.ElementBinder({
|
||||
variableBindings: MapWrapper.createFromStringMap({"exportName": "templateName"})
|
||||
variableBindings:
|
||||
MapWrapper.createFromStringMap<string>({"exportName": "templateName"})
|
||||
}),
|
||||
[
|
||||
directiveBinding(
|
||||
@ -148,11 +153,11 @@ export function main() {
|
||||
it('should merge the names in the template for all ElementBinders', () => {
|
||||
expect(createVariableLocations([
|
||||
new renderApi.ElementBinder(
|
||||
{variableBindings: MapWrapper.createFromStringMap({"x": "a"})}),
|
||||
{variableBindings: MapWrapper.createFromStringMap<string>({"x": "a"})}),
|
||||
new renderApi.ElementBinder(
|
||||
{variableBindings: MapWrapper.createFromStringMap({"y": "b"})})
|
||||
{variableBindings: MapWrapper.createFromStringMap<string>({"y": "b"})})
|
||||
|
||||
])).toEqual(MapWrapper.createFromStringMap({'a': 0, 'b': 1}));
|
||||
])).toEqual(MapWrapper.createFromStringMap<number>({'a': 0, 'b': 1}));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user