diff --git a/platform/commonUI/general/test/controllers/SelectorControllerSpec.js b/platform/commonUI/general/test/controllers/SelectorControllerSpec.js new file mode 100644 index 0000000000..30648a1d8e --- /dev/null +++ b/platform/commonUI/general/test/controllers/SelectorControllerSpec.js @@ -0,0 +1,45 @@ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +define( + ["../../src/controllers/SelectorController"], + function (SelectorController) { + "use strict"; + + describe("The controller for the 'selector' control", function () { + var mockObjectService, + mockScope, + controller; + + function promiseOf(v) { + return (v || {}).then ? v : { + then: function (callback) { + return promiseOf(callback(v)); + } + }; + } + + beforeEach(function () { + mockObjectService = jasmine.createSpyObj( + 'objectService', + ['getObjects'] + ); + mockScope = jasmine.createSpyObj( + '$scope', + ['$watch', '$watchCollection'] + ); + + mockObjectService.getObjects.andReturn(promiseOf({})); + + controller = new SelectorController( + mockObjectService, + mockScope + ); + }); + + it("loads the root object", function () { + expect(mockObjectService.getObjects) + .toHaveBeenCalledWith(["ROOT"]); + }); + }); + } +); diff --git a/platform/commonUI/general/test/suite.json b/platform/commonUI/general/test/suite.json index 58d94a4d95..e8c9674b44 100644 --- a/platform/commonUI/general/test/suite.json +++ b/platform/commonUI/general/test/suite.json @@ -4,6 +4,7 @@ "controllers/ClickAwayController", "controllers/ContextMenuController", "controllers/GetterSetterController", + "controllers/SelectorController", "controllers/SplitPaneController", "controllers/ToggleController", "controllers/TreeNodeController",