Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into fix/PN-13250
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaCimini90 committed Feb 20, 2025
2 parents 8502559 + 9d9a15d commit 20b6942
Show file tree
Hide file tree
Showing 57 changed files with 946 additions and 223 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,48 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.12.0](https://github.com/pagopa/pn-frontend/compare/v2.12.0-RC.1...v2.12.0) (2025-02-18)

**Note:** Version bump only for package pn-frontend





# [2.12.0-RC.1](https://github.com/pagopa/pn-frontend/compare/v2.12.0-RC.0...v2.12.0-RC.1) (2025-02-05)

**Note:** Version bump only for package pn-frontend





# [2.12.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.11.1...v2.12.0-RC.0) (2025-02-04)


### Bug Fixes

* **pn-13210:** manage accessibility when closing modal ([#1451](https://github.com/pagopa/pn-frontend/issues/1451)) ([2b4981b](https://github.com/pagopa/pn-frontend/commit/2b4981bddc8f6651ac47bb2cf371f63e33962959))
* **pn-13211:** Removed redirect when login fails ([#1445](https://github.com/pagopa/pn-frontend/issues/1445)) ([6ff0d2a](https://github.com/pagopa/pn-frontend/commit/6ff0d2aec98f161d5f23e7af49e41c31c7a7dcb7))
* **pn-13213:** aria label for payments and statistics checkboxes ([#1450](https://github.com/pagopa/pn-frontend/issues/1450)) ([0d4d250](https://github.com/pagopa/pn-frontend/commit/0d4d25007aa3c2012c6bd3cba235cc32e8d65be1))
* **pn-13214:** inactivity handler accessibility ([#1454](https://github.com/pagopa/pn-frontend/issues/1454)) ([7af07bd](https://github.com/pagopa/pn-frontend/commit/7af07bdc5861815ae484e0856d17f80ec3ac6096))
* **pn-13216:** Added descriptions to radio buttons ([#1444](https://github.com/pagopa/pn-frontend/issues/1444)) ([9fb7b79](https://github.com/pagopa/pn-frontend/commit/9fb7b79a755c6850d9ec2ffbb62aff60ec88e7a1))
* **pn-13255:** fixed aria attributes on the modal for revoking the delegation ([#1453](https://github.com/pagopa/pn-frontend/issues/1453)) ([cf2bfd9](https://github.com/pagopa/pn-frontend/commit/cf2bfd9844c412aa7f881a833c2fcaae01650355))
* **pn-13591:** Handle Calendar for a11y ([#1448](https://github.com/pagopa/pn-frontend/issues/1448)) ([7be12df](https://github.com/pagopa/pn-frontend/commit/7be12dfb572f2eb50e3f857d78174410b1a181ac))
* **pn-13593:** screen reader doesn't read api key value ([#1449](https://github.com/pagopa/pn-frontend/issues/1449)) ([7b11fb7](https://github.com/pagopa/pn-frontend/commit/7b11fb7ceb22d46bfd4dcea6bcbb6e1a2c3f85ae))
* **pn-13596:** screen reader doesn't read notification status tooltip on mobile ([#1439](https://github.com/pagopa/pn-frontend/issues/1439)) ([b28f472](https://github.com/pagopa/pn-frontend/commit/b28f47258e5bd3cf4d9a2a3c95b86bfb42114ce8))
* **pn-13598:** accessibility for the delegation tag group ([#1452](https://github.com/pagopa/pn-frontend/issues/1452)) ([a8626a2](https://github.com/pagopa/pn-frontend/commit/a8626a27ca23f9de030bc0b51d825d685bcee737))


### Features

* **pn-13215:** Screen reader doesn't read all the attachments in timeline ([#1442](https://github.com/pagopa/pn-frontend/issues/1442)) ([877bf49](https://github.com/pagopa/pn-frontend/commit/877bf49c486485f9e0ce6b04b6423a78824180e8))
* **pn-13595:** removed automatic redirect before logout ([#1456](https://github.com/pagopa/pn-frontend/issues/1456)) ([c7d823f](https://github.com/pagopa/pn-frontend/commit/c7d823f72e9e64eeeccfcafebb0b05f4b188959c))





## [2.11.1](https://github.com/pagopa/pn-frontend/compare/v2.11.0...v2.11.1) (2025-01-31)

**Note:** Version bump only for package pn-frontend
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "2.11.1",
"version": "2.12.0",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
37 changes: 37 additions & 0 deletions packages/pn-commons/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.12.0](https://github.com/pagopa/pn-frontend/compare/v2.12.0-RC.1...v2.12.0) (2025-02-18)

**Note:** Version bump only for package @pagopa-pn/pn-commons





# [2.12.0-RC.1](https://github.com/pagopa/pn-frontend/compare/v2.12.0-RC.0...v2.12.0-RC.1) (2025-02-05)

**Note:** Version bump only for package @pagopa-pn/pn-commons





# [2.12.0-RC.0](https://github.com/pagopa/pn-frontend/compare/v2.11.1...v2.12.0-RC.0) (2025-02-04)


### Bug Fixes

* **pn-13210:** manage accessibility when closing modal ([#1451](https://github.com/pagopa/pn-frontend/issues/1451)) ([2b4981b](https://github.com/pagopa/pn-frontend/commit/2b4981bddc8f6651ac47bb2cf371f63e33962959))
* **pn-13213:** aria label for payments and statistics checkboxes ([#1450](https://github.com/pagopa/pn-frontend/issues/1450)) ([0d4d250](https://github.com/pagopa/pn-frontend/commit/0d4d25007aa3c2012c6bd3cba235cc32e8d65be1))
* **pn-13214:** inactivity handler accessibility ([#1454](https://github.com/pagopa/pn-frontend/issues/1454)) ([7af07bd](https://github.com/pagopa/pn-frontend/commit/7af07bdc5861815ae484e0856d17f80ec3ac6096))
* **pn-13591:** Handle Calendar for a11y ([#1448](https://github.com/pagopa/pn-frontend/issues/1448)) ([7be12df](https://github.com/pagopa/pn-frontend/commit/7be12dfb572f2eb50e3f857d78174410b1a181ac))
* **pn-13596:** screen reader doesn't read notification status tooltip on mobile ([#1439](https://github.com/pagopa/pn-frontend/issues/1439)) ([b28f472](https://github.com/pagopa/pn-frontend/commit/b28f47258e5bd3cf4d9a2a3c95b86bfb42114ce8))
* **pn-13598:** accessibility for the delegation tag group ([#1452](https://github.com/pagopa/pn-frontend/issues/1452)) ([a8626a2](https://github.com/pagopa/pn-frontend/commit/a8626a27ca23f9de030bc0b51d825d685bcee737))


### Features

* **pn-13215:** Screen reader doesn't read all the attachments in timeline ([#1442](https://github.com/pagopa/pn-frontend/issues/1442)) ([877bf49](https://github.com/pagopa/pn-frontend/commit/877bf49c486485f9e0ce6b04b6423a78824180e8))





## [2.11.1](https://github.com/pagopa/pn-frontend/compare/v2.11.0...v2.11.1) (2025-01-31)

**Note:** Version bump only for package @pagopa-pn/pn-commons
Expand Down
2 changes: 1 addition & 1 deletion packages/pn-commons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pagopa-pn/pn-commons",
"version": "2.11.1",
"version": "2.12.0",
"private": true,
"main": "./src/index.ts",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const FormattedDateAndTime: React.FC<{ date: string; inTwoLines?: boolean }> = (
<Typography variant="body2">{formatDateTime(date)}</Typography>
);
}
return <Typography variant="body2">-</Typography>;
return (
<Typography variant="body2">
{getLocalizedOrDefaultLabel('appStatus', 'appStatus.missed-endDate')}
</Typography>
);
};

const DowntimeLogDataSwitch: React.FC<{
Expand Down
1 change: 0 additions & 1 deletion packages/pn-commons/src/components/CustomTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const CustomTooltip: React.FC<Props> = ({
onOpen,
tooltipProps,
}) => {
// tooltip state
const [open, setOpen] = useState(false);
const handleTooltipClose = () => {
if (openOnClick) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Box, SxProps, TableCell } from '@mui/material';
import { SxProps, TableCell } from '@mui/material';
import { ButtonNaked } from '@pagopa/mui-italia';

import { buttonNakedInheritStyle } from '../../../utility';

export type PnTableBodyCellProps = {
Expand All @@ -23,17 +22,14 @@ const PnTableBodyCell: React.FC<PnTableBodyCellProps> = ({
...cellProps!,
borderBottom: 'none',
}}
onClick={onClick}
>
{onClick && (
<>
{/* Even there is a onClick function on the TableCell, leave ButtonNaked below as is.
This makes spacebar key with accessibility to trigger the onClick function.
The ButtonNaked "inherits" the onClick action from the outer TableCell, so that is not necessary to replicate it. */}
<ButtonNaked sx={buttonNakedInheritStyle}>{children}</ButtonNaked>
</>
{onClick ? (
<ButtonNaked onClick={onClick} sx={buttonNakedInheritStyle}>
{children}
</ButtonNaked>
) : (
<>{children}</>
)}
{!onClick && <Box>{children}</Box>}
</TableCell>
);
export default PnTableBodyCell;
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { vi } from 'vitest';

import { disableConsoleLogging, fireEvent, render } from '../../../../test-utils';
import { disableConsoleLogging, fireEvent, render, within } from '../../../../test-utils';
import PnTableBodyCell from '../PnTableBodyCell';

describe('PnTableBodyCell', () => {
disableConsoleLogging('error');

const mockFn = vi.fn();

it('render component', () => {
const { container, queryByTestId } = render(
<PnTableBodyCell>mocke-cell-content</PnTableBodyCell>
<PnTableBodyCell>mocked-cell-content</PnTableBodyCell>
);
expect(container).toHaveTextContent(/mocke-cell-content/);
expect(container).toHaveTextContent(/mocked-cell-content/);
const buttons = queryByTestId('cell.button');
expect(buttons).not.toBeInTheDocument();
});

it('click cell event', () => {
const { getByTestId } = render(
<PnTableBodyCell testId="cell" onClick={() => mockFn()}>
mocke-cell-content
mocked-cell-content
</PnTableBodyCell>
);
const cell = getByTestId('cell');
fireEvent.click(cell);
expect(mockFn).toBeCalledTimes(1);
const button = within(cell).getByRole('button');
fireEvent.click(button);
expect(mockFn).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ const RenderSmartData: React.FC<{
<SmartBodyCell
key={column.id.toString()}
columnId={column.id}
tableProps={{
onClick: column.tableConfiguration.onClick,
}}
tableProps={{ onClick: column.tableConfiguration.onClick }}
cardProps={column.cardConfiguration}
isCardHeader={column.cardConfiguration?.isCardHeader}
testId="rowCell"
Expand Down Expand Up @@ -160,13 +158,14 @@ describe('SmartData', () => {
const sortableColumn = smartCfg.find((cfg) => cfg.tableConfiguration.sortable);
const sortToggle = within(table).getByTestId(`headerCellDesktop.sort.${sortableColumn!.id}`);
fireEvent.click(sortToggle);
expect(handleSort).toBeCalledTimes(1);
expect(handleSort).toHaveBeenCalledTimes(1);
const clickableColumnIdx = smartCfg.findIndex((cfg) => cfg.tableConfiguration.onClick);
const rows = within(table).getAllByTestId('bodyRowDesktop');
// we can take the row we want
const cells = within(rows[0]).getAllByTestId('rowCellDesktop');
fireEvent.click(cells[clickableColumnIdx]);
expect(handleColumnClick).toBeCalledTimes(1);
const button = within(cells[clickableColumnIdx]).getByRole('button');
fireEvent.click(button);
expect(handleColumnClick).toHaveBeenCalledTimes(1);
});

it('no sort available (desktop version)', () => {
Expand All @@ -193,6 +192,6 @@ describe('SmartData', () => {
const action = cardActions[0];
expect(action).toHaveTextContent('Mocked action');
fireEvent.click(action);
expect(clickActionMockFn).toBeCalledTimes(1);
expect(clickActionMockFn).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ describe('PnTable Component', () => {
const sortButton = within(firstColumn).getByRole('button');
expect(sortButton).toBeInTheDocument();
fireEvent.click(sortButton);
expect(handleSort).toBeCalledTimes(1);
expect(handleSort).toBeCalledWith({ order: 'desc', orderBy: 'column-1' });
expect(handleSort).toHaveBeenCalledTimes(1);
expect(handleSort).toHaveBeenCalledWith({ order: 'desc', orderBy: 'column-1' });
});

it('click on a column', () => {
Expand All @@ -121,8 +121,8 @@ describe('PnTable Component', () => {
const firstRow = within(tableBody).getAllByTestId('table-test.body.row')[0];
const tableColumns = within(firstRow).getAllByTestId('table-test.body.row.cell');
fireEvent.click(tableColumns[2].querySelectorAll('button')[0]);
expect(handleColumnClick).toBeCalledTimes(1);
expect(handleColumnClick).toBeCalledWith(rows[0], columns[2].id);
expect(handleColumnClick).toHaveBeenCalledTimes(1);
expect(handleColumnClick).toHaveBeenCalledWith(rows[0], columns[2].id);
});

it('render component - multiple PnTableBody', () => {
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('PnTable Component', () => {
</PnTableBody>
</PnTable>
)
).toThrowError('PnTable can have only 1 child of type PnTableHeader');
).toThrow('PnTable can have only 1 child of type PnTableHeader');
});

it('render component - multiple PnTableHeader', () => {
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('PnTable Component', () => {
</PnTableHeader>
</PnTable>
)
).toThrowError('PnTable can have only 1 child of type PnTableHeader');
).toThrow('PnTable can have only 1 child of type PnTableHeader');
});

it('render component - incorrect child', () => {
Expand All @@ -211,7 +211,7 @@ describe('PnTable Component', () => {
<Box>Incorrect child</Box>
</PnTable>
)
).toThrowError(
).toThrow(
'PnTable can have only 1 child of type PnTableHeader and 1 child of type PnTableBody'
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ const RenderSmartable: React.FC<{
<SmartBodyCell
key={column.id.toString()}
columnId={column.id}
tableProps={{
onClick: column.tableConfiguration.onClick,
}}
tableProps={{ onClick: column.tableConfiguration.onClick }}
cardProps={column.cardConfiguration}
isCardHeader={column.cardConfiguration?.isCardHeader}
>
Expand Down Expand Up @@ -153,10 +151,10 @@ describe('Smart Table Component', () => {
const itemsPerPageSelectorBtn = itemsPerPageSelector.querySelector('button');
fireEvent.click(itemsPerPageSelectorBtn!);
const itemsPerPageList = getAllByRole('menuitem');
fireEvent.click(itemsPerPageList[1]!);
fireEvent.click(itemsPerPageList[1]);
await waitFor(() => {
expect(handleChangePagination).toBeCalledTimes(1);
expect(handleChangePagination).toBeCalledWith({
expect(handleChangePagination).toHaveBeenCalledTimes(1);
expect(handleChangePagination).toHaveBeenCalledWith({
size: 20,
page: 0,
totalElements: 100,
Expand All @@ -168,8 +166,8 @@ describe('Smart Table Component', () => {
// the buttons are < 1 2 3 >
fireEvent.click(pageButtons[2]);
await waitFor(() => {
expect(handleChangePagination).toBeCalledTimes(2);
expect(handleChangePagination).toBeCalledWith({
expect(handleChangePagination).toHaveBeenCalledTimes(2);
expect(handleChangePagination).toHaveBeenCalledWith({
size: 20,
page: 1,
totalElements: 100,
Expand Down Expand Up @@ -208,9 +206,7 @@ describe('Smart Table Component', () => {
<SmartBodyCell
key={column.id.toString()}
columnId={column.id}
tableProps={{
onClick: column.tableConfiguration.onClick,
}}
tableProps={{ onClick: column.tableConfiguration.onClick }}
cardProps={column.cardConfiguration}
isCardHeader={column.cardConfiguration?.isCardHeader}
>
Expand All @@ -227,9 +223,7 @@ describe('Smart Table Component', () => {
<SmartBodyCell
key={column.id.toString()}
columnId={column.id}
tableProps={{
onClick: column.tableConfiguration.onClick,
}}
tableProps={{ onClick: column.tableConfiguration.onClick }}
cardProps={column.cardConfiguration}
isCardHeader={column.cardConfiguration?.isCardHeader}
>
Expand All @@ -241,7 +235,7 @@ describe('Smart Table Component', () => {
</SmartBody>
</SmartTable>
)
).toThrowError('SmartTable can have only 1 child of type SmartBody');
).toThrow('SmartTable can have only 1 child of type SmartBody');
});

it('render component - multiple SmartHeader', () => {
Expand Down Expand Up @@ -272,7 +266,7 @@ describe('Smart Table Component', () => {
</SmartHeader>
</SmartTable>
)
).toThrowError('SmartTable can have only 1 child of type SmartHeader');
).toThrow('SmartTable can have only 1 child of type SmartHeader');
});

it('render component - multiple SmartFilter', () => {
Expand Down Expand Up @@ -314,7 +308,7 @@ describe('Smart Table Component', () => {
</SmartHeader>
</SmartTable>
)
).toThrowError('SmartTable can have only 1 child of type SmartFilter');
).toThrow('SmartTable can have only 1 child of type SmartFilter');
});

it('render component - incorrect child', () => {
Expand All @@ -335,7 +329,7 @@ describe('Smart Table Component', () => {
<Box>Incorrect child</Box>
</SmartTable>
)
).toThrowError(
).toThrow(
'SmartTable can have only 1 child of type SmartFilter, 1 child of type SmartHeader and 1 child of type SmartBody'
);
});
Expand Down
Loading

0 comments on commit 20b6942

Please sign in to comment.