[Mobile] Test
BrowseController test adjusted to repeat less code.
This commit is contained in:
@@ -39,6 +39,9 @@ define(
|
|||||||
mockUrlService,
|
mockUrlService,
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
mockNextObject,
|
mockNextObject,
|
||||||
|
mockParentContext,
|
||||||
|
mockParent,
|
||||||
|
mockGrandparent,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
@@ -88,6 +91,17 @@ define(
|
|||||||
"nextObject",
|
"nextObject",
|
||||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
[ "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({
|
mockObjectService.getObjects.andReturn(mockPromise({
|
||||||
ROOT: mockRootObject
|
ROOT: mockRootObject
|
||||||
@@ -246,25 +260,7 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("checks if the user is current navigated to the root", function () {
|
it("checks if the user is current navigated to the root", function () {
|
||||||
var mockContext = jasmine.createSpyObj('context', ['getParent']),
|
var mockContext = jasmine.createSpyObj('context', ['getParent']);
|
||||||
mockParentContext = jasmine.createSpyObj('context', ['getParent']),
|
|
||||||
mockParent = jasmine.createSpyObj(
|
|
||||||
"domainObject",
|
|
||||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
|
||||||
),
|
|
||||||
mockGrandparent = jasmine.createSpyObj(
|
|
||||||
"domainObject",
|
|
||||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
|
||||||
);
|
|
||||||
mockNavigationService = jasmine.createSpyObj(
|
|
||||||
"navigationService",
|
|
||||||
[
|
|
||||||
"getNavigation",
|
|
||||||
"setNavigation",
|
|
||||||
"addListener",
|
|
||||||
"removeListener"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
mockRoute.current.params.ids = "ROOT/mine";
|
mockRoute.current.params.ids = "ROOT/mine";
|
||||||
mockParent.getId.andReturn("ROOT");
|
mockParent.getId.andReturn("ROOT");
|
||||||
@@ -308,25 +304,7 @@ define(
|
|||||||
// lets the html code know the back
|
// lets the html code know the back
|
||||||
// arrow navigation needs to be done
|
// arrow navigation needs to be done
|
||||||
it("calls the backArrow function", function () {
|
it("calls the backArrow function", function () {
|
||||||
var mockContext = jasmine.createSpyObj('context', ['getParent']),
|
var mockContext = jasmine.createSpyObj('context', ['getParent']);
|
||||||
mockParentContext = jasmine.createSpyObj('context', ['getParent']),
|
|
||||||
mockParent = jasmine.createSpyObj(
|
|
||||||
"domainObject",
|
|
||||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
|
||||||
),
|
|
||||||
mockGrandparent = jasmine.createSpyObj(
|
|
||||||
"domainObject",
|
|
||||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
|
||||||
);
|
|
||||||
mockNavigationService = jasmine.createSpyObj(
|
|
||||||
"navigationService",
|
|
||||||
[
|
|
||||||
"getNavigation",
|
|
||||||
"setNavigation",
|
|
||||||
"addListener",
|
|
||||||
"removeListener"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
mockRoute.current.params.ids = "mine/junk";
|
mockRoute.current.params.ids = "mine/junk";
|
||||||
mockParent.getId.andReturn("mine");
|
mockParent.getId.andReturn("mine");
|
||||||
|
|||||||
Reference in New Issue
Block a user