Skip to content

Commit

Permalink
Update ClayManagementToolbar tests | Fixes liferay#481
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Lancha authored and Kien Do committed Feb 21, 2018
1 parent ddc1193 commit 4203949
Showing 1 changed file with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,28 +380,9 @@ describe('ClayManagementToolbar', function() {

it('should render a management toolbar with info button in active state', () => {
managementToolbar = new ClayManagementToolbar({
actionItems: [
{
label: 'Edit',
href: '#editurl',
icon: 'edit',
quickAction: true,
},
{
label: 'Info Button',
href: '#infobutton',
icon: 'info-circle-open',
quickAction: true,
},
{
label: 'Delete',
href: '#deleteurl',
icon: 'trash',
quickAction: true,
},
],
selectable: true,
selectedItems: 1,
showInfoButton: true,
spritemap: spritemap,
totalItems: 10,
});
Expand Down Expand Up @@ -642,4 +623,24 @@ describe('ClayManagementToolbar', function() {
expect.any(Object)
);
});

it('should render a management toolbar with info button in active state and emit an event on infoButton click', () => {
managementToolbar = new ClayManagementToolbar({
selectable: true,
selectedItems: 1,
showInfoButton: true,
spritemap: spritemap,
totalItems: 10,
});

const spy = jest.spyOn(managementToolbar, 'emit');

managementToolbar.refs.infoButton.element.click();

expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledWith(
'infoButtonClicked',
expect.any(Object)
);
});
});

0 comments on commit 4203949

Please sign in to comment.