Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
fix(core): Typo in menu.client.service.js (#1355)
Browse files Browse the repository at this point in the history
* fixed typo in modules/core/client/services/menu.client.service.js
* fixed typo in modules/core/tests/client/menu.client.service.tests.js
  • Loading branch information
amanmavai authored and lirantal committed Jun 6, 2016
1 parent c8cbcd3 commit fde27f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions modules/core/client/services/menu.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
removeMenu: removeMenu,
removeMenuItem: removeMenuItem,
removeSubMenuItem: removeSubMenuItem,
validateMenuExistance: validateMenuExistance
validateMenuExistence: validateMenuExistence
};

init();
Expand All @@ -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({
Expand Down Expand Up @@ -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) {
Expand All @@ -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];
Expand Down Expand Up @@ -138,15 +138,15 @@
// 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];
}

// 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) {
Expand All @@ -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) {
Expand All @@ -180,7 +180,7 @@
}

// Validate menu existance
function validateMenuExistance(menuId) {
function validateMenuExistence(menuId) {
if (menuId && menuId.length) {
if (service.menus[menuId]) {
return true;
Expand Down
28 changes: 14 additions & 14 deletions modules/core/tests/client/menus.client.service.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand All @@ -142,7 +142,7 @@
});

it('should return truthy', function() {
expect(menuService.validateMenuExistance(menuId)).toBeTruthy();
expect(menuService.validateMenuExistence(menuId)).toBeTruthy();
});
});
});
Expand All @@ -153,7 +153,7 @@
};
beforeEach(function() {
menuService.menus[menu.id] = menu;
menuService.validateMenuExistance = jasmine.createSpy();
menuService.validateMenuExistence = jasmine.createSpy();
menuService.removeMenu(menu.id);
});

Expand All @@ -162,7 +162,7 @@
});

it('validates menu existance before removing', function() {
expect(menuService.validateMenuExistance).toHaveBeenCalledWith(menu.id);
expect(menuService.validateMenuExistence).toHaveBeenCalledWith(menu.id);
});
});

Expand All @@ -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']
Expand All @@ -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() {
Expand Down Expand Up @@ -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);
});

Expand All @@ -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() {
Expand Down Expand Up @@ -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);
Expand All @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit fde27f0

Please sign in to comment.