Skip to content

Commit

Permalink
fix(shop): cannot select doran's
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveVanOpstal committed Apr 13, 2016
1 parent b8b4226 commit cdf7461
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/app/build/shop/shop.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ describe('ShopComponent', () => {
let pickedItem1 = { id: 1, group: 'PinkWards' };
let pickedItem2 = { id: 2, group: 'PinkWards' };
let pickedItem3 = {};
let pickedItem4 = { id: 4, group: 'DoransItems' };
let items = {
groups: [
{
MaxGroupOwnable: 2,
key: 'PinkWards'
},
{
MaxGroupOwnable: -1,
key: 'DoransItems'
}
]
};
Expand Down Expand Up @@ -134,10 +139,17 @@ describe('ShopComponent', () => {
expect(component.pickedItems[0]).toHaveEqualContent(pickedItem2);
}));

it('should ignore picked items without a group', inject([ShopComponent], (component) => {
it('should not mark an item as MaxOwnableExceeded when it has no group', inject([ShopComponent], (component) => {
component.pickedItems = [];
component.items = items;
component.itemPicked(pickedItem3);
expect(component.pickedItems[0]).toHaveEqualContent(pickedItem3);
}));

it('should not mark an item as MaxOwnableExceeded when it has a MaxGroupOwnable of -1', inject([ShopComponent], (component) => {
component.pickedItems = [];
component.items = items;
component.itemPicked(pickedItem4);
expect(component.pickedItems[0]).toHaveEqualContent(pickedItem4);
}));
});
2 changes: 1 addition & 1 deletion src/app/build/shop/shop.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class ShopComponent {
}
});

if (pickedGroupCount >= pickedGroupMaxOwnable) {
if (pickedGroupCount >= pickedGroupMaxOwnable && pickedGroupMaxOwnable >= 0) {
return true;
} else {
return false;
Expand Down

0 comments on commit cdf7461

Please sign in to comment.