mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 18:06:59 +00:00
0d5a849a41
Restructure sources associated with Edit mode; work on WTD-788 has increased number of sources here so more organization is useful.
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
/*global define,describe,it,expect,beforeEach,jasmine*/
|
|
|
|
define(
|
|
["../../src/controllers/EditActionController"],
|
|
function (EditActionController) {
|
|
"use strict";
|
|
|
|
describe("The Edit Action controller", function () {
|
|
var mockScope,
|
|
mockActions,
|
|
controller;
|
|
|
|
beforeEach(function () {
|
|
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
|
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
|
controller = new EditActionController(mockScope);
|
|
});
|
|
|
|
it("watches scope that may change applicable actions", function () {
|
|
// The action capability
|
|
expect(mockScope.$watch).toHaveBeenCalledWith(
|
|
"action",
|
|
jasmine.any(Function)
|
|
);
|
|
});
|
|
|
|
it("populates the scope with grouped and ungrouped actions", function () {
|
|
mockScope.action = mockActions;
|
|
|
|
mockActions.getActions.andReturn(["a", "b", "c"]);
|
|
|
|
// Call the watch
|
|
mockScope.$watch.mostRecentCall.args[1]();
|
|
|
|
// Should have grouped and ungrouped actions in scope now
|
|
expect(mockScope.editActions.length).toEqual(3);
|
|
});
|
|
});
|
|
}
|
|
); |