Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UISACQCOMP-240 Add GroupByOrgActionMenuItem action button for claims #847

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Move reusable claiming code from `ui-receiving` to the shared library. Refs UISACQCOMP-236.
* Support `CLAIMS` export type in the `useIntegrationConfigs` hook. Refs UISACQCOMP-238.
* Exclude unsupported currencies on `getInvoiceExportData`. Refs UISACQCOMP-237.
* Add `GroupByOrgActionMenuItem` action button. Refs UICLAIM-2.

## [6.0.3](https://github.com/folio-org/stripes-acq-components/tree/v6.0.3) (2024-12-27)
[Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v6.0.2...v6.0.3)
Expand Down
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,
};
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();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem';
1 change: 1 addition & 0 deletions lib/claiming/components/menu-items/index.js
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';
1 change: 1 addition & 0 deletions translations/stripes-acq-components/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"receiving.itemStatus.Order closed": "Order closed",
"receiving.itemStatus.Undefined": "Undefined",

"claiming.action.groupByOrganization": "Group by organization",
"claiming.action.sendClaim": "Send claim",
"claiming.action.delayClaim": "Delay claim",
"claiming.action.unreceivable": "Unreceivable",
Expand Down
Loading