[Fixed Position] Update specs

Update failing specs after changes for WTD-881.
This commit is contained in:
Victor Woeltjen 2015-02-24 09:07:57 -08:00
parent 307fbe2151
commit 8452b2ab12
3 changed files with 8 additions and 13 deletions

View File

@ -64,8 +64,6 @@ define(
if (attrs.toolbar) { if (attrs.toolbar) {
// Initialize toolbar object // Initialize toolbar object
toolbar = new EditToolbar(definition, commit); 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); scope.$watchCollection(getState, updateState);
// Watch for changes in the current selection state // Watch for changes in the current selection state
scope.$watchCollection("selection", updateSelection); scope.$watchCollection("selection", updateSelection);
// Expose toolbar state under that name
scope.$parent[attrs.toolbar] = toolbarObject;
} }
return { return {

View File

@ -35,7 +35,7 @@ define(
}); });
it("exposes toolbar state under a attr-defined name", function () { 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" // parent scope under the name provided in the "toolbar"
// attribute // attribute
expect(mockScope.$parent.testToolbar).toBeDefined(); expect(mockScope.$parent.testToolbar).toBeDefined();
@ -48,18 +48,12 @@ define(
}); });
it("watches for toolbar state changes", function () { it("watches for toolbar state changes", function () {
expect(mockScope.$parent.$watchCollection).toHaveBeenCalledWith( expect(mockScope.$watchCollection).toHaveBeenCalledWith(
"testToolbar.state", jasmine.any(Function),
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 // Verify a simple interaction between selection state and toolbar
// state; more complicated interactions are tested in EditToolbar. // state; more complicated interactions are tested in EditToolbar.
it("conveys state changes", function () { it("conveys state changes", function () {
@ -78,7 +72,8 @@ define(
// Update the state // Update the state
mockScope.$parent.testToolbar.state[0] = 456; 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 mockScope.$parent.testToolbar.state
); );

View File

@ -14,7 +14,7 @@ define(
testElement = { testElement = {
x: 1, x: 1,
y: 2, y: 2,
z: 3, stroke: '#717171',
width: 42, width: 42,
height: 24 height: 24
}; };