[Mobile] Collapse tree on click

Collapse tree any time a user does an action in the
tree that would select an object; don't only do this
on navigation changes, because this fails to detect
occasions where user clicks the already-navigated-to
object.
This commit is contained in:
Victor Woeltjen
2015-09-21 10:53:45 -07:00
parent ae4313253c
commit 0c1f77cfab
9 changed files with 75 additions and 65 deletions

View File

@ -47,7 +47,6 @@ define(
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on", "$emit"]);
mockTimeout = jasmine.createSpy("$timeout");
mockAgentService = jasmine.createSpyObj("agentService", ["isMobile", "isPhone", "getOrientation"]);
mockNgModel = jasmine.createSpyObj("ngModel", ["selectedObject"]);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
@ -196,6 +195,22 @@ define(
expect(controller.isSelected()).toBeFalsy();
});
it("exposes selected objects in scope", function () {
mockScope.domainObject = mockDomainObject;
mockScope.ngModel = {};
controller.select();
expect(mockScope.ngModel.selectedObject)
.toEqual(mockDomainObject);
});
it("invokes optional callbacks upon selection", function () {
mockScope.parameters =
{ callback: jasmine.createSpy('callback') };
controller.select();
expect(mockScope.parameters.callback).toHaveBeenCalled();
});
});
}
);