[Addressability] Update spec for BrowseController

Update spec to reflect changes for BrowseController to support
addressability of domain objects, WTD-1149.
This commit is contained in:
Victor Woeltjen 2015-06-16 15:35:40 -07:00
parent 9942e24039
commit 699cd3bd90

View File

@ -31,6 +31,8 @@ define(
describe("The browse controller", function () {
var mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService,
mockRootObject,
@ -50,6 +52,11 @@ define(
"$scope",
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
[ "path" ]
);
mockObjectService = jasmine.createSpyObj(
"objectService",
[ "getObjects" ]
@ -75,21 +82,25 @@ define(
mockObjectService.getObjects.andReturn(mockPromise({
ROOT: mockRootObject
}));
mockRootObject.useCapability.andReturn(mockPromise([
mockDomainObject
]));
mockDomainObject.getId.andReturn("mine");
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
});
it("uses composition to set the navigated object, if there is none", function () {
mockRootObject.useCapability.andReturn(mockPromise([
mockDomainObject
]));
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
@ -98,12 +109,11 @@ define(
});
it("does not try to override navigation", function () {
// This behavior is needed if object navigation has been
// determined by query string parameters
mockRootObject.useCapability.andReturn(mockPromise([null]));
mockNavigationService.getNavigation.andReturn(mockDomainObject);
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
@ -132,4 +142,4 @@ define(
});
}
);
);