mirror of
https://github.com/nasa/openmct.git
synced 2025-02-26 11:20:19 +00:00
[Layout] Fix failing specs
Repair or remove failing specs to reflect changes and refactoring performed during transition of Layout views, WTD-535.
This commit is contained in:
parent
f418491cc4
commit
d3f0505385
@ -7,6 +7,7 @@ define(
|
|||||||
|
|
||||||
describe("The tree node controller", function () {
|
describe("The tree node controller", function () {
|
||||||
var mockScope,
|
var mockScope,
|
||||||
|
mockTimeout,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
function TestObject(id, context) {
|
function TestObject(id, context) {
|
||||||
@ -19,13 +20,9 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj(
|
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
|
||||||
"$scope",
|
mockTimeout = jasmine.createSpy("$timeout");
|
||||||
[ "$watch", "$on" ]
|
controller = new TreeNodeController(mockScope, mockTimeout);
|
||||||
);
|
|
||||||
controller = new TreeNodeController(
|
|
||||||
mockScope
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows tracking of expansion state", function () {
|
it("allows tracking of expansion state", function () {
|
||||||
@ -34,6 +31,12 @@ define(
|
|||||||
// portion of the tree.
|
// portion of the tree.
|
||||||
expect(controller.hasBeenExpanded()).toBeFalsy();
|
expect(controller.hasBeenExpanded()).toBeFalsy();
|
||||||
controller.trackExpansion();
|
controller.trackExpansion();
|
||||||
|
|
||||||
|
// Expansion is tracked on a timeout, because too
|
||||||
|
// much expansion can result in an unstable digest.
|
||||||
|
expect(mockTimeout).toHaveBeenCalled();
|
||||||
|
mockTimeout.mostRecentCall.args[0]();
|
||||||
|
|
||||||
expect(controller.hasBeenExpanded()).toBeTruthy();
|
expect(controller.hasBeenExpanded()).toBeTruthy();
|
||||||
controller.trackExpansion();
|
controller.trackExpansion();
|
||||||
expect(controller.hasBeenExpanded()).toBeTruthy();
|
expect(controller.hasBeenExpanded()).toBeTruthy();
|
||||||
@ -85,6 +88,12 @@ define(
|
|||||||
// Invoke the watch with the new selection
|
// Invoke the watch with the new selection
|
||||||
mockScope.$watch.calls[0].args[1](child);
|
mockScope.$watch.calls[0].args[1](child);
|
||||||
|
|
||||||
|
// Expansion is tracked on a timeout, because too
|
||||||
|
// much expansion can result in an unstable digest.
|
||||||
|
// Trigger that timeout.
|
||||||
|
expect(mockTimeout).toHaveBeenCalled();
|
||||||
|
mockTimeout.mostRecentCall.args[0]();
|
||||||
|
|
||||||
expect(mockScope.toggle.setState).toHaveBeenCalledWith(true);
|
expect(mockScope.toggle.setState).toHaveBeenCalledWith(true);
|
||||||
expect(controller.hasBeenExpanded()).toBeTruthy();
|
expect(controller.hasBeenExpanded()).toBeTruthy();
|
||||||
expect(controller.isSelected()).toBeFalsy();
|
expect(controller.isSelected()).toBeFalsy();
|
||||||
|
@ -15,13 +15,13 @@ define(
|
|||||||
describe("The mct-representation directive", function () {
|
describe("The mct-representation directive", function () {
|
||||||
var testRepresentations,
|
var testRepresentations,
|
||||||
testViews,
|
testViews,
|
||||||
mockGestureService,
|
mockRepresenters,
|
||||||
mockGestureHandle,
|
|
||||||
mockQ,
|
mockQ,
|
||||||
mockLog,
|
mockLog,
|
||||||
mockScope,
|
mockScope,
|
||||||
mockElement,
|
mockElement,
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
|
testModel,
|
||||||
mctRepresentation;
|
mctRepresentation;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
@ -61,10 +61,17 @@ define(
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
mockGestureService = jasmine.createSpyObj("gestureService", [ "attachGestures" ]);
|
testModel = { someKey: "some value" };
|
||||||
mockGestureHandle = jasmine.createSpyObj("gestureHandle", [ "destroy" ]);
|
|
||||||
|
|
||||||
mockGestureService.attachGestures.andReturn(mockGestureHandle);
|
mockRepresenters = ["A", "B"].map(function (name) {
|
||||||
|
var constructor = jasmine.createSpy("Representer" + name),
|
||||||
|
representer = jasmine.createSpyObj(
|
||||||
|
"representer" + name,
|
||||||
|
[ "represent", "destroy" ]
|
||||||
|
);
|
||||||
|
constructor.andReturn(representer);
|
||||||
|
return constructor;
|
||||||
|
});
|
||||||
|
|
||||||
mockQ = { when: mockPromise };
|
mockQ = { when: mockPromise };
|
||||||
mockLog = jasmine.createSpyObj("$log", LOG_FUNCTIONS);
|
mockLog = jasmine.createSpyObj("$log", LOG_FUNCTIONS);
|
||||||
@ -73,10 +80,12 @@ define(
|
|||||||
mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS);
|
mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS);
|
||||||
mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS);
|
mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS);
|
||||||
|
|
||||||
|
mockDomainObject.getModel.andReturn(testModel);
|
||||||
|
|
||||||
mctRepresentation = new MCTRepresentation(
|
mctRepresentation = new MCTRepresentation(
|
||||||
testRepresentations,
|
testRepresentations,
|
||||||
testViews,
|
testViews,
|
||||||
mockGestureService,
|
mockRepresenters,
|
||||||
mockQ,
|
mockQ,
|
||||||
mockLog
|
mockLog
|
||||||
);
|
);
|
||||||
@ -137,32 +146,6 @@ define(
|
|||||||
.toHaveBeenCalledWith("otherTestCapability");
|
.toHaveBeenCalledWith("otherTestCapability");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("attaches declared gestures, and detaches on refresh", function () {
|
|
||||||
mctRepresentation.link(mockScope, mockElement);
|
|
||||||
|
|
||||||
mockScope.key = "uvw";
|
|
||||||
mockScope.domainObject = mockDomainObject;
|
|
||||||
|
|
||||||
// Trigger the watch
|
|
||||||
mockScope.$watch.mostRecentCall.args[1]();
|
|
||||||
|
|
||||||
expect(mockGestureService.attachGestures).toHaveBeenCalledWith(
|
|
||||||
mockElement,
|
|
||||||
mockDomainObject,
|
|
||||||
[ "testGesture", "otherTestGesture" ]
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(mockGestureHandle.destroy).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
// Refresh, expect a detach
|
|
||||||
mockScope.key = "abc";
|
|
||||||
mockScope.$watch.mostRecentCall.args[1]();
|
|
||||||
|
|
||||||
// Should have destroyed those old gestures
|
|
||||||
expect(mockGestureHandle.destroy).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it("logs when no representation is available for a key", function () {
|
it("logs when no representation is available for a key", function () {
|
||||||
mctRepresentation.link(mockScope, mockElement);
|
mctRepresentation.link(mockScope, mockElement);
|
||||||
|
|
||||||
|
@ -6,6 +6,32 @@ define(
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("A gesture representer", function () {
|
describe("A gesture representer", function () {
|
||||||
|
|
||||||
|
// it("attaches declared gestures, and detaches on refresh", function () {
|
||||||
|
// mctRepresentation.link(mockScope, mockElement);
|
||||||
|
//
|
||||||
|
// mockScope.key = "uvw";
|
||||||
|
// mockScope.domainObject = mockDomainObject;
|
||||||
|
//
|
||||||
|
// // Trigger the watch
|
||||||
|
// mockScope.$watch.mostRecentCall.args[1]();
|
||||||
|
//
|
||||||
|
// expect(mockGestureService.attachGestures).toHaveBeenCalledWith(
|
||||||
|
// mockElement,
|
||||||
|
// mockDomainObject,
|
||||||
|
// [ "testGesture", "otherTestGesture" ]
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// expect(mockGestureHandle.destroy).not.toHaveBeenCalled();
|
||||||
|
//
|
||||||
|
// // Refresh, expect a detach
|
||||||
|
// mockScope.key = "abc";
|
||||||
|
// mockScope.$watch.mostRecentCall.args[1]();
|
||||||
|
//
|
||||||
|
// // Should have destroyed those old gestures
|
||||||
|
// expect(mockGestureHandle.destroy).toHaveBeenCalled();
|
||||||
|
// });
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
x
Reference in New Issue
Block a user