Skip to content

Commit

Permalink
Merge pull request #803 from IPG-Automotive-UK/bug/TD-1300-prevent-la…
Browse files Browse the repository at this point in the history
…bel-chip-clickable-in-detail-card-view

TD-1300 Label Chip in Detail Card
  • Loading branch information
jegasriskantha authored Jan 8, 2024
2 parents d51e32a + d7f4368 commit 21bc801
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
9 changes: 1 addition & 8 deletions src/Card/DetailCard/DetailCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import DetailCard from "./DetailCard";
import FileCard from "../FileCard/FileCard";
import React from "react";
import { action } from "@storybook/addon-actions";
import userEvent from "@testing-library/user-event";

// a set of default inputs so that tests can change what theyre testing
const defaultInputs = {
Expand Down Expand Up @@ -34,7 +33,7 @@ describe("DetailCard", () => {
});

// test that detail card renders with label that can be clicked
it("renders label and can be clicked", async () => {
it("renders label and can be clicked", () => {
const labels = [
{
_id: "1",
Expand All @@ -55,12 +54,6 @@ describe("DetailCard", () => {
);
// expect label to be in the document
expect(screen.getByText("National Highways")).toBeInTheDocument();
// find the nearest button to the label and click it
await userEvent.click(
screen.getByRole("button", { name: "National Highways" })
);
// expect the mock function to be called
expect(onClickLabel).toHaveBeenCalled();
});

// test that image is rendered in detail card
Expand Down
3 changes: 0 additions & 3 deletions src/Card/DetailCard/DetailCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ function LableStack({
<Fragment>
{labels?.map(label => (
<LabelChip
clickable
color={label.color}
key={label._id}
label={label.name}
Expand All @@ -371,7 +370,6 @@ function LableStack({
<Fragment>
{notOverflowingLabels?.map(label => (
<LabelChip
clickable
color={label.color}
key={label._id}
label={label.name}
Expand Down Expand Up @@ -417,7 +415,6 @@ function LableStack({
if (!notOverflowingLabels?.includes(label)) {
return (
<LabelChip
clickable
key={label._id}
label={label.name}
color={label.color}
Expand Down

0 comments on commit 21bc801

Please sign in to comment.