mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 13:18:15 +00:00
[Common UI] Continue filling in Browse specs
Continue filling in specs for scripts introduced as part of bundle platform/commonUI/browse, which is responsible for browse mode. WTD-574.
This commit is contained in:
@ -5,11 +5,42 @@
|
||||
*/
|
||||
define(
|
||||
["../../src/creation/CreateMenuController"],
|
||||
function (CreateActionProvider) {
|
||||
function (CreateMenuController) {
|
||||
"use strict";
|
||||
|
||||
describe("The create menu controller", function () {
|
||||
var mockScope,
|
||||
mockActions,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
||||
controller = new CreateMenuController(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 create 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.createActions.length).toEqual(3);
|
||||
|
||||
// Make sure the right action type was requested
|
||||
expect(mockActions.getActions).toHaveBeenCalledWith("create");
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user