[Mobile] Tests

Changed BrowseController and RemoveActionSpec to account
for grandparent and navigation usage. Also changed
RemoveAction variable name.
This commit is contained in:
Shivam Dave 2015-07-29 13:57:11 -07:00
parent bdf8b4d3f1
commit 12ec293f3d
3 changed files with 9 additions and 4 deletions

View File

@ -301,7 +301,7 @@ define(
mockNavigationService mockNavigationService
); );
mockScope.checkRoot(); mockScope.checkRoot();
}); });
// Mocks the back arrow call that // Mocks the back arrow call that

View File

@ -70,8 +70,9 @@ define(
} }
function checkCurrentObjectNavigation(parent) { function checkCurrentObjectNavigation(parent) {
var currParent = navigationService.getNavigation().getCapability('context').getParent(); var currentParent = navigationService.getNavigation()
if (currParent.getId() === parent.getId()) { .getCapability('context').getParent();
if (currentParent.getId() === parent.getId()) {
navigationService.setNavigation(parent); navigationService.setNavigation(parent);
} }
} }

View File

@ -65,6 +65,9 @@ define(
}, },
useCapability: function (k, v) { useCapability: function (k, v) {
return capabilities[k].invoke(v); return capabilities[k].invoke(v);
},
getId: function () {
return "test";
} }
}; };
mockContext = jasmine.createSpyObj("context", [ "getParent" ]); mockContext = jasmine.createSpyObj("context", [ "getParent" ]);
@ -80,13 +83,14 @@ define(
"removeListener" "removeListener"
] ]
); );
mockNavigationService.getNavigation.andReturn(mockDomainObject);
mockDomainObject.getId.andReturn("test"); mockDomainObject.getId.andReturn("test");
mockDomainObject.getCapability.andReturn(mockContext); mockDomainObject.getCapability.andReturn(mockContext);
mockContext.getParent.andReturn(mockParent); mockContext.getParent.andReturn(mockParent);
mockType.hasFeature.andReturn(true); mockType.hasFeature.andReturn(true);
capabilities = { capabilities = {
mutation: mockMutation, mutation: mockMutation,
persistence: mockPersistence, persistence: mockPersistence,