mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 06:27:48 +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.
73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
|
|
|
/**
|
|
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
|
*/
|
|
define(
|
|
["../../src/creation/CreateActionProvider"],
|
|
function (CreateActionProvider) {
|
|
"use strict";
|
|
|
|
describe("The create action provider", function () {
|
|
var mockTypeService,
|
|
mockDialogService,
|
|
mockCreationService,
|
|
provider;
|
|
|
|
function createMockType(name) {
|
|
var mockType = jasmine.createSpyObj(
|
|
"type" + name,
|
|
[
|
|
"getKey",
|
|
"getGlyph",
|
|
"getName",
|
|
"getDescription",
|
|
"getProperties",
|
|
"getInitialModel"
|
|
]
|
|
);
|
|
mockType.getName.andReturn(name);
|
|
return mockType;
|
|
}
|
|
|
|
beforeEach(function () {
|
|
mockTypeService = jasmine.createSpyObj(
|
|
"typeService",
|
|
[ "listTypes" ]
|
|
);
|
|
mockDialogService = jasmine.createSpyObj(
|
|
"dialogService",
|
|
[ "getUserInput" ]
|
|
);
|
|
mockCreationService = jasmine.createSpyObj(
|
|
"creationService",
|
|
[ "createObject" ]
|
|
);
|
|
|
|
mockTypeService.listTypes.andReturn(
|
|
[ "A", "B", "C" ].map(createMockType)
|
|
);
|
|
|
|
provider = new CreateActionProvider(
|
|
mockTypeService,
|
|
mockDialogService,
|
|
mockCreationService
|
|
);
|
|
});
|
|
|
|
it("exposes one create action per type", function () {
|
|
expect(provider.getActions({
|
|
key: "create",
|
|
domainObject: {}
|
|
}).length).toEqual(3);
|
|
});
|
|
|
|
it("exposes no non-create actions", function () {
|
|
expect(provider.getActions({
|
|
key: "somethingElse",
|
|
domainObject: {}
|
|
}).length).toEqual(0);
|
|
});
|
|
});
|
|
}
|
|
); |