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

2910 ic badge dark mode info variant icons are showing as the wrong colour #2942

Merged
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/react/src/component-tests/IcBadge/IcBadge.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
PositionNear,
PositionInline,
ThemeDark,
ThemeDarkIcon,
} from "./IcBadgeTestData";
import { setThresholdBasedOnEnv } from "../../../cypress/utils/helpers";

Expand Down Expand Up @@ -196,6 +197,18 @@ describe("IcBadge visual regression and a11y tests", () => {
testThreshold: setThresholdBasedOnEnv(DEFAULT_TEST_THRESHOLD),
});
});

it("should render badge with dark theme and icon", () => {
mount(<ThemeDarkIcon />);

cy.checkHydrated(IC_BADGE_SELECTOR);

cy.checkA11yWithWait();
cy.compareSnapshot({
name: "theme-dark-icon",
testThreshold: setThresholdBasedOnEnv(DEFAULT_TEST_THRESHOLD),
});
});
});

describe.skip("IcBadge visual regression tests in high contrast mode", () => {
Expand Down
73 changes: 73 additions & 0 deletions packages/react/src/component-tests/IcBadge/IcBadgeTestData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,76 @@ export const ThemeDark = (): ReactElement => {
</div>
);
};

export const ThemeDarkIcon = (): ReactElement => {
return (
<div style={{ backgroundColor: "black", padding: "16px" }}>
<IcButton
variant="secondary"
theme="dark"
monochrome
style={{ marginRight: "16px" }}
>
<IcBadge type="icon" slot="badge" theme="dark">
<ReusableSlottedIcon />
</IcBadge>
Neutral
</IcButton>
<IcButton
variant="secondary"
theme="dark"
monochrome
style={{ marginRight: "16px" }}
>
<IcBadge type="icon" slot="badge" theme="dark" variant="light">
<ReusableSlottedIcon />
</IcBadge>
Light
</IcButton>
<IcButton
variant="secondary"
theme="dark"
monochrome
style={{ marginRight: "16px" }}
>
<IcBadge type="icon" slot="badge" theme="dark" variant="error">
<ReusableSlottedIcon />
</IcBadge>
Error
</IcButton>
<IcButton
variant="secondary"
theme="dark"
monochrome
style={{ marginRight: "16px" }}
>
<IcBadge type="icon" slot="badge" theme="dark" variant="success">
<ReusableSlottedIcon />
</IcBadge>
Success
</IcButton>
<IcButton
variant="secondary"
theme="dark"
monochrome
style={{ marginRight: "16px" }}
>
<IcBadge type="icon" slot="badge" theme="dark" variant="warning">
<ReusableSlottedIcon />
</IcBadge>
Warning
</IcButton>
<IcButton
variant="secondary"
theme="dark"
monochrome
style={{ marginRight: "16px" }}
>
<IcBadge type="icon" slot="badge" theme="dark" variant="info">
<ReusableSlottedIcon />
</IcBadge>
Info
</IcButton>
</div>
);
};
4 changes: 2 additions & 2 deletions packages/web-components/src/global/color-mode.css
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ ic-theme,

/* Badge */
--ic-badge-text: var(--ic-color-text-inverse);
--ic-badge-icon: var(--ic-color-icon-inverted);
--ic-badge-icon: var(--ic-color-icon-neutral);
--ic-badge-warning-text: var(--ic-color-text-inverse);
--ic-badge-warning-icon: var(--ic-color-icon-neutral);
--ic-badge-text-monochrome: var(--ic-color-text-primary);
Expand Down Expand Up @@ -3073,7 +3073,7 @@ ic-theme,

/* Badge */
--ic-badge-text: var(--ic-color-text-inverse);
--ic-badge-icon: var(--ic-color-icon-inverted);
--ic-badge-icon: var(--ic-color-icon-neutral);
--ic-badge-warning-text: var(--ic-color-text-inverse);
--ic-badge-warning-icon: var(--ic-color-icon-neutral);
--ic-badge-text-monochrome: var(--ic-color-text-primary);
Expand Down
Loading