mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 15:26:39 +00:00
48ff8c4c03
Continue filling in specs for scripts introduced as part of bundle platform/commonUI/browse, which is responsible for browse mode. WTD-574.
46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
|
|
|
/**
|
|
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
|
*/
|
|
define(
|
|
["../../src/creation/CreateMenuController"],
|
|
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");
|
|
});
|
|
});
|
|
}
|
|
); |