Skip to content

Commit

Permalink
added test id to button
Browse files Browse the repository at this point in the history
  • Loading branch information
kepsteen committed Oct 10, 2024
1 parent 17269ec commit 1a7dd05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 6 additions & 2 deletions components/AlertNotification/AlertNotification.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ describe('AlertNotification', () => {
}
it('renders the dismiss button correctly', () => {
render(
<Alert variant={AlertVariants.Success} message="test dismiss btn" />,
<Alert
variant={AlertVariants.Success}
message="test dismiss btn"
data-testid="dismiss-icon"
/>,
);

const dismissBtn = screen.getByTestId('dismiss-icon');
const dismissBtn = screen.getByTestId('dismiss-btn');
expect(dismissBtn).toBeInTheDocument();
});
});
6 changes: 2 additions & 4 deletions components/AlertNotification/AlertNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ const Alert = ({
<Button
variant="outline"
className="absolute right-4 top-2 p-1 h-8 bg-transparent"
data-testid="dismiss-btn"
>
<X
className="text-foreground h-full w-full"
data-testid="dismiss-icon"
/>
<X className="text-foreground h-full w-full" />
</Button>
</AlertDefault>
);
Expand Down

0 comments on commit 1a7dd05

Please sign in to comment.