fix(core): Typo in menu.client.service.js (#1355)

* fixed typo in modules/core/client/services/menu.client.service.js
* fixed typo in modules/core/tests/client/menu.client.service.tests.js
This commit is contained in:
Aman Mavai
2016-06-06 17:59:46 +05:30
committed by Liran Tal
parent c8cbcd326f
commit fde27f0d1e
2 changed files with 22 additions and 22 deletions

View File

@@ -17,7 +17,7 @@
removeMenu: removeMenu,
removeMenuItem: removeMenuItem,
removeSubMenuItem: removeSubMenuItem,
validateMenuExistance: validateMenuExistance
validateMenuExistence: validateMenuExistence
};
init();
@@ -44,7 +44,7 @@
options = options || {};
// Validate that the menu exists
service.validateMenuExistance(menuId);
service.validateMenuExistence(menuId);
// Push new menu item
service.menus[menuId].items.push({
@@ -76,7 +76,7 @@
options = options || {};
// Validate that the menu exists
service.validateMenuExistance(menuId);
service.validateMenuExistence(menuId);
// Search for menu item
for (var itemIndex in service.menus[menuId].items) {
@@ -99,7 +99,7 @@
// Get the menu object by menu id
function getMenu(menuId) {
// Validate that the menu exists
service.validateMenuExistance(menuId);
service.validateMenuExistence(menuId);
// Return the menu object
return service.menus[menuId];
@@ -138,7 +138,7 @@
// Remove existing menu object by menu id
function removeMenu(menuId) {
// Validate that the menu exists
service.validateMenuExistance(menuId);
service.validateMenuExistence(menuId);
delete service.menus[menuId];
}
@@ -146,7 +146,7 @@
// Remove existing menu object by menu id
function removeMenuItem(menuId, menuItemState) {
// Validate that the menu exists
service.validateMenuExistance(menuId);
service.validateMenuExistence(menuId);
// Search for menu item to remove
for (var itemIndex in service.menus[menuId].items) {
@@ -162,7 +162,7 @@
// Remove existing menu object by menu id
function removeSubMenuItem(menuId, submenuItemState) {
// Validate that the menu exists
service.validateMenuExistance(menuId);
service.validateMenuExistence(menuId);
// Search for menu item to remove
for (var itemIndex in service.menus[menuId].items) {
@@ -180,7 +180,7 @@
}
// Validate menu existance
function validateMenuExistance(menuId) {
function validateMenuExistence(menuId) {
if (menuId && menuId.length) {
if (service.menus[menuId]) {
return true;

View File

@@ -119,17 +119,17 @@
});
});
describe('validateMenuExistance', function() {
describe('validateMenuExistence', function() {
describe('when menuId not provided', function() {
it('should throw menuId error', function() {
expect(menuService.validateMenuExistance).toThrowError('MenuId was not provided');
expect(menuService.validateMenuExistence).toThrowError('MenuId was not provided');
});
});
describe('when menu does not exist', function() {
it('should throw no menu error', function() {
var target = function() {
menuService.validateMenuExistance('noMenuId');
menuService.validateMenuExistence('noMenuId');
};
expect(target).toThrowError('Menu does not exist');
});
@@ -142,7 +142,7 @@
});
it('should return truthy', function() {
expect(menuService.validateMenuExistance(menuId)).toBeTruthy();
expect(menuService.validateMenuExistence(menuId)).toBeTruthy();
});
});
});
@@ -153,7 +153,7 @@
};
beforeEach(function() {
menuService.menus[menu.id] = menu;
menuService.validateMenuExistance = jasmine.createSpy();
menuService.validateMenuExistence = jasmine.createSpy();
menuService.removeMenu(menu.id);
});
@@ -162,7 +162,7 @@
});
it('validates menu existance before removing', function() {
expect(menuService.validateMenuExistance).toHaveBeenCalledWith(menu.id);
expect(menuService.validateMenuExistence).toHaveBeenCalledWith(menu.id);
});
});
@@ -188,7 +188,7 @@
menuItem;
beforeEach(function() {
menuService.validateMenuExistance = jasmine.createSpy();
menuService.validateMenuExistence = jasmine.createSpy();
menuService.addSubMenuItem = jasmine.createSpy();
menuService.addMenu(menuId, {
roles: ['a', 'b']
@@ -198,7 +198,7 @@
});
it('should validate menu existance', function() {
expect(menuService.validateMenuExistance).toHaveBeenCalledWith(menuId);
expect(menuService.validateMenuExistence).toHaveBeenCalledWith(menuId);
});
it('should return the menu', function() {
@@ -278,7 +278,7 @@
menuService.addMenu(menuId);
menuService.addMenuItem(menuId, { state: menuItemState });
menuService.addMenuItem(menuId, { state: menuItemState2 });
menuService.validateMenuExistance = jasmine.createSpy();
menuService.validateMenuExistence = jasmine.createSpy();
menu = menuService.removeMenuItem(menuId, menuItemState);
});
@@ -287,7 +287,7 @@
});
it('should validate menu existance', function() {
expect(menuService.validateMenuExistance).toHaveBeenCalledWith(menuId);
expect(menuService.validateMenuExistence).toHaveBeenCalledWith(menuId);
});
it('should remove sub menu items with same state', function() {
@@ -324,7 +324,7 @@
menu;
beforeEach(function() {
menuService.validateMenuExistance = jasmine.createSpy();
menuService.validateMenuExistence = jasmine.createSpy();
menuService.addMenu(menuId);
menuService.addMenuItem(menuId, menuItem1Options);
menuService.addMenuItem(menuId, menuItem2Options);
@@ -347,7 +347,7 @@
});
it('should validate menu existance', function() {
expect(menuService.validateMenuExistance).toHaveBeenCalledWith(menuId);
expect(menuService.validateMenuExistence).toHaveBeenCalledWith(menuId);
});
it('should not add sub menu item to menu item of different state', function() {
@@ -408,12 +408,12 @@
describe('then removeSubMenuItem', function() {
beforeEach(function() {
menuService.validateMenuExistance = jasmine.createSpy();
menuService.validateMenuExistence = jasmine.createSpy();
menu = menuService.removeSubMenuItem(menuId, subItem1.state);
});
it('should validate menu existance', function() {
expect(menuService.validateMenuExistance).toHaveBeenCalledWith(menuId);
expect(menuService.validateMenuExistence).toHaveBeenCalledWith(menuId);
});
it('should return menu object', function() {