Skip to content

Commit

Permalink
fix(IT Wallet): [SIW-1658] Remove digital version badge from eID card (
Browse files Browse the repository at this point in the history
…#6202)

## Short description
This PR fixes a regression which causes the display of the "Digital
version" badge on eID cards

## List of changes proposed in this pull request
- Removed "Digital version" badge from eID card
- Added tests

## How to test
Navigate to the wallet, check that the eID does not have the "Digital
version" badge on it, both in the wallet and in the details screen
  • Loading branch information
mastro993 authored Sep 20, 2024
1 parent b757031 commit 6489529
Show file tree
Hide file tree
Showing 3 changed files with 645 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
IOBadgeHSpacing,
IOBadgeRadius,
IOBadgeVSpacing,
IOColors,
IOVisualCostants,
makeFontStyleObject
} from "@pagopa/io-app-design-system";
Expand Down Expand Up @@ -40,10 +39,11 @@ const ItwDigitalVersionBadge = ({
}
};

const colorProps = mapCredentialTypes[credentialType] || {
foreground: IOColors["grey-850"],
background: IOColors["grey-100"]
};
const colorProps = mapCredentialTypes[credentialType];
if (!colorProps) {
// If a credential does not have the color configuration means that we should not display the badge
return null;
}

const { background, foreground } = colorProps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import { CredentialType } from "../../utils/itwMocksUtils";
import { ItwCredentialCard, ItwCredentialStatus } from "../ItwCredentialCard";

describe("ItwCredentialCard", () => {
it.each([
"EuropeanHealthInsuranceCard",
"EuropeanDisabilityCard",
"MDL",
"PersonIdentificationData"
])("should match snapshot when credential type is %p", type => {
const component = render(<ItwCredentialCard credentialType={type} />);
expect(component).toMatchSnapshot();
});

it.each([
"valid",
"expired",
Expand All @@ -13,10 +23,7 @@ describe("ItwCredentialCard", () => {
"should match snapshot when status is %p",
status => {
const component = render(
<ItwCredentialCard
credentialType={CredentialType.PID}
status={status}
/>
<ItwCredentialCard credentialType={"MDL"} status={status} />
);
expect(component).toMatchSnapshot();
}
Expand Down
Loading

0 comments on commit 6489529

Please sign in to comment.