From b5fb2176e94672a9f090b806ef313d7a9f7128b4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 2 Dec 2015 15:16:45 -0800 Subject: [PATCH] [Representation] Update specs ...to verify that both mct-model and ng-model are used. --- .../representation/test/MCTIncludeSpec.js | 19 ++++++++++++++++++- .../test/MCTRepresentationSpec.js | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/platform/representation/test/MCTIncludeSpec.js b/platform/representation/test/MCTIncludeSpec.js index bce138a9bb..27b134adcb 100644 --- a/platform/representation/test/MCTIncludeSpec.js +++ b/platform/representation/test/MCTIncludeSpec.js @@ -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 + ); + }); + }); } ); diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index eea4d6e1a5..4d424b01cb 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -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 + ); + }); }); } );