[Representation] Update specs

...to verify that both mct-model and ng-model are used.
This commit is contained in:
Victor Woeltjen 2015-12-02 15:16:45 -08:00
parent 70e11d66e1
commit b5fb2176e9
2 changed files with 34 additions and 2 deletions

View File

@ -78,7 +78,11 @@ define(
return testUrls[template.key];
});
mctInclude = new MCTInclude(testTemplates, mockLinker);
testAttrs = { key: "parentKey" };
testAttrs = {
key: "parentKey",
mctModel: "someExpr",
ngModel: "someOtherExpr"
};
mctInclude.link(mockScope, mockElement, testAttrs);
});
@ -101,6 +105,19 @@ define(
.toHaveBeenCalledWith(testUrls.xyz);
});
it("watches for changes on both ng-model and mct-model", function () {
expect(mockScope.$parent.$watch).toHaveBeenCalledWith(
testAttrs.ngModel,
jasmine.any(Function),
false
);
expect(mockScope.$parent.$watch).toHaveBeenCalledWith(
testAttrs.mctModel,
jasmine.any(Function),
false
);
});
});
}
);

View File

@ -105,7 +105,9 @@ define(
testAttrs = {
"mctObject": "someExpr",
"key": "someOtherExpr"
"key": "someOtherExpr",
"ngModel": "yetAnotherExpr",
"mctModel": "theExprsKeepOnComing"
};
mockRepresenters = ["A", "B"].map(function (name) {
@ -229,6 +231,19 @@ define(
expect(mockScope.testCapability).toBeUndefined();
});
it("watches for changes on both ng-model and mct-model", function () {
expect(mockScope.$parent.$watch).toHaveBeenCalledWith(
testAttrs.ngModel,
jasmine.any(Function),
false
);
expect(mockScope.$parent.$watch).toHaveBeenCalledWith(
testAttrs.mctModel,
jasmine.any(Function),
false
);
});
});
}
);