mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
[Edit] Update specs
Update specs for toolbars in Edit mode to reflect changes for WTD-879.
This commit is contained in:
@ -48,6 +48,8 @@ define(
|
|||||||
state.forEach(function (value, index) {
|
state.forEach(function (value, index) {
|
||||||
toolbar.updateState(index, value);
|
toolbar.updateState(index, value);
|
||||||
});
|
});
|
||||||
|
// Commit the changes.
|
||||||
|
commit("Changes from toolbar.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represent a domain object using this definition
|
// Represent a domain object using this definition
|
||||||
|
@ -15,7 +15,7 @@ define(
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj(
|
mockScope = jasmine.createSpyObj(
|
||||||
'$scope',
|
'$scope',
|
||||||
[ '$on', '$watch', '$watchCollection' ]
|
[ '$on', '$watch', '$watchCollection', "commit" ]
|
||||||
);
|
);
|
||||||
mockElement = {};
|
mockElement = {};
|
||||||
testAttrs = { toolbar: 'testToolbar' };
|
testAttrs = { toolbar: 'testToolbar' };
|
||||||
|
@ -11,7 +11,8 @@ define(
|
|||||||
testABC,
|
testABC,
|
||||||
testABC2,
|
testABC2,
|
||||||
testABCXYZ,
|
testABCXYZ,
|
||||||
testABCYZ;
|
testABCYZ,
|
||||||
|
testM;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
testStructure = {
|
testStructure = {
|
||||||
@ -29,6 +30,11 @@ define(
|
|||||||
{ name: "Y", property: "y" },
|
{ name: "Y", property: "y" },
|
||||||
{ name: "Z", property: "z" }
|
{ 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
|
testABC2 = { a: 4, b: 1, c: 2 }; // For inconsistent-state checking
|
||||||
testABCXYZ = { a: 0, b: 1, c: 2, x: 'X!', y: 'Y!', z: 'Z!' };
|
testABCXYZ = { a: 0, b: 1, c: 2, x: 'X!', y: 'Y!', z: 'Z!' };
|
||||||
testABCYZ = { a: 0, b: 1, c: 2, 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 () {
|
it("provides properties from the original structure", function () {
|
||||||
@ -182,6 +189,19 @@ define(
|
|||||||
.length
|
.length
|
||||||
).toEqual(2);
|
).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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user