diff options
author | 7PH <benjamin.raymond@sonarsource.com> | 2023-06-28 10:25:09 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-06-30 20:03:15 +0000 |
commit | c741c3417d8e0be18a121d3ae81e889d6e84463d (patch) | |
tree | a1094fcbf118c9001c5e5a4b17fefcf4215f9143 | |
parent | 54d481bd526212e4c2a7fd776c706f7f02123426 (diff) | |
download | sonarqube-c741c3417d8e0be18a121d3ae81e889d6e84463d.tar.gz sonarqube-c741c3417d8e0be18a121d3ae81e889d6e84463d.zip |
SONAR-19711 Move security report page tab buttons to the new UI
-rw-r--r-- | server/sonar-web/design-system/src/components/Card.tsx | 7 | ||||
-rw-r--r-- | server/sonar-web/design-system/src/components/__tests__/Card-test.tsx | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/server/sonar-web/design-system/src/components/Card.tsx b/server/sonar-web/design-system/src/components/Card.tsx index f45cfe02bd4..3a00a11b6b2 100644 --- a/server/sonar-web/design-system/src/components/Card.tsx +++ b/server/sonar-web/design-system/src/components/Card.tsx @@ -22,15 +22,14 @@ import * as React from 'react'; import tw from 'twin.macro'; import { themeBorder, themeColor } from '../helpers/theme'; -interface CardProps { +interface CardProps extends React.HTMLAttributes<HTMLDivElement> { children: React.ReactNode; - className?: string; } export function Card(props: CardProps) { - const { className, children } = props; + const { children, ...rest } = props; - return <CardStyled className={className}>{children}</CardStyled>; + return <CardStyled {...rest}>{children}</CardStyled>; } const CardStyled = styled.div` diff --git a/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx index 04b58a7dcba..5d3c5a28b7a 100644 --- a/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx +++ b/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx @@ -32,7 +32,12 @@ it('renders card correctly', () => { }); it('renders card correctly with classNames', () => { - render(<Card className="sw-bg-black sw-border-8">Hello</Card>); + render( + <Card className="sw-bg-black sw-border-8" role="tabpanel"> + Hello + </Card> + ); const cardContent = screen.getByText('Hello'); expect(cardContent).toHaveClass('sw-bg-black sw-border-8'); + expect(cardContent).toHaveAttribute('role', 'tabpanel'); }); |