-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GroupByOrgActionMenuItem Component
- Loading branch information
1 parent
76eca3b
commit 0f0bef5
Showing
5 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import PropTypes from 'prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { | ||
Button, | ||
Icon, | ||
} from '@folio/stripes/components'; | ||
|
||
export const GroupByOrgActionMenuItem = ({ | ||
onClick, | ||
}) => { | ||
return ( | ||
<Button | ||
data-testid="group-by-org-button" | ||
buttonStyle="dropdownItem" | ||
onClick={onClick} | ||
> | ||
<Icon icon="house"> | ||
<FormattedMessage id="stripes-acq-components.claiming.action.groupByOrganization" /> | ||
</Icon> | ||
</Button> | ||
); | ||
}; | ||
|
||
GroupByOrgActionMenuItem.propTypes = { | ||
onClick: PropTypes.func.isRequired, | ||
}; |
38 changes: 38 additions & 0 deletions
38
lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
render, | ||
screen, | ||
} from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
import { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem'; | ||
|
||
const defaultProps = { | ||
onClick: jest.fn(), | ||
}; | ||
|
||
const renderComponent = (props = {}) => render( | ||
<GroupByOrgActionMenuItem | ||
{...defaultProps} | ||
{...props} | ||
/>, | ||
); | ||
|
||
describe('GroupByOrgActionMenuItem', () => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should render the button', () => { | ||
renderComponent(); | ||
|
||
expect(screen.getByTestId('group-by-org-button')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should call onClick when button is clicked', async () => { | ||
renderComponent(); | ||
|
||
await userEvent.click(screen.getByTestId('group-by-org-button')); | ||
|
||
expect(defaultProps.onClick).toHaveBeenCalled(); | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
lib/claiming/components/menu-items/GroupByOrgActionMenuItem/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { DelayClaimActionMenuItem } from './DelayClaimActionMenuItem'; | ||
export { MarkUnreceivableActionMenuItem } from './MarkUnreceivableActionMenuItem'; | ||
export { SendClaimActionMenuItem } from './SendClaimActionMenuItem'; | ||
export { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters