mirror of
https://github.com/nasa/openmct.git
synced 2025-01-21 03:55:31 +00:00
[Edit] Update specs
Update specs for toolbars in Edit mode to reflect changes for WTD-879.
This commit is contained in:
parent
280c854658
commit
8c653d39d7
@ -48,6 +48,8 @@ define(
|
||||
state.forEach(function (value, index) {
|
||||
toolbar.updateState(index, value);
|
||||
});
|
||||
// Commit the changes.
|
||||
commit("Changes from toolbar.");
|
||||
}
|
||||
|
||||
// Represent a domain object using this definition
|
||||
|
@ -15,7 +15,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
[ '$on', '$watch', '$watchCollection' ]
|
||||
[ '$on', '$watch', '$watchCollection', "commit" ]
|
||||
);
|
||||
mockElement = {};
|
||||
testAttrs = { toolbar: 'testToolbar' };
|
||||
|
@ -11,7 +11,8 @@ define(
|
||||
testABC,
|
||||
testABC2,
|
||||
testABCXYZ,
|
||||
testABCYZ;
|
||||
testABCYZ,
|
||||
testM;
|
||||
|
||||
beforeEach(function () {
|
||||
testStructure = {
|
||||
@ -29,6 +30,11 @@ define(
|
||||
{ name: "Y", property: "y" },
|
||||
{ name: "Z", property: "z" }
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ name: "M", method: "m" }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
@ -37,6 +43,7 @@ define(
|
||||
testABC2 = { a: 4, b: 1, c: 2 }; // For inconsistent-state checking
|
||||
testABCXYZ = { a: 0, b: 1, c: 2, x: 'X!', y: 'Y!', z: 'Z!' };
|
||||
testABCYZ = { a: 0, b: 1, c: 2, y: 'Y!', z: 'Z!' };
|
||||
testM = { m: jasmine.createSpy("method") };
|
||||
});
|
||||
|
||||
it("provides properties from the original structure", function () {
|
||||
@ -182,6 +189,19 @@ define(
|
||||
.length
|
||||
).toEqual(2);
|
||||
});
|
||||
|
||||
it("adds click functions when a method is specified", function () {
|
||||
var testCommit = jasmine.createSpy('commit'),
|
||||
toolbar = new EditToolbar(testStructure, [ testM ], testCommit);
|
||||
// Verify precondition
|
||||
expect(testM.m).not.toHaveBeenCalled();
|
||||
// Click!
|
||||
toolbar.getStructure().sections[0].items[0].click();
|
||||
// Should have called the underlying function
|
||||
expect(testM.m).toHaveBeenCalled();
|
||||
// Should also have committed the change
|
||||
expect(testCommit).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user