From 8452b2ab129581c1deda8e1b39a68ee33c9a2108 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 Feb 2015 09:07:57 -0800 Subject: [PATCH] [Fixed Position] Update specs Update failing specs after changes for WTD-881. --- .../src/representers/EditToolbarRepresenter.js | 4 ++-- .../representers/EditToolbarRepresenterSpec.js | 15 +++++---------- .../layout/test/elements/ElementProxySpec.js | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index 5f2b740b72..df390617fd 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -64,8 +64,6 @@ define( if (attrs.toolbar) { // Initialize toolbar object toolbar = new EditToolbar(definition, commit); - // Expose toolbar state under that name - scope.$parent[attrs.toolbar] = toolbarObject; } } @@ -96,6 +94,8 @@ define( scope.$watchCollection(getState, updateState); // Watch for changes in the current selection state scope.$watchCollection("selection", updateSelection); + // Expose toolbar state under that name + scope.$parent[attrs.toolbar] = toolbarObject; } return { diff --git a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js index 9ca9bb65d4..aea9ef3b03 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js @@ -35,7 +35,7 @@ define( }); it("exposes toolbar state under a attr-defined name", function () { - // A strucutre/state object should have been added to the + // A structure/state object should have been added to the // parent scope under the name provided in the "toolbar" // attribute expect(mockScope.$parent.testToolbar).toBeDefined(); @@ -48,18 +48,12 @@ define( }); it("watches for toolbar state changes", function () { - expect(mockScope.$parent.$watchCollection).toHaveBeenCalledWith( - "testToolbar.state", + expect(mockScope.$watchCollection).toHaveBeenCalledWith( + jasmine.any(Function), jasmine.any(Function) ); }); - it("stops watching toolbar state when destroyed", function () { - expect(mockUnwatch).not.toHaveBeenCalled(); - representer.destroy(); - expect(mockUnwatch).toHaveBeenCalled(); - }); - // Verify a simple interaction between selection state and toolbar // state; more complicated interactions are tested in EditToolbar. it("conveys state changes", function () { @@ -78,7 +72,8 @@ define( // Update the state mockScope.$parent.testToolbar.state[0] = 456; - mockScope.$parent.$watchCollection.mostRecentCall.args[1]( + // Invoke the first watch (assumed to be for toolbar state) + mockScope.$watchCollection.calls[0].args[1]( mockScope.$parent.testToolbar.state ); diff --git a/platform/features/layout/test/elements/ElementProxySpec.js b/platform/features/layout/test/elements/ElementProxySpec.js index 32e819ace8..ab90204ce0 100644 --- a/platform/features/layout/test/elements/ElementProxySpec.js +++ b/platform/features/layout/test/elements/ElementProxySpec.js @@ -14,7 +14,7 @@ define( testElement = { x: 1, y: 2, - z: 3, + stroke: '#717171', width: 42, height: 24 };