[Mobile] Restore browse controller from master

This commit is contained in:
Victor Woeltjen 2015-09-17 17:42:23 -07:00
parent 2090b1a958
commit 19500c2704
2 changed files with 10 additions and 35 deletions

View File

@ -65,6 +65,7 @@ define(
// path to new, addressed, path based on
// domainObject
$location.path(urlService.urlForLocation("browse", domainObject));
}
// Callback for updating the in-scope reference to the object
@ -152,6 +153,7 @@ define(
$scope.$on("$destroy", function () {
navigationService.removeListener(setNavigation);
});
}
return BrowseController;

View File

@ -39,9 +39,6 @@ define(
mockUrlService,
mockDomainObject,
mockNextObject,
mockParentContext,
mockParent,
mockGrandparent,
controller;
function mockPromise(value) {
@ -55,7 +52,7 @@ define(
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
[ "$on", "$watch", "treeSlide", "backArrow" ]
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
@ -92,17 +89,6 @@ define(
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockParentContext = jasmine.createSpyObj('context', ['getParent']);
mockParent = jasmine.createSpyObj(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockGrandparent = jasmine.createSpyObj(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockObjectService.getObjects.andReturn(mockPromise({
ROOT: mockRootObject
}));
@ -160,25 +146,12 @@ define(
expect(mockScope.navigatedObject).toEqual(mockDomainObject);
});
// Mocks the tree slide call that
// lets the html code know if the
// tree menu is open.
it("calls the treeSlide function", function () {
expect(mockScope.$on).toHaveBeenCalledWith(
"select-obj",
jasmine.any(Function)
);
mockScope.$on.calls[1].args[1]();
});
it("releases its navigation listener when its scope is destroyed", function () {
expect(mockScope.$on).toHaveBeenCalledWith(
"$destroy",
jasmine.any(Function)
);
mockScope.$on.calls[0].args[1]();
mockScope.$on.mostRecentCall.args[1]();
// Should remove the listener it added earlier
expect(mockNavigationService.removeListener).toHaveBeenCalledWith(
mockNavigationService.addListener.mostRecentCall.args[0]