aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/design-system/src/components/__tests__
diff options
context:
space:
mode:
authorDavid Cho-Lerat <117642976+david-cho-lerat-sonarsource@users.noreply.github.com>2024-10-22 15:19:18 +0200
committersonartech <sonartech@sonarsource.com>2024-10-22 20:03:10 +0000
commitd9f6920331a0f274f1d6227c2af74d6dbfe84aa2 (patch)
tree3228b99c665c03e6c1bf2a1f68d9d90865f8558b /server/sonar-web/design-system/src/components/__tests__
parentc33a6b9956802dfa00133e304326887b901af901 (diff)
downloadsonarqube-d9f6920331a0f274f1d6227c2af74d6dbfe84aa2.tar.gz
sonarqube-d9f6920331a0f274f1d6227c2af74d6dbfe84aa2.zip
SONAR-23206 Remove design-system build to have it as normal code inside sonar-web (#12088)
Co-authored-by: Grégoire Aubert <gregoire.aubert@sonarsource.com> Co-authored-by: Jeremy Davis <jeremy.davis@sonarsource.com>
Diffstat (limited to 'server/sonar-web/design-system/src/components/__tests__')
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Badge-test.tsx36
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Banner-test.tsx50
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/BarChart-test.tsx62
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/BorderlessAccordion-test.tsx53
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Breadcrumbs-test.tsx78
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/BubbleChart-test.tsx90
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/CodeSnippet-test.tsx51
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/CodeSyntaxHighlighter-test.tsx67
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/ColorsLegend-test.tsx57
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/CoverageIndicator-test.tsx42
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Dropdown-test.tsx92
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/DropdownMenu-test.tsx78
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/DuplicationsIndicator-test.tsx41
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/ExecutionFlowAccordion-test.tsx43
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/FacetBox-test.tsx73
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/FacetItem-test.tsx74
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/FavoriteButton-test.tsx56
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/FlowStep-test.tsx34
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/HighlightedSection-test.tsx31
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Histogram-test.tsx52
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/HotspotRating-test.tsx40
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/IssueMessageHighlighting-test.tsx73
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/KeyboardHint-test.tsx64
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/KeyboardHintKeys-test.tsx49
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/LineCoverage-test.tsx60
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx51
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/LineNumber-test.tsx51
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/LineToken-test.tsx42
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/LineWrapper-test.tsx60
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Link-test.tsx130
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx75
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Menu-test.tsx30
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/MenuItem-test.tsx63
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/NavBarTabs-test.tsx79
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/NavLink-test.tsx116
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/NewCodeLegend-test.tsx32
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Pill-test.tsx27
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/QualityGateIndicator-test.tsx54
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/SelectionCard-test.tsx79
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/SizeIndicator-test.tsx40
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Spinner-test.tsx49
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/SpotlightTour-test.tsx171
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Switch-test.tsx59
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Tabs-test.tsx49
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Tags-test.tsx116
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Text-test.tsx40
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/TextAccordion-test.tsx55
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/Tooltip-test.tsx135
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/TreeMap-test.tsx65
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/TutorialStep-test.tsx37
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/CodeSnippet-test.tsx.snap691
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/CoverageIndicator-test.tsx.snap83
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/DuplicationsIndicator-test.tsx.snap203
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/FavoriteButton-test.tsx.snap167
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/Histogram-test.tsx.snap369
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/HotspotRating-test.tsx.snap118
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/IssueMessageHighlighting-test.tsx.snap148
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHint-test.tsx.snap291
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHintKeys-test.tsx.snap552
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineCoverage-test.tsx.snap237
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap64
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineWrapper-test.tsx.snap21
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/__snapshots__/TreeMap-test.tsx.snap194
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/clipboard-test.tsx82
-rw-r--r--server/sonar-web/design-system/src/components/__tests__/layouts-test.tsx43
65 files changed, 0 insertions, 6414 deletions
diff --git a/server/sonar-web/design-system/src/components/__tests__/Badge-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Badge-test.tsx
deleted file mode 100644
index 5429ccc2a16..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Badge-test.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { Badge } from '../Badge';
-
-it('renders badge correctly', () => {
- render(<Badge>foo</Badge>);
- expect(screen.getByText('foo')).toBeInTheDocument();
-});
-
-it('renders counter correctly', () => {
- render(
- <Badge title="This 23" variant="counter">
- 23
- </Badge>,
- );
- expect(screen.getByRole('img')).toHaveAccessibleName('This 23');
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/Banner-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Banner-test.tsx
deleted file mode 100644
index f4ba243fd5d..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Banner-test.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { renderWithContext } from '../../helpers/testUtils';
-import { Note } from '../../sonar-aligned';
-import { FCProps } from '../../types/misc';
-import { Banner } from '../Banner';
-
-it('should render with close button', async () => {
- const onDismiss = jest.fn();
- const { user } = setupWithProps({ onDismiss });
- expect(
- screen.getByRole('button', {
- name: 'dismiss',
- }),
- ).toBeVisible();
-
- await user.click(
- screen.getByRole('button', {
- name: 'dismiss',
- }),
- );
-
- expect(onDismiss).toHaveBeenCalledTimes(1);
-});
-
-function setupWithProps(props: Partial<FCProps<typeof Banner>> = {}) {
- return renderWithContext(
- <Banner {...props} variant="warning">
- <Note className="sw-typo-default">{props.children ?? 'Test Message'}</Note>
- </Banner>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/BarChart-test.tsx b/server/sonar-web/design-system/src/components/__tests__/BarChart-test.tsx
deleted file mode 100644
index d901b588f78..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/BarChart-test.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { BarChart } from '../BarChart';
-
-it('renders chart correctly', async () => {
- const user = userEvent.setup();
- const onBarClick = jest.fn();
- renderChart({ onBarClick });
-
- const p1 = screen.getByLabelText('point 1');
- expect(p1).toBeInTheDocument();
- await user.click(p1);
-
- expect(onBarClick).toHaveBeenCalledWith({ description: 'point 1', x: 1, y: 20 });
-});
-
-it('displays values', () => {
- const xValues = ['hi', '43', 'testing'];
- renderChart({ xValues });
-
- expect(screen.getByText(xValues[0])).toBeInTheDocument();
- expect(screen.getByText(xValues[1])).toBeInTheDocument();
- expect(screen.getByText(xValues[2])).toBeInTheDocument();
-});
-
-function renderChart(overrides: Partial<FCProps<typeof BarChart>> = {}) {
- return render(
- <BarChart
- barsWidth={20}
- data={[
- { x: 1, y: 20, description: 'point 1' },
- { x: 2, y: 40, description: 'apex' },
- { x: 3, y: 31, description: 'point 3' },
- ]}
- height={75}
- onBarClick={jest.fn()}
- width={200}
- {...overrides}
- />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/BorderlessAccordion-test.tsx b/server/sonar-web/design-system/src/components/__tests__/BorderlessAccordion-test.tsx
deleted file mode 100644
index 3813d5c3706..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/BorderlessAccordion-test.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import * as React from 'react';
-import { render } from '../../helpers/testUtils';
-import { BorderlessAccordion } from '../BorderlessAccordion';
-
-it('should behave correctly', async () => {
- const user = userEvent.setup();
- const children = 'hello';
- renderAccordion(children);
- expect(screen.queryByText(children)).not.toBeInTheDocument();
- await user.click(screen.getByRole('button', { expanded: false }));
- expect(screen.getByText(children)).toBeInTheDocument();
-});
-
-function renderAccordion(children: React.ReactNode) {
- function AccordionTest() {
- const [open, setOpen] = React.useState(false);
-
- return (
- <BorderlessAccordion
- header="test"
- onClick={() => {
- setOpen(!open);
- }}
- open={open}
- >
- <div>{children}</div>
- </BorderlessAccordion>
- );
- }
-
- return render(<AccordionTest />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Breadcrumbs-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Breadcrumbs-test.tsx
deleted file mode 100644
index 04f252779fa..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Breadcrumbs-test.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { renderWithRouter } from '../../helpers/testUtils';
-import { useResizeObserver } from '../../hooks/useResizeObserver';
-import { BreadcrumbsFullWidth } from '../Breadcrumbs';
-import { HoverLink } from '../Link';
-
-jest.mock('../../hooks/useResizeObserver', () => ({
- useResizeObserver: jest.fn(() => [1000, undefined]),
-}));
-
-it('should display three breadcrumbs correctly', () => {
- renderWithRouter(
- <BreadcrumbsFullWidth>
- <HoverLink to="/first">first</HoverLink>
- <HoverLink to="/second">second</HoverLink>
- <HoverLink to="/third">third</HoverLink>
- </BreadcrumbsFullWidth>,
- );
-
- expect(screen.getAllByRole('link').length).toBe(3);
- expect(screen.getAllByTestId('chevron-right').length).toBe(2);
-});
-
-describe('when the container of the breadcrumbs is small(400px)', () => {
- const originalOffsetWidth = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'offsetWidth');
- beforeAll(() => {
- jest.mocked(useResizeObserver).mockImplementation(() => [400, undefined]);
- Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { configurable: true, value: 110 });
- });
-
- afterAll(() => {
- Object.defineProperty(HTMLElement.prototype, 'offsetWidth', originalOffsetWidth as number);
- });
-
- it('should use the dropdown and hide the first breadcrumb when the width is 400', async () => {
- const content = (
- <BreadcrumbsFullWidth>
- <HoverLink to="/first-link-long">first link long</HoverLink>
- <HoverLink to="/second-link-long">second link long</HoverLink>
- <HoverLink to="/third-link-long">third link long</HoverLink>
- <HoverLink to="/fourth-link-long">fourth link long</HoverLink>
- </BreadcrumbsFullWidth>
- );
-
- const { user, rerender } = renderWithRouter(content);
-
- rerender(content);
-
- expect(screen.getByRole('button')).toBeVisible();
-
- expect(screen.getAllByRole('link').length).toBe(3);
- expect(screen.getAllByTestId('chevron-right').length).toBe(2);
-
- await user.click(screen.getByRole('button'));
-
- // 3 from breadcrumbs, 4 from dropdown
- expect(screen.getAllByRole('link').length).toBe(7);
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/BubbleChart-test.tsx b/server/sonar-web/design-system/src/components/__tests__/BubbleChart-test.tsx
deleted file mode 100644
index f1530542972..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/BubbleChart-test.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { AutoSizerProps } from 'react-virtualized';
-import { renderWithRouter } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { BubbleChart } from '../BubbleChart';
-
-jest.mock('react-virtualized/dist/commonjs/AutoSizer', () => ({
- AutoSizer: ({ children }: AutoSizerProps) => children({ width: 100, height: NaN }),
-}));
-
-jest.mock('d3-zoom', () => ({
- zoom: jest.fn().mockReturnValue({ scaleExtent: jest.fn().mockReturnValue({ on: jest.fn() }) }),
-}));
-
-jest.mock('d3-selection', () => ({
- select: jest.fn().mockReturnValue({ call: jest.fn() }),
-}));
-
-it('should display bubbles with correct chart structure', () => {
- renderBubbleChart();
- expect(screen.getAllByRole('link')).toHaveLength(2);
- expect(screen.getByText('5')).toBeInTheDocument();
-});
-
-it('should allow click on bubbles', async () => {
- const onBubbleClick = jest.fn();
- const { user } = renderBubbleChart({ onBubbleClick });
- await user.click(screen.getAllByRole('link')[0]);
- expect(onBubbleClick).toHaveBeenCalledWith('foo');
-});
-
-it('should navigate between bubbles by tab', async () => {
- const { user } = renderBubbleChart();
- await user.tab();
- expect(screen.getAllByRole('link')[0]).toHaveFocus();
- await user.tab();
- expect(screen.getAllByRole('link')[1]).toHaveFocus();
-});
-
-it('should not display ticks and grid', () => {
- renderBubbleChart({
- displayXGrid: false,
- displayYGrid: false,
- displayXTicks: false,
- displayYTicks: false,
- });
-
- expect(screen.queryByText('5')).not.toBeInTheDocument();
-});
-
-it('renders empty graph', () => {
- renderBubbleChart({
- items: [],
- });
-
- expect(screen.queryByRole('link')).not.toBeInTheDocument();
-});
-
-function renderBubbleChart(props: Partial<FCProps<typeof BubbleChart>> = {}) {
- return renderWithRouter(
- <BubbleChart
- height={100}
- items={[
- { x: 1, y: 10, size: 7, data: 'foo' },
- { x: 2, y: 30, size: 5, data: 'bar' },
- ]}
- padding={[0, 0, 0, 0]}
- {...props}
- />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/CodeSnippet-test.tsx b/server/sonar-web/design-system/src/components/__tests__/CodeSnippet-test.tsx
deleted file mode 100644
index 0ceec6e391a..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/CodeSnippet-test.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { HelmetProvider } from 'react-helmet-async';
-import { renderWithContext } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { CodeSnippet } from '../CodeSnippet';
-
-it('should show full size when multiline with no editing', () => {
- const { container } = setupWithProps();
- const copyButton = screen.getByRole('button', { name: 'Copy' });
- expect(copyButton).toHaveStyle('top: 1.5rem');
- expect(container).toMatchSnapshot();
-});
-
-it('should show reduced size when single line with no editing', () => {
- const { container } = setupWithProps({ isOneLine: true, snippet: 'foobar' });
- const copyButton = screen.getByRole('button', { name: 'Copy' });
- expect(copyButton).toHaveStyle('top: 1rem');
- expect(container).toMatchSnapshot();
-});
-
-it('should highlight code content correctly', () => {
- const { container } = setupWithProps({ snippet: '<prop>foobar<prop>' });
- expect(container).toMatchSnapshot();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof CodeSnippet>> = {}) {
- return renderWithContext(
- <HelmetProvider>
- <CodeSnippet snippet={'foo\nbar'} {...props} />
- </HelmetProvider>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/CodeSyntaxHighlighter-test.tsx b/server/sonar-web/design-system/src/components/__tests__/CodeSyntaxHighlighter-test.tsx
deleted file mode 100644
index 5e603a03565..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/CodeSyntaxHighlighter-test.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '../../helpers/testUtils';
-import { CodeSyntaxHighlighter } from '../CodeSyntaxHighlighter';
-
-it('renders correctly with no code', () => {
- const { container } = render(
- <CodeSyntaxHighlighter
- htmlAsString={`
- <p>Hello there!</p>
-
- <p>There's no code here.</p>
- `}
- />,
- );
-
- // eslint-disable-next-line testing-library/no-node-access
- expect(container.getElementsByClassName('hljs-string').length).toBe(0);
-});
-
-it('renders correctly with code', () => {
- const { container } = render(
- <CodeSyntaxHighlighter
- htmlAsString={`
- <p>Hello there!</p>
-
- <p>There's some <code>"code"</code> here.</p>
- `}
- language="typescript"
- />,
- );
-
- // eslint-disable-next-line testing-library/no-node-access
- expect(container.getElementsByClassName('hljs-string').length).toBe(1);
-});
-
-/*
- * This test reproduces a breaking case for https://sonarsource.atlassian.net/browse/SONAR-20161
- */
-it('handles html code snippets', () => {
- const { container } = render(
- <CodeSyntaxHighlighter
- htmlAsString={
- '\u003ch4\u003eNoncompliant code example\u003c/h4\u003e\n\u003cpre data-diff-id\u003d"1" data-diff-type\u003d"noncompliant"\u003e\npublic void Method(MyObject myObject)\n{\n if (myObject is null)\n {\n new MyObject(); // Noncompliant\n }\n\n if (myObject.IsCorrupted)\n {\n new ArgumentException($"{nameof(myObject)} is corrupted"); // Noncompliant\n }\n\n // ...\n}\n\u003c/pre\u003e\n\u003ch4\u003eCompliant solution\u003c/h4\u003e\n\u003cpre data-diff-id\u003d"1" data-diff-type\u003d"compliant"\u003e\npublic void Method(MyObject myObject)\n{\n if (myObject is null)\n {\n myObject \u003d new MyObject(); // Compliant\n }\n\n if (myObject.IsCorrupted)\n {\n throw new ArgumentException($"{nameof(myObject)} is corrupted"); // Compliant\n }\n\n // ...\n}\n\u003c/pre\u003e'
- }
- />,
- );
-
- expect(container.querySelectorAll('pre')).toHaveLength(2);
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/ColorsLegend-test.tsx b/server/sonar-web/design-system/src/components/__tests__/ColorsLegend-test.tsx
deleted file mode 100644
index 6f3a8cb2c68..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/ColorsLegend-test.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-
-import { renderWithContext } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { ColorsLegend } from '../ColorsLegend';
-
-const colors = [
- {
- selected: true,
- overlay: 'Overlay A',
- label: 'A',
- value: '1',
- },
- {
- selected: true,
- overlay: 'Overlay B',
- label: 'B',
- value: '2',
- },
-];
-
-it('should render correctly', () => {
- renderColorLegend();
- expect(screen.getByRole('checkbox', { name: 'A' })).toBeInTheDocument();
- expect(screen.getByRole('checkbox', { name: 'B' })).toBeInTheDocument();
-});
-
-it('should react when a rating is clicked', () => {
- const onColorClick = jest.fn();
- renderColorLegend({ onColorClick });
-
- screen.getByRole('checkbox', { name: 'A' }).click();
- expect(onColorClick).toHaveBeenCalledWith(colors[0]);
-});
-
-function renderColorLegend(props: Partial<FCProps<typeof ColorsLegend>> = {}) {
- return renderWithContext(<ColorsLegend colors={colors} onColorClick={jest.fn()} {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/CoverageIndicator-test.tsx b/server/sonar-web/design-system/src/components/__tests__/CoverageIndicator-test.tsx
deleted file mode 100644
index 648869f9ac9..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/CoverageIndicator-test.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-
-import { CoverageIndicator } from '../CoverageIndicator';
-
-it('should display CoverageIndicator', () => {
- const wrapper = setupWithProps({ value: 10 });
- expect(wrapper.baseElement).toMatchSnapshot();
-});
-
-it('should display CoverageIndicator without value', () => {
- const wrapper = setupWithProps();
- expect(wrapper.baseElement).toMatchSnapshot();
-});
-
-it('should display CoverageIndicator with correct aria properties', () => {
- const wrapper = setupWithProps({ 'aria-label': 'label', 'aria-hidden': true });
- expect(wrapper.baseElement).toMatchSnapshot();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof CoverageIndicator>> = {}) {
- return render(<CoverageIndicator {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Dropdown-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Dropdown-test.tsx
deleted file mode 100644
index fce2fd2bc67..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Dropdown-test.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { renderWithRouter } from '../../helpers/testUtils';
-import { ButtonSecondary } from '../../sonar-aligned/components/buttons';
-import { Dropdown } from '../Dropdown';
-
-describe('Dropdown', () => {
- it('renders', async () => {
- const { user } = renderDropdown();
- expect(screen.getByRole('button')).toBeInTheDocument();
-
- await user.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeInTheDocument();
- });
-
- it('toggles with render prop', async () => {
- const { user } = renderDropdown({
- children: ({ onToggleClick }) => <ButtonSecondary onClick={onToggleClick} />,
- });
-
- await user.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeVisible();
- });
-
- it('closes when clicking outside of menu', async () => {
- const { user } = renderDropdown();
-
- await user.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeInTheDocument();
-
- await user.click(document.body);
- expect(screen.queryByRole('menu')).not.toBeInTheDocument();
- });
-
- it('does not close when clicking ouside of menu', async () => {
- const { user } = renderDropdown({ withClickOutHandler: false });
-
- await user.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeInTheDocument();
-
- await user.click(document.body);
- expect(screen.getByRole('menu')).toBeInTheDocument();
- });
-
- it('closes when other target gets focus', async () => {
- const { user } = renderDropdown();
-
- await user.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeInTheDocument();
-
- await user.tab();
-
- expect(screen.queryByRole('menu')).not.toBeInTheDocument();
- });
-
- it('does not close when other target gets focus', async () => {
- const { user } = renderDropdown({ withFocusOutHandler: false });
-
- await user.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeInTheDocument();
-
- await user.tab();
- expect(screen.getByRole('menu')).toBeInTheDocument();
- });
-
- function renderDropdown(props: Partial<Dropdown['props']> = {}) {
- const { children, ...rest } = props;
- return renderWithRouter(
- <Dropdown id="test-menu" overlay={<div id="overlay" />} {...rest}>
- {children ?? <ButtonSecondary />}
- </Dropdown>,
- );
- }
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/DropdownMenu-test.tsx b/server/sonar-web/design-system/src/components/__tests__/DropdownMenu-test.tsx
deleted file mode 100644
index 8f855b319b2..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/DropdownMenu-test.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { noop } from 'lodash';
-import { render, renderWithRouter } from '../../helpers/testUtils';
-import {
- DropdownMenu,
- ItemButton,
- ItemCheckbox,
- ItemCopy,
- ItemDangerButton,
- ItemDivider,
- ItemHeader,
- ItemLink,
- ItemNavLink,
-} from '../DropdownMenu';
-import { Tooltip } from '../Tooltip';
-import { MenuIcon } from '../icons/MenuIcon';
-
-it('should render a full menu correctly', () => {
- renderDropdownMenu();
- expect(screen.getByRole('menuitem', { name: 'My header' })).toBeInTheDocument();
- expect(screen.getByRole('menuitem', { name: 'Test menu item' })).toBeInTheDocument();
- expect(screen.getByRole('menuitem', { name: 'Test disabled item' })).toHaveClass('disabled');
-});
-
-it('menu items should work with tooltips', async () => {
- render(
- <Tooltip content="test tooltip">
- <ItemButton onClick={jest.fn()}>button</ItemButton>
- </Tooltip>,
- {},
- { delay: null },
- );
-
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- await expect(screen.getByRole('menuitem')).toHaveATooltipWithContent('test tooltip');
-});
-
-function renderDropdownMenu() {
- return renderWithRouter(
- <DropdownMenu>
- <ItemHeader>My header</ItemHeader>
- <ItemNavLink to="/test">Test menu item</ItemNavLink>
- <ItemDivider />
- <ItemLink disabled to="/test-disabled">
- Test disabled item
- </ItemLink>
- <ItemButton icon={<MenuIcon />} onClick={noop}>
- Button
- </ItemButton>
- <ItemDangerButton onClick={noop}>DangerButton</ItemDangerButton>
- <ItemCopy copyValue="copy" tooltipOverlay="overlay">
- Copy
- </ItemCopy>
- <ItemCheckbox checked onCheck={noop}>
- Checkbox item
- </ItemCheckbox>
- </DropdownMenu>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/DuplicationsIndicator-test.tsx b/server/sonar-web/design-system/src/components/__tests__/DuplicationsIndicator-test.tsx
deleted file mode 100644
index f0c9fbc1405..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/DuplicationsIndicator-test.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-
-import { DuplicationLabel } from '../../types/measures';
-import { DuplicationsIndicator } from '../DuplicationsIndicator';
-
-it('should display DuplicationsIndicator without rating', () => {
- const wrapper = setupWithProps();
- expect(wrapper.baseElement).toMatchSnapshot();
-});
-
-it.each(['A', 'B', 'C', 'D', 'E', 'F'])(
- 'should display DuplicationsIndicator with rating',
- (variant: DuplicationLabel) => {
- const wrapper = setupWithProps({ rating: variant });
- expect(wrapper.baseElement).toMatchSnapshot();
- },
-);
-
-function setupWithProps(props: Partial<FCProps<typeof DuplicationsIndicator>> = {}) {
- return render(<DuplicationsIndicator {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/ExecutionFlowAccordion-test.tsx b/server/sonar-web/design-system/src/components/__tests__/ExecutionFlowAccordion-test.tsx
deleted file mode 100644
index 9df3b5bf6bf..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/ExecutionFlowAccordion-test.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render, screen } from '@testing-library/react';
-import { FCProps } from '../../types/misc';
-import { ExecutionFlowAccordion } from '../ExecutionFlowAccordion';
-
-it('should render correctly', () => {
- renderExecutionFlowAccordion({}, <div>flow-accordion-children</div>);
- expect(screen.queryByText('flow-accordion-children')).not.toBeInTheDocument();
-});
-
-it('should render correctly expanded', () => {
- renderExecutionFlowAccordion({ expanded: true }, <div>flow-accordion-children</div>);
- expect(screen.getByText('flow-accordion-children')).toBeVisible();
-});
-
-function renderExecutionFlowAccordion(
- props: Partial<FCProps<typeof ExecutionFlowAccordion>> = {},
- children?: React.ReactNode,
-) {
- return render(
- <ExecutionFlowAccordion header="header" id="id" {...props}>
- {children}
- </ExecutionFlowAccordion>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/FacetBox-test.tsx b/server/sonar-web/design-system/src/components/__tests__/FacetBox-test.tsx
deleted file mode 100644
index 9319c40a681..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/FacetBox-test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { renderWithContext } from '../../helpers/testUtils';
-import { FacetBox, FacetBoxProps } from '../FacetBox';
-
-it('should render an empty disabled facet box', async () => {
- const user = userEvent.setup();
-
- const onClick = jest.fn();
-
- renderComponent({ disabled: true, hasEmbeddedFacets: true, onClick });
-
- expect(screen.queryByRole('group')).not.toBeInTheDocument();
-
- expect(screen.getByText('Test FacetBox')).toBeInTheDocument();
-
- expect(screen.getByRole('button', { expanded: false })).toHaveAttribute('aria-disabled', 'true');
-
- await user.click(screen.getByRole('button'));
-
- expect(onClick).not.toHaveBeenCalled();
-});
-
-it('should render an inner expanded facet box with count', async () => {
- const user = userEvent.setup();
-
- const onClear = jest.fn();
- const onClick = jest.fn();
-
- renderComponent({
- children: 'The panel',
- count: 3,
- inner: true,
- onClear,
- onClick,
- open: true,
- });
-
- expect(screen.getByRole('group')).toBeInTheDocument();
-
- expect(screen.getByRole('button', { expanded: true })).toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { expanded: true }));
-
- expect(onClick).toHaveBeenCalledWith(false);
-});
-
-function renderComponent({ children, ...props }: Partial<FacetBoxProps> = {}) {
- return renderWithContext(
- <FacetBox name="Test FacetBox" {...props}>
- {children}
- </FacetBox>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/FacetItem-test.tsx b/server/sonar-web/design-system/src/components/__tests__/FacetItem-test.tsx
deleted file mode 100644
index f56a5669eef..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/FacetItem-test.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { render } from '../../helpers/testUtils';
-import { BaseFacetItem, FacetItemProps } from '../FacetItem';
-
-it('should render a disabled facet item', async () => {
- const user = userEvent.setup();
-
- const onClick = jest.fn();
-
- renderComponent({ disabled: true, onClick });
-
- expect(screen.getByRole('checkbox')).toHaveAttribute('aria-disabled', 'true');
-
- await user.click(screen.getByRole('checkbox'));
-
- expect(onClick).not.toHaveBeenCalled();
-});
-
-it('should render a non-disabled facet item', async () => {
- const user = userEvent.setup();
-
- const onClick = jest.fn();
-
- renderComponent({ active: true, onClick, stat: 3, value: 'foo' });
-
- expect(screen.getByRole('checkbox')).toHaveAttribute('aria-disabled', 'false');
-
- await user.click(screen.getByRole('checkbox'));
-
- expect(onClick).toHaveBeenCalledWith('foo', false);
-
- await user.keyboard('{Meta>}');
- await user.click(screen.getByRole('checkbox'));
-
- expect(onClick).toHaveBeenLastCalledWith('foo', true);
-});
-
-it('should add an aria label if the name is a string', () => {
- renderComponent({ name: 'Foo' });
-
- expect(screen.getByRole('checkbox')).toHaveAccessibleName('Foo');
-});
-
-it('should not add an aria label if the name is not a string', () => {
- renderComponent({ name: <div>Foo</div>, small: true });
-
- expect(screen.getByRole('checkbox')).not.toHaveAttribute('aria-label');
-});
-
-function renderComponent(props: Partial<FacetItemProps> = {}) {
- return render(
- <BaseFacetItem name="Test facet item" onClick={jest.fn()} value="Value" {...props} />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/FavoriteButton-test.tsx b/server/sonar-web/design-system/src/components/__tests__/FavoriteButton-test.tsx
deleted file mode 100644
index c2ac6fe2403..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/FavoriteButton-test.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { FavoriteButton } from '../FavoriteButton';
-import { Tooltip } from '../Tooltip';
-
-it('should render favorite filled', () => {
- const { container } = renderFavoriteButton({ favorite: true });
- expect(screen.getByLabelText('label-info')).toBeInTheDocument();
- expect(container).toMatchSnapshot();
-});
-
-it('should render favorite empty', () => {
- const { container } = renderFavoriteButton();
- expect(screen.getByLabelText('label-info')).toBeInTheDocument();
- expect(container).toMatchSnapshot();
-});
-
-it('should toggle favorite', async () => {
- const toggleFavorite = jest.fn();
- renderFavoriteButton({ toggleFavorite });
- await userEvent.click(screen.getByRole('button'));
- expect(toggleFavorite).toHaveBeenCalled();
-});
-
-function renderFavoriteButton(props: Partial<FCProps<typeof FavoriteButton>> = {}) {
- return render(
- <FavoriteButton
- favorite
- overlay="label-info"
- toggleFavorite={jest.fn()}
- tooltip={Tooltip}
- {...props}
- />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/FlowStep-test.tsx b/server/sonar-web/design-system/src/components/__tests__/FlowStep-test.tsx
deleted file mode 100644
index 819dd07bf6b..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/FlowStep-test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { renderWithRouter } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { FlowStep } from '../FlowStep';
-
-it('should render correctly', () => {
- renderFlowStep({ step: 3, additionalMarkers: <span>additional</span> });
-
- expect(screen.getByText('3')).toBeInTheDocument();
- expect(screen.getByText('additional')).toBeInTheDocument();
-});
-
-function renderFlowStep(props: Partial<FCProps<typeof FlowStep>> = {}) {
- return renderWithRouter(<FlowStep message="" selected={false} {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/HighlightedSection-test.tsx b/server/sonar-web/design-system/src/components/__tests__/HighlightedSection-test.tsx
deleted file mode 100644
index fb85529315c..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/HighlightedSection-test.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render, screen } from '@testing-library/react';
-import { HighlightedSection } from '../HighlightedSection';
-
-it('should render as expected', () => {
- render(<HighlightedSection>content</HighlightedSection>);
-
- expect(screen.getByText('content')).toHaveStyle({
- padding: '2rem',
- border: '1px solid rgb(225,230,243)',
- background: 'rgb(252,252,253)',
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/Histogram-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Histogram-test.tsx
deleted file mode 100644
index 5b61733a345..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Histogram-test.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '../../helpers/testUtils';
-import { Histogram } from '../Histogram';
-
-it('renders correctly', () => {
- const { container } = renderHistogram();
- expect(container).toMatchSnapshot();
-});
-
-it('renders correctly with yValues', () => {
- const { container } = renderHistogram({ yValues: ['100.0', '75.0', '150.0'] });
- expect(container).toMatchSnapshot();
-});
-
-it('renders correctly with yValues and yTicks', () => {
- const { container } = renderHistogram({
- yValues: ['100.0', '75.0', '150.0'],
- yTicks: ['a', 'b', 'c'],
- });
- expect(container).toMatchSnapshot();
-});
-
-it('renders correctly with yValues, yTicks, and yTooltips', () => {
- const { container } = renderHistogram({
- yValues: ['100.0', '75.0', '150.0'],
- yTicks: ['a', 'b', 'c'],
- yTooltips: ['a - 100', 'b - 75', 'c - 150'],
- });
- expect(container).toMatchSnapshot();
-});
-
-function renderHistogram(props: Partial<Histogram['props']> = {}) {
- return render(<Histogram bars={[100, 75, 150]} height={75} width={100} {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/HotspotRating-test.tsx b/server/sonar-web/design-system/src/components/__tests__/HotspotRating-test.tsx
deleted file mode 100644
index 34bd9e552ad..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/HotspotRating-test.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { HotspotRatingEnum } from '../../types/measures';
-import { HotspotRating } from '../HotspotRating';
-
-it('should render HotspotRating with default LOW rating', () => {
- renderHotspotRating(undefined, 'label');
- expect(screen.getByLabelText('label')).toMatchSnapshot();
-});
-
-it.each(Object.values(HotspotRatingEnum))(
- 'should render HotspotRating with %s rating',
- (rating) => {
- renderHotspotRating(rating, 'label');
- expect(screen.getByLabelText('label')).toMatchSnapshot();
- },
-);
-
-function renderHotspotRating(rating?: HotspotRatingEnum, label?: string) {
- return render(<HotspotRating aria-label={label} rating={rating} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/IssueMessageHighlighting-test.tsx b/server/sonar-web/design-system/src/components/__tests__/IssueMessageHighlighting-test.tsx
deleted file mode 100644
index e91f62d3d34..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/IssueMessageHighlighting-test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '@testing-library/react';
-import {
- IssueMessageHighlighting,
- IssueMessageHighlightingProps,
- MessageFormattingType,
-} from '../IssueMessageHighlighting';
-
-it.each([
- [undefined, undefined],
- ['message', undefined],
- ['message', []],
- ['message', [{ start: 1, end: 4, type: 'something else' as MessageFormattingType }]],
- [
- 'message',
- [
- { start: 5, end: 6, type: MessageFormattingType.CODE },
- { start: 1, end: 4, type: MessageFormattingType.CODE },
- ],
- ],
- [
- 'a somewhat longer message with overlapping ranges',
- [{ start: -1, end: 1, type: MessageFormattingType.CODE }],
- ],
- [
- 'a somewhat longer message with overlapping ranges',
- [{ start: 48, end: 70, type: MessageFormattingType.CODE }],
- ],
- [
- 'a somewhat longer message with overlapping ranges',
- [{ start: 0, end: 0, type: MessageFormattingType.CODE }],
- ],
- [
- 'a somewhat longer message with overlapping ranges',
- [
- { start: 11, end: 17, type: MessageFormattingType.CODE },
- { start: 2, end: 25, type: MessageFormattingType.CODE },
- { start: 25, end: 2, type: MessageFormattingType.CODE },
- ],
- ],
- [
- 'a somewhat longer message with overlapping ranges',
- [
- { start: 18, end: 30, type: MessageFormattingType.CODE },
- { start: 2, end: 25, type: MessageFormattingType.CODE },
- ],
- ],
-])('should format the string with highlights', (message, messageFormattings) => {
- const { asFragment } = renderIssueMessageHighlighting({ message, messageFormattings });
- expect(asFragment()).toMatchSnapshot();
-});
-
-function renderIssueMessageHighlighting(props: Partial<IssueMessageHighlightingProps> = {}) {
- return render(<IssueMessageHighlighting {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/KeyboardHint-test.tsx b/server/sonar-web/design-system/src/components/__tests__/KeyboardHint-test.tsx
deleted file mode 100644
index d9240cdeac2..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/KeyboardHint-test.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { Key } from '../../helpers/keyboard';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { KeyboardHint } from '../KeyboardHint';
-
-afterEach(() => {
- jest.clearAllMocks();
-});
-
-it('renders without title', () => {
- const { container } = setupWithProps();
- expect(container).toMatchSnapshot();
-});
-
-it('renders with title', () => {
- const { container } = setupWithProps({ title: 'title' });
- expect(container).toMatchSnapshot();
-});
-
-it('renders with command', () => {
- const { container } = setupWithProps({ command: 'command' });
- expect(container).toMatchSnapshot();
-});
-
-it('renders on mac', () => {
- Object.defineProperty(navigator, 'userAgent', {
- configurable: true,
- value: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4)',
- });
- const { container } = setupWithProps({ command: `${Key.Control} ${Key.Alt}` });
- expect(container).toMatchSnapshot();
-});
-
-it('renders on windows', () => {
- Object.defineProperty(navigator, 'userAgent', {
- configurable: true,
- value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
- });
- const { container } = setupWithProps({ command: `${Key.Control} ${Key.Alt}` });
- expect(container).toMatchSnapshot();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof KeyboardHint>> = {}) {
- return render(<KeyboardHint command="click" {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/KeyboardHintKeys-test.tsx b/server/sonar-web/design-system/src/components/__tests__/KeyboardHintKeys-test.tsx
deleted file mode 100644
index f6bfd0ee047..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/KeyboardHintKeys-test.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { Key } from '../../helpers/keyboard';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { KeyboardHintKeys, mappedKeys } from '../KeyboardHintKeys';
-
-it.each(Object.keys(mappedKeys))('should render %s', (key) => {
- const { container } = setupWithProps({ command: key });
- expect(container).toMatchSnapshot();
-});
-
-it('should render multiple keys', () => {
- const { container } = setupWithProps({ command: `Use Ctrl + ${Key.ArrowUp} ${Key.ArrowDown}` });
- expect(container).toMatchSnapshot();
-});
-
-it('should render multiple keys with non-key symbols', () => {
- const { container } = setupWithProps({
- command: `${Key.Control} + ${Key.ArrowDown} ${Key.ArrowUp}`,
- });
- expect(container).toMatchSnapshot();
-});
-
-it('should render a default text if no keys match', () => {
- const { container } = setupWithProps({ command: `${Key.Control} + click` });
- expect(container).toMatchSnapshot();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof KeyboardHintKeys>> = {}) {
- return render(<KeyboardHintKeys command={`${Key.ArrowUp}`} {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/LineCoverage-test.tsx b/server/sonar-web/design-system/src/components/__tests__/LineCoverage-test.tsx
deleted file mode 100644
index f383723283b..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/LineCoverage-test.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { LineCoverage } from '../code-line/LineCoverage';
-
-it('should render correctly when covered', () => {
- expect(setupWithProps().container).toMatchSnapshot();
-});
-
-it('should render correctly when uncovered', () => {
- expect(
- setupWithProps({ lineNumber: 16, coverageStatus: 'uncovered' }).container,
- ).toMatchSnapshot();
-});
-
-it('should render correctly when partially covered without conditions', () => {
- expect(
- setupWithProps({
- lineNumber: 16,
- coverageStatus: 'partially-covered',
- }).container,
- ).toMatchSnapshot();
-});
-
-it('should render correctly when partially covered with 5/10 conditions', () => {
- expect(
- setupWithProps({
- lineNumber: 16,
- coverageStatus: 'partially-covered',
- }).container,
- ).toMatchSnapshot();
-});
-
-it('should render correctly when no data', () => {
- expect(setupWithProps({ lineNumber: 16, coverageStatus: undefined }).container).toMatchSnapshot();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof LineCoverage>> = {}) {
- return render(<LineCoverage coverageStatus="covered" lineNumber={16} status="OK" {...props} />, {
- container: document.createElement('tr'),
- });
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx b/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx
deleted file mode 100644
index 038ae20ae92..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { LineFinding } from '../code-line/LineFinding';
-
-it('should render correctly as button', async () => {
- const user = userEvent.setup();
- const { container } = setupWithProps();
- await user.click(screen.getByRole('button'));
- expect(container).toMatchSnapshot();
-});
-
-it('should render as non-button', () => {
- setupWithProps({ as: 'div', onIssueSelect: undefined });
- expect(screen.queryByRole('button')).not.toBeInTheDocument();
-});
-
-it('should be clickable when onIssueSelect is provided', async () => {
- const mockClick = jest.fn();
- const user = userEvent.setup();
-
- setupWithProps({ onIssueSelect: mockClick });
- await user.click(screen.getByRole('button'));
- expect(mockClick).toHaveBeenCalled();
-});
-
-function setupWithProps(props?: Partial<FCProps<typeof LineFinding>>) {
- return render(
- <LineFinding issueKey="key" message="message" onIssueSelect={jest.fn()} {...props} />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/LineNumber-test.tsx b/server/sonar-web/design-system/src/components/__tests__/LineNumber-test.tsx
deleted file mode 100644
index e72494cdd7f..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/LineNumber-test.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { LineNumber } from '../code-line/LineNumber';
-
-it('should a popup when clicked', async () => {
- const { user } = setupWithProps();
-
- expect(screen.getByRole('button', { name: 'aria-label' })).toBeVisible();
-
- await user.click(screen.getByRole('button', { name: 'aria-label' }));
- expect(screen.getByText('Popup')).toBeVisible();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof LineNumber>> = {}) {
- return render(
- <table>
- <tbody>
- <tr>
- <LineNumber
- ariaLabel="aria-label"
- displayOptions
- firstLineNumber={1}
- lineNumber={16}
- popup={<div>Popup</div>}
- {...props}
- />
- </tr>
- </tbody>
- </table>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/LineToken-test.tsx b/server/sonar-web/design-system/src/components/__tests__/LineToken-test.tsx
deleted file mode 100644
index 214b3bc191a..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/LineToken-test.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { ReactNode } from 'react';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { LineToken } from '../code-line/LineToken';
-
-it.each([
- ['isHighlighted', 'highlighted'],
- ['isLocation', 'issue-location'],
- ['isSelected', 'selected'],
- ['isUnderlined', 'issue-underline'],
-])('should have matching class if modifiers are provided', (modifier, className) => {
- const { container } = setupWithProps({ [modifier]: true });
- expect(container.firstChild).toHaveClass(className);
-});
-
-it('should add class when hasMarker is provided', () => {
- const { container } = setupWithProps({ hasMarker: true });
- expect(container.firstChild).toHaveClass('has-marker');
-});
-
-function setupWithProps(props: Partial<FCProps<typeof LineToken>>, children?: ReactNode) {
- return render(<LineToken {...props}>{children}</LineToken>);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/LineWrapper-test.tsx b/server/sonar-web/design-system/src/components/__tests__/LineWrapper-test.tsx
deleted file mode 100644
index 32f97a32f8e..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/LineWrapper-test.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { LineWrapper, SuggestedLineWrapper } from '../code-line/LineWrapper';
-
-it('should render with correct styling', () => {
- expect(setupWithProps().container).toMatchSnapshot();
-});
-
-it('should properly setup css grid columns', () => {
- expect(setupWithProps().container.firstChild).toHaveStyle({
- '--columns': '44px 50px 26px repeat(3, 6px) 1fr',
- });
- expect(setupWithProps({ duplicationsCount: 0 }).container.firstChild).toHaveStyle({
- '--columns': '44px 50px 26px repeat(1, 6px) 1fr',
- });
- expect(
- setupWithProps({ displayCoverage: false, displaySCM: false, duplicationsCount: 0 }).container
- .firstChild,
- ).toHaveStyle({ '--columns': '44px 26px 1fr' });
-});
-
-it('should set a highlighted background color in css props', () => {
- const { container } = setupWithProps({ highlighted: true });
- expect(container.firstChild).toHaveStyle({ '--line-background': 'rgb(225,230,243)' });
-});
-
-it('should properly setup css grid columns for Suggested Line', () => {
- const container = render(<SuggestedLineWrapper />, {
- container: document.createElement('div'),
- });
- expect(container.container.firstChild).toHaveStyle({
- '--columns': '44px 26px 1rem 1fr',
- });
-});
-
-function setupWithProps(props: Partial<FCProps<typeof LineWrapper>> = {}) {
- return render(
- <LineWrapper displayCoverage displaySCM duplicationsCount={2} highlighted={false} {...props} />,
- { container: document.createElement('tbody') },
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Link-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Link-test.tsx
deleted file mode 100644
index d8bc4c62930..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Link-test.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import * as React from 'react';
-import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
-import { render } from '../../helpers/testUtils';
-import { ContentLink, DiscreetLink, StandoutLink as Link } from '../Link';
-
-beforeAll(() => {
- const { location } = window;
- delete (window as { location?: Location }).location;
- window.location = { ...location, href: '' };
-});
-
-beforeEach(() => {
- jest.clearAllMocks();
-});
-
-// This functionality won't be needed once we update the breadcrumbs
-it('should remove focus after link is clicked', async () => {
- const { user } = setupWithMemoryRouter(
- <Link blurAfterClick icon={<div>Icon</div>} to="/initial" />,
- );
-
- await user.click(screen.getByRole('link'));
-
- expect(screen.getByRole('link')).not.toHaveFocus();
-});
-
-it('should prevent default when preventDefault is true', async () => {
- const { user } = setupWithMemoryRouter(<Link preventDefault to="/second" />);
-
- expect(screen.getByText('/initial')).toBeVisible();
-
- await user.click(screen.getByRole('link'));
-
- // prevent default behavior of page navigation
- expect(screen.getByText('/initial')).toBeVisible();
- expect(screen.queryByText('/second')).not.toBeInTheDocument();
-});
-
-it('should stop propagation when stopPropagation is true', async () => {
- const buttonOnClick = jest.fn();
-
- const { user } = setupWithMemoryRouter(
- <button onClick={buttonOnClick} type="button">
- <Link stopPropagation to="/second" />
- </button>,
- );
-
- await user.click(screen.getByRole('link'));
-
- expect(buttonOnClick).not.toHaveBeenCalled();
-});
-
-it('should call onClick when one is passed', async () => {
- const onClick = jest.fn();
- const { user } = setupWithMemoryRouter(<Link onClick={onClick} stopPropagation to="/second" />);
-
- await user.click(screen.getByRole('link'));
-
- expect(onClick).toHaveBeenCalled();
-});
-
-it('internal link should be clickable', async () => {
- const { user } = setupWithMemoryRouter(<Link to="/second">internal link</Link>);
- expect(screen.getByRole('link')).toBeVisible();
-
- await user.click(screen.getByRole('link'));
-
- expect(screen.getByText('/second')).toBeVisible();
-});
-
-it('external links are indicated by OpenNewTabIcon', () => {
- setupWithMemoryRouter(<Link to="https://google.com">external link</Link>);
- expect(screen.getByRole('link')).toBeVisible();
-});
-
-it.each([
- ['discreet', DiscreetLink],
- ['content', ContentLink],
-])('%s links also can be external indicated by the OpenNewTabIcon', (_, LinkComponent) => {
- setupWithMemoryRouter(<LinkComponent to="https://google.com">external link</LinkComponent>);
- expect(screen.getByRole('link')).toBeVisible();
-});
-
-function ShowPath() {
- const { pathname } = useLocation();
- return <pre>{pathname}</pre>;
-}
-
-const setupWithMemoryRouter = (component: JSX.Element, initialEntries = ['/initial']) => {
- return render(
- <MemoryRouter initialEntries={initialEntries}>
- <Routes>
- <Route
- element={
- // Below: using <></> won't work in extensions ('React' is not defined). This is because the
- // name 'React' would already have been minified to something else when <> is resolved to
- // React.Fragment
- // eslint-disable-next-line react/jsx-fragments
- <React.Fragment>
- {component}
- <ShowPath />
- </React.Fragment>
- }
- path="/initial"
- />
- <Route element={<ShowPath />} path="/second" />
- </Routes>
- </MemoryRouter>,
- );
-};
diff --git a/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx b/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx
deleted file mode 100644
index 0972b51eac5..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* eslint-disable import/no-extraneous-dependencies */
-
-import { fireEvent, screen } from '@testing-library/react';
-import { MemoryRouter, Route, Routes } from 'react-router-dom';
-import { LAYOUT_LOGO_MAX_HEIGHT, LAYOUT_LOGO_MAX_WIDTH } from '../../helpers/constants';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { MainAppBar } from '../MainAppBar';
-import { SonarQubeLogo } from '../SonarQubeLogo';
-
-it('should render the main app bar with max-height and max-width constraints on the logo', () => {
- setupWithProps();
-
- expect(screen.getByRole('img')).toHaveStyle({
- border: 'none',
- 'max-height': `${LAYOUT_LOGO_MAX_HEIGHT}px`,
- 'max-width': `${LAYOUT_LOGO_MAX_WIDTH}px`,
- 'object-fit': 'contain',
- });
-});
-
-it('should render the logo', () => {
- const element = setupWithProps({ Logo: SonarQubeLogo });
-
- // eslint-disable-next-line testing-library/no-node-access
- expect(element.container.querySelector('svg')).toHaveStyle({ height: '40px', width: '132px' });
-});
-
-it('should add shadow when scrolled', () => {
- setupWithProps();
-
- expect(screen.getByRole('banner')).toHaveStyle({
- 'box-shadow': 'none',
- });
-
- document.documentElement.scrollTop = 100;
- fireEvent.scroll(document, { target: { scrollTop: 100 } });
-
- expect(screen.getByRole('banner')).toHaveStyle({
- 'box-shadow': '0px 4px 8px -2px rgba(29,33,47,0.1),0px 2px 15px -2px rgba(29,33,47,0.06)',
- });
-});
-
-function setupWithProps(
- props: FCProps<typeof MainAppBar> = {
- Logo: () => <img alt="logo" src="http://example.com/logo.png" />,
- },
-) {
- return render(
- <MemoryRouter initialEntries={['/']}>
- <Routes>
- <Route element={<MainAppBar {...props} />} path="/" />
- </Routes>
- </MemoryRouter>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Menu-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Menu-test.tsx
deleted file mode 100644
index 817c7b28f31..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Menu-test.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* eslint-disable import/no-extraneous-dependencies */
-
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { MainMenu } from '../MainMenu';
-
-it('should render MainMenu', () => {
- render(<MainMenu>Children</MainMenu>);
-
- expect(screen.getByText('Children')).toBeInTheDocument();
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/MenuItem-test.tsx b/server/sonar-web/design-system/src/components/__tests__/MenuItem-test.tsx
deleted file mode 100644
index 3fd04b23052..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/MenuItem-test.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* eslint-disable import/no-extraneous-dependencies */
-
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { MainMenuItem } from '../MainMenuItem';
-
-it('should render default', () => {
- render(
- <MainMenuItem>
- <a>Hi</a>
- </MainMenuItem>,
- );
-
- expect(screen.getByText('Hi')).toHaveStyle({
- color: 'rgb(62, 67, 87)',
- 'border-bottom': '4px solid transparent',
- });
-});
-
-it('should render active link', () => {
- render(
- <MainMenuItem>
- <a className="active">Hi</a>
- </MainMenuItem>,
- );
-
- expect(screen.getByText('Hi')).toHaveStyle({
- color: 'rgb(62, 67, 87)',
- 'border-bottom': '4px solid rgba(123,135,217,1)',
- });
-});
-
-it('should render hovered link', () => {
- render(
- <MainMenuItem>
- <a className="hover">Hi</a>
- </MainMenuItem>,
- );
-
- expect(screen.getByText('Hi')).toHaveStyle({
- color: 'rgb(42, 47, 64)',
- 'border-bottom': '4px solid rgba(123,135,217,1)',
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/NavBarTabs-test.tsx b/server/sonar-web/design-system/src/components/__tests__/NavBarTabs-test.tsx
deleted file mode 100644
index 554c40c9776..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/NavBarTabs-test.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { renderWithRouter } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { DisabledTabLink, NavBarTabLink, NavBarTabs } from '../NavBarTabs';
-
-describe('NewNavBarTabs', () => {
- it('should render correctly', () => {
- setup();
-
- expect(screen.getByRole('list')).toBeInTheDocument();
- expect(screen.getByRole('listitem')).toBeInTheDocument();
- expect(screen.getByRole('link')).toBeInTheDocument();
- expect(screen.getByRole('link')).toHaveTextContent('test');
- });
-
- function setup() {
- return renderWithRouter(
- <NavBarTabs>
- <NavBarTabLink text="test" to="/summary/new_code" />
- </NavBarTabs>,
- );
- }
-});
-
-describe('NewNavBarTabLink', () => {
- it('should not be active when on different url', () => {
- setupWithProps();
-
- expect(screen.getByRole('link')).not.toHaveClass('active');
- });
-
- it('should be active when on same url', () => {
- setupWithProps({ to: '/' });
-
- expect(screen.getByRole('link')).toHaveClass('active');
- });
-
- it('should be active when active prop is set regardless of the url', () => {
- setupWithProps({ active: true, withChevron: true });
-
- expect(screen.getByRole('link')).toHaveClass('active');
- });
-
- it('should not be active when active prop is false regardless of the url', () => {
- setupWithProps({ active: false, to: '/' });
-
- expect(screen.getByRole('link')).not.toHaveClass('active');
- });
-
- function setupWithProps(props: Partial<FCProps<typeof NavBarTabLink>> = {}) {
- return renderWithRouter(<NavBarTabLink text="test" to="/summary/new_code" {...props} />);
- }
-});
-
-describe('DisabledTabLink', () => {
- it('should render correctly', () => {
- renderWithRouter(<DisabledTabLink label="label" overlay={<span>Overlay</span>} />);
- expect(screen.getByRole('link')).toHaveClass('disabled-link');
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/NavLink-test.tsx b/server/sonar-web/design-system/src/components/__tests__/NavLink-test.tsx
deleted file mode 100644
index 6aaa88a9c44..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/NavLink-test.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import * as React from 'react';
-import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
-import { render } from '../../helpers/testUtils';
-import NavLink from '../NavLink';
-
-beforeAll(() => {
- const { location } = window;
- delete (window as { location?: Location }).location;
- window.location = { ...location, href: '' };
-});
-
-beforeEach(() => {
- jest.clearAllMocks();
-});
-
-it('should remove focus after link is clicked', async () => {
- const { user } = setupWithMemoryRouter(<NavLink blurAfterClick to="/initial" />);
-
- await user.click(screen.getByRole('link'));
-
- expect(screen.getByRole('link')).not.toHaveFocus();
-});
-
-it('should prevent default when preventDefault is true', async () => {
- const { user } = setupWithMemoryRouter(<NavLink preventDefault to="/second" />);
-
- expect(screen.getByText('/initial')).toBeVisible();
-
- await user.click(screen.getByRole('link'));
-
- // prevent default behavior of page navigation
- expect(screen.getByText('/initial')).toBeVisible();
- expect(screen.queryByText('/second')).not.toBeInTheDocument();
-});
-
-it('should stop propagation when stopPropagation is true', async () => {
- const buttonOnClick = jest.fn();
-
- const { user } = setupWithMemoryRouter(
- <button onClick={buttonOnClick} type="button">
- <NavLink stopPropagation to="/second" />
- </button>,
- );
-
- await user.click(screen.getByRole('link'));
-
- expect(buttonOnClick).not.toHaveBeenCalled();
-});
-
-it('should call onClick when one is passed', async () => {
- const onClick = jest.fn();
- const { user } = setupWithMemoryRouter(
- <NavLink onClick={onClick} stopPropagation to="/second" />,
- );
-
- await user.click(screen.getByRole('link'));
-
- expect(onClick).toHaveBeenCalled();
-});
-
-it('NavLink should be clickable', async () => {
- const { user } = setupWithMemoryRouter(<NavLink to="/second">internal link</NavLink>);
- expect(screen.getByRole('link')).toBeVisible();
-
- await user.click(screen.getByRole('link'));
-
- expect(screen.getByText('/second')).toBeVisible();
-});
-
-function ShowPath() {
- const { pathname } = useLocation();
- return <pre>{pathname}</pre>;
-}
-
-const setupWithMemoryRouter = (component: JSX.Element, initialEntries = ['/initial']) => {
- return render(
- <MemoryRouter initialEntries={initialEntries}>
- <Routes>
- <Route
- element={
- // Below: using <></> won't work in extensions ('React' is not defined). This is because the
- // name 'React' would already have been minified to something else when <> is resolved to
- // React.Fragment
- // eslint-disable-next-line react/jsx-fragments
- <React.Fragment>
- {component}
- <ShowPath />
- </React.Fragment>
- }
- path="/initial"
- />
- <Route element={<ShowPath />} path="/second" />
- </Routes>
- </MemoryRouter>,
- );
-};
diff --git a/server/sonar-web/design-system/src/components/__tests__/NewCodeLegend-test.tsx b/server/sonar-web/design-system/src/components/__tests__/NewCodeLegend-test.tsx
deleted file mode 100644
index c7929c29baa..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/NewCodeLegend-test.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import tailwindBaseConfig from '../../../../tailwind.base.config';
-import { render } from '../../helpers/testUtils';
-import { NewCodeLegend } from '../NewCodeLegend';
-
-it('should render NewCodeLegend', () => {
- render(<NewCodeLegend text="the text" />);
-
- expect(screen.getByText('the text')).toHaveStyle({
- font: 'var(--echoes-typography-text-default-regular)',
- 'margin-left': tailwindBaseConfig.theme.spacing[2],
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/Pill-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Pill-test.tsx
deleted file mode 100644
index 014f020809e..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Pill-test.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { Pill, PillVariant } from '../Pill';
-
-it('should render correctly', () => {
- render(<Pill variant={PillVariant.Accent}>23</Pill>);
- expect(screen.getByText('23')).toBeInTheDocument();
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/QualityGateIndicator-test.tsx b/server/sonar-web/design-system/src/components/__tests__/QualityGateIndicator-test.tsx
deleted file mode 100644
index 1b088a14a4b..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/QualityGateIndicator-test.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { IntlShape } from 'react-intl';
-import { renderWithContext } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { QualityGateIndicator } from '../QualityGateIndicator';
-
-jest.mock(
- 'react-intl',
- () =>
- ({
- ...jest.requireActual('react-intl'),
- useIntl: () => ({
- formatMessage: ({ id }: { id: string }, values = {}) =>
- [id, ...Object.values(values)].join('.'),
- }),
- }) as IntlShape,
-);
-
-it('should display tooltip', () => {
- const { rerender } = setupWithProps({
- size: 'sm',
- status: 'NONE',
- });
- expect(screen.getByTitle('overview.quality_gate_x.metric.level.NONE')).toBeInTheDocument();
-
- rerender(<QualityGateIndicator size="md" status="OK" />);
- expect(screen.getByTitle('overview.quality_gate_x.metric.level.OK')).toBeInTheDocument();
-
- rerender(<QualityGateIndicator size="xl" status="ERROR" />);
- expect(screen.getByTitle('overview.quality_gate_x.metric.level.ERROR')).toBeInTheDocument();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof QualityGateIndicator>> = {}) {
- return renderWithContext(<QualityGateIndicator status="OK" {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/SelectionCard-test.tsx b/server/sonar-web/design-system/src/components/__tests__/SelectionCard-test.tsx
deleted file mode 100644
index ddae065e795..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/SelectionCard-test.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { renderWithContext } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { SelectionCard } from '../SelectionCard';
-
-it('should render option and be actionnable', async () => {
- const user = userEvent.setup();
- const onClick = jest.fn();
- renderSelectionCard({
- onClick,
- children: <>The Option</>,
- });
-
- // Click on content
- await user.click(screen.getByText(/The Option/));
- expect(onClick).toHaveBeenCalledTimes(1);
-
- // Click on radio button
- await user.click(screen.getByRole('radio'));
- expect(onClick).toHaveBeenCalledTimes(2);
-});
-
-it('should not be actionnable when disabled', async () => {
- const user = userEvent.setup();
- const onClick = jest.fn();
- renderSelectionCard({
- onClick,
- disabled: true,
- children: <>The Option</>,
- });
-
- // Clicking on content or radio button should not trigger click handler
- await user.click(screen.getByText(/The Option/));
- expect(onClick).not.toHaveBeenCalled();
-
- await user.click(screen.getByRole('radio'));
- expect(onClick).not.toHaveBeenCalled();
-});
-
-it('should not be actionnable when no click handler', () => {
- renderSelectionCard({
- children: <>The Option</>,
- });
-
- // Radio button should not be shown
- expect(screen.queryByRole('radio')).not.toBeInTheDocument();
-});
-
-function renderSelectionCard(props: Partial<FCProps<typeof SelectionCard>> = {}) {
- return renderWithContext(
- <SelectionCard
- recommended
- recommendedReason="Recommended for you"
- title="Selection Card"
- titleInfo="info"
- {...props}
- />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/SizeIndicator-test.tsx b/server/sonar-web/design-system/src/components/__tests__/SizeIndicator-test.tsx
deleted file mode 100644
index d5eebb767cb..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/SizeIndicator-test.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-
-import { SizeLabel } from '../../types/measures';
-import { SizeIndicator } from '../SizeIndicator';
-
-it.each([
- [100, 'XS'],
- [1100, 'S'],
- [20_000, 'M'],
- [200_000, 'L'],
- [1_000_000, 'XL'],
-])('should display SizeIndicator with size', (value: number, letter: SizeLabel) => {
- setupWithProps({ value });
- expect(screen.getByText(letter)).toBeInTheDocument();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof SizeIndicator>> = {}) {
- return render(<SizeIndicator value={0} {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Spinner-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Spinner-test.tsx
deleted file mode 100644
index 03c6ad552d2..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Spinner-test.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render, screen } from '@testing-library/react';
-import { IntlWrapper } from '../../helpers/testUtils';
-import { Spinner } from '../Spinner';
-
-it('allows setting a custom class name', () => {
- renderSpinner({ className: 'foo' });
- expect(screen.getByRole('status')).toHaveClass('foo');
-});
-
-it('can be controlled by the loading prop', () => {
- const { rerender } = renderSpinner({ loading: true });
- expect(screen.getByText('loading')).toBeInTheDocument();
-
- rerender(prepareSpinner({ loading: false }));
- expect(screen.queryByText('loading')).not.toBeInTheDocument();
-});
-
-function renderSpinner(props: Partial<Parameters<typeof Spinner>[0]> = {}) {
- // We don't use our renderComponent() helper here, as we have some tests that
- // require changes in props.
- return render(prepareSpinner(props));
-}
-
-function prepareSpinner(props: Partial<Parameters<typeof Spinner>[0]> = {}) {
- return (
- <IntlWrapper>
- <Spinner {...props} />
- </IntlWrapper>
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/SpotlightTour-test.tsx b/server/sonar-web/design-system/src/components/__tests__/SpotlightTour-test.tsx
deleted file mode 100644
index f95b68f1a2a..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/SpotlightTour-test.tsx
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { renderWithContext } from '../../helpers/testUtils';
-import { SpotlightTour, SpotlightTourProps } from '../SpotlightTour';
-
-it('should display the spotlight tour', async () => {
- const user = userEvent.setup();
- const callback = jest.fn();
- renderSpotlightTour({ callback });
-
- expect(await screen.findByRole('alertdialog')).toBeInTheDocument();
- let dialog = screen.getByRole('alertdialog');
- expect(dialog).toHaveTextContent('Trust The Foo');
- expect(dialog).toHaveTextContent('Foo bar is baz');
- expect(screen.getByText('step 1 of 5')).toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { name: 'next' }));
-
- dialog = screen.getByRole('alertdialog');
- expect(dialog).toHaveTextContent('Trust The Baz');
- expect(dialog).toHaveTextContent('Baz foo is bar');
- expect(callback).toHaveBeenCalled();
-
- await user.click(screen.getByRole('button', { name: 'next' }));
-
- dialog = screen.getByRole('alertdialog');
- expect(dialog).toHaveTextContent('Trust The Bar');
- expect(dialog).toHaveTextContent('Bar baz is foo');
-
- await user.click(screen.getByRole('button', { name: 'next' }));
-
- dialog = screen.getByRole('alertdialog');
- expect(dialog).toHaveTextContent('Trust The Foo 2');
- expect(dialog).toHaveTextContent('Foo baz is bar');
-
- await user.click(screen.getByRole('button', { name: 'go_back' }));
-
- dialog = screen.getByRole('alertdialog');
- expect(dialog).toHaveTextContent('Trust The Bar');
- expect(dialog).toHaveTextContent('Bar baz is foo');
-
- await user.click(screen.getByRole('button', { name: 'next' }));
- await user.click(screen.getByRole('button', { name: 'next' }));
-
- dialog = screen.getByRole('alertdialog');
- expect(dialog).toHaveTextContent('Trust The Baz 2');
- expect(dialog).toHaveTextContent('Baz bar is foo');
-
- expect(screen.queryByRole('button', { name: 'next' })).not.toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { name: 'close' }));
-
- expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument();
-});
-
-it('should not show the spotlight tour if run is false', () => {
- renderSpotlightTour({ run: false });
- expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument();
-});
-
-it('should allow the customization of button labels', async () => {
- const user = userEvent.setup();
- renderSpotlightTour({
- nextLabel: 'forward',
- backLabel: 'backward',
- closeLabel: 'close_me',
- skipLabel: "just don't",
- showSkipButton: true,
- });
-
- expect(await screen.findByRole('alertdialog')).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'forward' })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: "just don't" })).toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { name: 'forward' }));
-
- expect(screen.getByRole('button', { name: 'backward' })).toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { name: 'forward' }));
- await user.click(screen.getByRole('button', { name: 'forward' }));
- await user.click(screen.getByRole('button', { name: 'forward' }));
-
- expect(screen.getByRole('button', { name: 'close_me' })).toBeInTheDocument();
-});
-
-it('should not display steps counter when there is only one step and no render method', async () => {
- renderSpotlightTour({
- steps: [
- {
- target: '#step1',
- content: 'Foo bar is baz',
- title: 'Trust The Foo',
- placement: 'top',
- },
- ],
- stepXofYLabel: undefined,
- });
-
- expect(await screen.findByRole('alertdialog')).toBeInTheDocument();
- expect(screen.queryByText('step 1 of 1')).not.toBeInTheDocument();
-});
-
-function renderSpotlightTour(props: Partial<SpotlightTourProps> = {}) {
- return renderWithContext(
- <div>
- <div id="step1">This is step 1</div>
- <div id="step2">This is step 2</div>
- <div id="step3">This is step 3</div>
- <div id="step4">This is step 4</div>
- <div id="step5">This is step 5</div>
-
- <SpotlightTour
- continuous
- run
- stepXofYLabel={(x: number, y: number) => `step ${x} of ${y}`}
- steps={[
- {
- target: '#step1',
- content: 'Foo bar is baz',
- title: 'Trust The Foo',
- placement: 'top',
- },
- {
- target: '#step2',
- content: 'Baz foo is bar',
- title: 'Trust The Baz',
- placement: 'right',
- },
- {
- target: '#step3',
- content: 'Bar baz is foo',
- title: 'Trust The Bar',
- placement: 'bottom',
- },
- {
- target: '#step4',
- content: 'Foo baz is bar',
- title: 'Trust The Foo 2',
- placement: 'left',
- },
- {
- target: '#step5',
- content: 'Baz bar is foo',
- title: 'Trust The Baz 2',
- placement: 'center',
- },
- ]}
- {...props}
- />
- </div>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Switch-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Switch-test.tsx
deleted file mode 100644
index 568a9721bba..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Switch-test.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { render } from '../../helpers/testUtils';
-import { Switch } from '../Switch';
-
-const defaultProps = {
- value: false,
-};
-
-it('renders switch correctly if value is false and change to true on click', async () => {
- const user = userEvent.setup();
- const onChange = jest.fn();
-
- render(<Switch {...defaultProps} onChange={onChange} />);
- const switchContainer = screen.getByRole('switch');
- expect(switchContainer).not.toBeChecked();
-
- await user.click(switchContainer);
-
- expect(onChange).toHaveBeenCalledWith(true);
-});
-
-it('renders switch correctly if value is true and change to false on click', async () => {
- const user = userEvent.setup();
- const onChange = jest.fn();
-
- render(<Switch {...defaultProps} onChange={onChange} value />);
- const switchContainer = screen.getByRole('switch');
- expect(switchContainer).toBeChecked();
-
- await user.click(switchContainer);
-
- expect(onChange).toHaveBeenCalledWith(false);
-});
-
-it('renders switch correctly if value is true and disabled', () => {
- render(<Switch {...defaultProps} disabled value />);
- const switchContainer = screen.getByRole('switch');
- expect(switchContainer).toBeDisabled();
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/Tabs-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Tabs-test.tsx
deleted file mode 100644
index b9409245f96..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Tabs-test.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { renderWithContext } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { TabOption, Tabs } from '../Tabs';
-
-it('should render all options', async () => {
- const user = userEvent.setup();
- const onChange = jest.fn();
- const options: Array<TabOption<number>> = [
- { value: 1, label: 'first' },
- { value: 2, label: 'disabled', disabled: true },
- { value: 3, label: 'has counter', counter: 7 },
- ];
- renderToggleButtons({ onChange, options, value: 1 });
-
- expect(screen.getAllByRole('tab')).toHaveLength(3);
-
- await user.click(screen.getByText('first'));
-
- expect(onChange).not.toHaveBeenCalled();
-
- await user.click(screen.getByText('has counter'));
-
- expect(onChange).toHaveBeenCalledWith(3);
-});
-
-function renderToggleButtons(props: Partial<FCProps<typeof Tabs>> = {}) {
- return renderWithContext(<Tabs onChange={jest.fn()} options={[]} {...props} />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Tags-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Tags-test.tsx
deleted file mode 100644
index 7683e281bc8..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Tags-test.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* eslint-disable import/no-extraneous-dependencies */
-
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { useState } from 'react';
-import { renderWithContext } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { MultiSelector } from '../MultiSelector';
-import { Tags } from '../Tags';
-import { Tooltip } from '../Tooltip';
-
-it('should display "no tags"', () => {
- renderTags({ tags: [] });
-
- expect(screen.getByText('no tags')).toBeInTheDocument();
-});
-
-it('should display tags', () => {
- const tags = ['tag1', 'tag2'];
- renderTags({ tags });
-
- expect(screen.getByText('tag1')).toBeInTheDocument();
- expect(screen.getByText('tag2')).toBeInTheDocument();
-});
-
-it('should handle more tags than the max to display', () => {
- const tags = ['tag1', 'tag2', 'tag3'];
- renderTags({ tags, tagsToDisplay: 2 });
-
- expect(screen.getByText('tag1')).toBeInTheDocument();
- expect(screen.getByText('tag2')).toBeInTheDocument();
- expect(screen.queryByText('tag3')).not.toBeInTheDocument();
- expect(screen.getByText('...')).toBeInTheDocument();
-});
-
-it('should allow editing tags', async () => {
- const user = userEvent.setup();
- renderTags({ allowUpdate: true });
-
- const plusButton = screen.getByText('+');
- expect(plusButton).toBeInTheDocument();
- await user.click(plusButton);
-
- expect(await screen.findByLabelText('search')).toBeInTheDocument();
- await user.click(screen.getByText('tag3'));
- await user.keyboard('{Escape}');
-
- expect(screen.getByText('tag1')).toBeInTheDocument();
- expect(screen.getByText('tag3')).toBeInTheDocument();
-
- await user.click(plusButton);
- await user.click(screen.getByRole('checkbox', { name: 'tag1' }));
- await user.keyboard('{Escape}');
-
- expect(screen.queryByText('tag1')).not.toBeInTheDocument();
- expect(screen.getByText('tag3')).toBeInTheDocument();
-});
-
-function renderTags(overrides: Partial<FCProps<typeof Tags>> = {}) {
- renderWithContext(<Wrapper {...overrides} />);
-}
-
-function Wrapper(overrides: Partial<FCProps<typeof Tags>> = {}) {
- const [selectedTags, setSelectedTags] = useState<string[]>(overrides.tags ?? ['tag1']);
-
- const overlay = (
- <MultiSelector
- createElementLabel="create new tag"
- elements={['tag1', 'tag2', 'tag3']}
- headerLabel="edit tags"
- noResultsLabel="no results"
- onSearch={jest.fn().mockResolvedValue(undefined)}
- onSelect={(tag) => {
- setSelectedTags([...selectedTags, tag]);
- }}
- onUnselect={(tag) => {
- const i = selectedTags.indexOf(tag);
- if (i > -1) {
- setSelectedTags([...selectedTags.slice(0, i), ...selectedTags.slice(i + 1)]);
- }
- }}
- searchInputAriaLabel="search"
- selectedElements={selectedTags}
- />
- );
-
- return (
- <Tags
- ariaTagsListLabel="list"
- emptyText="no tags"
- overlay={overlay}
- tags={selectedTags}
- tooltip={Tooltip}
- {...overrides}
- />
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Text-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Text-test.tsx
deleted file mode 100644
index c9562e9e5f0..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Text-test.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/* eslint-disable import/no-extraneous-dependencies */
-
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { TextBold, TextMuted } from '../Text';
-
-it('should render SearchText', () => {
- render(<TextBold match="hi" name="hiya" />);
-
- expect(screen.getByText('hi')).toHaveStyle({
- 'font-weight': '600',
- });
-});
-
-it('should render TextMuted', () => {
- render(<TextMuted text="Hi" />);
-
- expect(screen.getByText('Hi')).toHaveStyle({
- color: 'var(--echoes-color-text-subdued)',
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/TextAccordion-test.tsx b/server/sonar-web/design-system/src/components/__tests__/TextAccordion-test.tsx
deleted file mode 100644
index 53c34a7cbb5..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/TextAccordion-test.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import * as React from 'react';
-import { render } from '../../helpers/testUtils';
-import { TextAccordion } from '../TextAccordion';
-
-it('should behave correctly', async () => {
- const user = userEvent.setup();
- const children = 'hello';
- renderAccordion(children);
- expect(screen.queryByText(children)).not.toBeInTheDocument();
- await user.click(screen.getByRole('button', { name: 'test-aria' }));
- expect(screen.getByText(children)).toBeInTheDocument();
-});
-
-function renderAccordion(children: React.ReactNode) {
- function AccordionTest() {
- const [open, setOpen] = React.useState(false);
-
- return (
- <TextAccordion
- ariaLabel="test-aria"
- onClick={() => {
- setOpen(!open);
- }}
- open={open}
- renderHeader={() => 'Expand'}
- title="test"
- >
- <div>{children}</div>
- </TextAccordion>
- );
- }
-
- return render(<AccordionTest />);
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/Tooltip-test.tsx b/server/sonar-web/design-system/src/components/__tests__/Tooltip-test.tsx
deleted file mode 100644
index 2d0882b1c3f..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/Tooltip-test.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-import { Tooltip, TooltipInner } from '../Tooltip';
-
-jest.mock('react-dom', () => {
- const reactDom = jest.requireActual('react-dom') as object;
- return { ...reactDom, findDOMNode: jest.fn().mockReturnValue(undefined) };
-});
-
-describe('TooltipInner', () => {
- it('should open & close', async () => {
- const onShow = jest.fn();
- const onHide = jest.fn();
- const { user } = setupWithProps({ onHide, onShow });
-
- await user.hover(screen.getByRole('note'));
- expect(await screen.findByRole('tooltip')).toBeInTheDocument();
- expect(onShow).toHaveBeenCalled();
-
- await user.unhover(screen.getByRole('note'));
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- expect(onHide).toHaveBeenCalled();
- });
-
- it('should not shadow children pointer events', async () => {
- const onShow = jest.fn();
- const onHide = jest.fn();
- const onPointerEnter = jest.fn();
- const onPointerLeave = jest.fn();
- const { user } = setupWithProps(
- { onHide, onShow },
- <div onPointerEnter={onPointerEnter} onPointerLeave={onPointerLeave} role="note" />,
- );
-
- await user.hover(screen.getByRole('note'));
- expect(await screen.findByRole('tooltip')).toBeInTheDocument();
- expect(onShow).toHaveBeenCalled();
- expect(onPointerEnter).toHaveBeenCalled();
-
- await user.unhover(screen.getByRole('note'));
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- expect(onHide).toHaveBeenCalled();
- expect(onPointerLeave).toHaveBeenCalled();
- });
-
- it('should not open when mouse goes away quickly', async () => {
- const { user } = setupWithProps();
-
- await user.hover(screen.getByRole('note'));
- await user.unhover(screen.getByRole('note'));
-
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- });
-
- it('should position the tooltip correctly', async () => {
- const onShow = jest.fn();
- const onHide = jest.fn();
- const { user } = setupWithProps({ onHide, onShow });
-
- await user.hover(screen.getByRole('note'));
- expect(await screen.findByRole('tooltip')).toBeInTheDocument();
- expect(screen.getByRole('tooltip')).toHaveClass('bottom');
- });
-
- it('should be opened/hidden using tab navigation', async () => {
- const { user } = setupWithProps({}, <a href="#">Link</a>);
-
- await user.tab();
- expect(await screen.findByRole('tooltip')).toBeInTheDocument();
- await user.tab();
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- });
-
- function setupWithProps(
- props: Partial<TooltipInner['props']> = {},
- children = <div role="note" />,
- ) {
- return render(
- <TooltipInner content={<span id="overlay" />} mouseLeaveDelay={0} {...props}>
- {children}
- </TooltipInner>,
- );
- }
-});
-
-describe('Tooltip', () => {
- it('should not render tooltip without overlay', async () => {
- const { user } = setupWithProps({ content: undefined });
- await user.hover(screen.getByRole('note'));
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- });
-
- it('should not render undefined tooltips', async () => {
- const { user } = setupWithProps({ content: undefined, visible: true });
- await user.hover(screen.getByRole('note'));
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- });
-
- it('should not render empty tooltips', async () => {
- const { user } = setupWithProps({ content: '', visible: true });
- await user.hover(screen.getByRole('note'));
- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
- });
-
- function setupWithProps(
- props: Partial<FCProps<typeof Tooltip>> = {},
- children = <div role="note" />,
- ) {
- return render(
- <Tooltip content={<span id="overlay" />} {...props}>
- {children}
- </Tooltip>,
- );
- }
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/TreeMap-test.tsx b/server/sonar-web/design-system/src/components/__tests__/TreeMap-test.tsx
deleted file mode 100644
index a7f2bbc940b..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/TreeMap-test.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { render } from '../../helpers/testUtils';
-import { TreeMap, TreeMapProps } from '../TreeMap';
-
-it('should render correctly and forward click event', async () => {
- const user = userEvent.setup();
- const items = [
- {
- key: '1',
- size: 10,
- color: '#777',
- label: 'SonarQube_Server',
- },
- {
- key: '2',
- size: 30,
- color: '#777',
- label: 'SonarQube_Web',
- sourceData: 123,
- },
- {
- key: '3',
- size: 20,
- gradient: '#777',
- label: 'SonarQube_Search',
- },
- ];
- const onRectangleClick = jest.fn();
- const { container } = renderTreeMap({
- items,
- onRectangleClick,
- });
-
- expect(container).toMatchSnapshot();
-
- await user.click(screen.getByRole('link', { name: 'SonarQube_Web' }));
- expect(onRectangleClick).toHaveBeenCalledTimes(1);
- expect(onRectangleClick).toHaveBeenCalledWith(items[1]);
-});
-
-function renderTreeMap(props: Partial<TreeMapProps<unknown>>) {
- return render(
- <TreeMap height={100} items={[]} onRectangleClick={jest.fn()} width={100} {...props} />,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/TutorialStep-test.tsx b/server/sonar-web/design-system/src/components/__tests__/TutorialStep-test.tsx
deleted file mode 100644
index dbe04632892..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/TutorialStep-test.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { TutorialStep } from '../TutorialStep';
-import { TutorialStepList } from '../TutorialStepList';
-
-it('renders correctly', () => {
- renderTutorialStep();
- expect(screen.getByRole('heading', { level: 2, name: 'This is title' })).toBeInTheDocument();
- expect(screen.getByText('These are children')).toBeInTheDocument();
-});
-
-function renderTutorialStep() {
- return render(
- <TutorialStepList>
- <TutorialStep title="This is title">These are children</TutorialStep>
- </TutorialStepList>,
- );
-}
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/CodeSnippet-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/CodeSnippet-test.tsx.snap
deleted file mode 100644
index ac2ea24e199..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/CodeSnippet-test.tsx.snap
+++ /dev/null
@@ -1,691 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should highlight code content correctly 1`] = `
-.emotion-0 {
- background-color: rgb(252,252,253);
- border: 1px solid rgb(225,230,243);
- border-radius: 0.5rem;
- position: relative;
- margin-top: 0.5rem;
- margin-bottom: 0.5rem;
-}
-
-.emotion-0.code-snippet-simple-oneline {
- margin-top: 0;
- margin-bottom: 0;
- border-radius: 0.25rem;
-}
-
-.emotion-3 {
- box-sizing: border-box;
- display: -webkit-inline-box;
- display: -webkit-inline-flex;
- display: -ms-inline-flexbox;
- display: inline-flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- padding: var(--echoes-dimension-space-0) var(--button-padding);
- height: var(--button-height);
- min-height: var(--button-height);
- overflow: hidden;
- font: var(--echoes-typography-others-label);
- color: var(--button-color);
- -webkit-text-decoration: none;
- text-decoration: none;
- background-color: var(--button-background);
- border: var(--button-border);
- border-radius: var(--echoes-border-radius-400);
- outline: none;
- cursor: pointer;
- --button-color: var(--echoes-color-text-default);
- --button-border: var(--echoes-color-border-bold) solid var(--echoes-border-width-default);
- --button-background: var(--echoes-color-background-default);
- --button-background-hover: var(--echoes-color-background-default-hover);
- --button-background-active: var(--echoes-color-background-default-active);
- --button-background-focus: var(--echoes-color-background-default);
- --button-background-disabled: var(--echoes-color-background-disabled);
- --button-padding: var(--echoes-dimension-space-150);
- --button-height: var(--echoes-sizes-buttons-large);
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- font: var(--echoes-typography-text-default-regular);
- right: 1.5rem;
- top: 1.5rem;
- position: absolute;
-}
-
-.emotion-3:focus,
-.emotion-3:focus-visible {
- background-color: var(--button-background-focus);
- outline: var(--echoes-color-focus-default) solid var(--echoes-focus-border-width-default);
- outline-offset: var(--echoes-focus-border-offset-default);
-}
-
-.emotion-3:hover {
- background-color: var(--button-background-hover);
-}
-
-.emotion-3:active {
- background-color: var(--button-background-active);
-}
-
-.emotion-3:disabled,
-.emotion-3:disabled:has(:hover, :active, :focus, :focus-visible) {
- color: var(--echoes-color-text-disabled);
- background-color: var(--button-background-disabled);
- border: none;
- cursor: not-allowed;
- pointer-events: none;
-}
-
-.code-snippet-highlighted-oneline .emotion-3 {
- bottom: 0.5rem;
-}
-
-.emotion-5 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- gap: var(--echoes-dimension-space-75);
- overflow: hidden;
-}
-
-.emotion-7 {
- -moz-osx-font-smoothing: grayscale;
- -webkit-font-smoothing: antialiased;
- display: inline-block;
- font-size: calc(1em + 4px);
- font-style: normal;
- font-weight: normal;
- height: calc(2em - 16px);
- line-height: calc(2em - 16px);
- text-align: center;
- vertical-align: bottom;
- width: calc(2em - 16px);
- font-family: 'Material Symbols Rounded';
-}
-
-.emotion-9 {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.emotion-11 code {
- font: var(--echoes-typography-code-default);
- background: rgb(252,252,253);
- color: rgb(51,53,60);
-}
-
-.emotion-11 code.hljs {
- padding: unset;
-}
-
-.emotion-11 .hljs-meta,
-.emotion-11 .hljs-variable {
- color: rgb(51,53,60);
-}
-
-.emotion-11 .hljs-doctag,
-.emotion-11 .hljs-title,
-.emotion-11 .hljs-title.class_,
-.emotion-11 .hljs-title.function_ {
- color: rgb(34,84,192);
-}
-
-.emotion-11 .hljs-comment {
- font: var(--echoes-typography-code-comment);
- color: rgb(109,111,119);
-}
-
-.emotion-11 .hljs-keyword,
-.emotion-11 .hljs-tag,
-.emotion-11 .hljs-type {
- color: rgb(152,29,150);
-}
-
-.emotion-11 .hljs-literal,
-.emotion-11 .hljs-number {
- color: rgb(126,83,5);
-}
-
-.emotion-11 .hljs-string {
- color: rgb(32,105,31);
-}
-
-.emotion-11 .hljs-meta .hljs-keyword {
- color: rgb(47,103,48);
-}
-
-.emotion-11 .sonar-underline {
- -webkit-text-decoration: underline rgb(253,162,155);
- text-decoration: underline rgb(253,162,155);
- -webkit-text-decoration: underline rgb(253,162,155) wavy;
- text-decoration: underline rgb(253,162,155) wavy;
- text-decoration-thickness: 2px;
- text-decoration-skip-ink: none;
-}
-
-.emotion-11.code-wrap {
- white-space: pre-wrap;
- word-break: break-all;
-}
-
-.emotion-11.code-wrap.wrap-words {
- word-break: normal;
- overflow-wrap: break-word;
-}
-
-.emotion-11 mark {
- font-weight: 400;
- padding: 0.25rem;
- border-radius: 0.25rem;
- background-color: rgb(197,205,223);
- color: rgb(217,45,32);
-}
-
-<div>
- <div
- class="sw-code fs-mask emotion-0 emotion-1"
- >
- <button
- class="sw-select-none emotion-2 emotion-3 emotion-4"
- data-state="closed"
- type="button"
- >
- <span
- class="emotion-5 emotion-6"
- >
- <span
- aria-hidden="true"
- class="emotion-7 emotion-8"
- >
- 
- </span>
- <span
- class="emotion-9 emotion-10"
- >
- Copy
- </span>
- </span>
- </button>
- <span
- class="hljs sw-overflow-auto sw-pr-24 sw-flex emotion-11 emotion-12"
- >
- <pre>
- &lt;prop&gt;foobar&lt;prop&gt;
- </pre>
- </span>
- </div>
-</div>
-`;
-
-exports[`should show full size when multiline with no editing 1`] = `
-.emotion-0 {
- background-color: rgb(252,252,253);
- border: 1px solid rgb(225,230,243);
- border-radius: 0.5rem;
- position: relative;
- margin-top: 0.5rem;
- margin-bottom: 0.5rem;
-}
-
-.emotion-0.code-snippet-simple-oneline {
- margin-top: 0;
- margin-bottom: 0;
- border-radius: 0.25rem;
-}
-
-.emotion-3 {
- box-sizing: border-box;
- display: -webkit-inline-box;
- display: -webkit-inline-flex;
- display: -ms-inline-flexbox;
- display: inline-flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- padding: var(--echoes-dimension-space-0) var(--button-padding);
- height: var(--button-height);
- min-height: var(--button-height);
- overflow: hidden;
- font: var(--echoes-typography-others-label);
- color: var(--button-color);
- -webkit-text-decoration: none;
- text-decoration: none;
- background-color: var(--button-background);
- border: var(--button-border);
- border-radius: var(--echoes-border-radius-400);
- outline: none;
- cursor: pointer;
- --button-color: var(--echoes-color-text-default);
- --button-border: var(--echoes-color-border-bold) solid var(--echoes-border-width-default);
- --button-background: var(--echoes-color-background-default);
- --button-background-hover: var(--echoes-color-background-default-hover);
- --button-background-active: var(--echoes-color-background-default-active);
- --button-background-focus: var(--echoes-color-background-default);
- --button-background-disabled: var(--echoes-color-background-disabled);
- --button-padding: var(--echoes-dimension-space-150);
- --button-height: var(--echoes-sizes-buttons-large);
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- font: var(--echoes-typography-text-default-regular);
- right: 1.5rem;
- top: 1.5rem;
- position: absolute;
-}
-
-.emotion-3:focus,
-.emotion-3:focus-visible {
- background-color: var(--button-background-focus);
- outline: var(--echoes-color-focus-default) solid var(--echoes-focus-border-width-default);
- outline-offset: var(--echoes-focus-border-offset-default);
-}
-
-.emotion-3:hover {
- background-color: var(--button-background-hover);
-}
-
-.emotion-3:active {
- background-color: var(--button-background-active);
-}
-
-.emotion-3:disabled,
-.emotion-3:disabled:has(:hover, :active, :focus, :focus-visible) {
- color: var(--echoes-color-text-disabled);
- background-color: var(--button-background-disabled);
- border: none;
- cursor: not-allowed;
- pointer-events: none;
-}
-
-.code-snippet-highlighted-oneline .emotion-3 {
- bottom: 0.5rem;
-}
-
-.emotion-5 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- gap: var(--echoes-dimension-space-75);
- overflow: hidden;
-}
-
-.emotion-7 {
- -moz-osx-font-smoothing: grayscale;
- -webkit-font-smoothing: antialiased;
- display: inline-block;
- font-size: calc(1em + 4px);
- font-style: normal;
- font-weight: normal;
- height: calc(2em - 16px);
- line-height: calc(2em - 16px);
- text-align: center;
- vertical-align: bottom;
- width: calc(2em - 16px);
- font-family: 'Material Symbols Rounded';
-}
-
-.emotion-9 {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.emotion-11 code {
- font: var(--echoes-typography-code-default);
- background: rgb(252,252,253);
- color: rgb(51,53,60);
-}
-
-.emotion-11 code.hljs {
- padding: unset;
-}
-
-.emotion-11 .hljs-meta,
-.emotion-11 .hljs-variable {
- color: rgb(51,53,60);
-}
-
-.emotion-11 .hljs-doctag,
-.emotion-11 .hljs-title,
-.emotion-11 .hljs-title.class_,
-.emotion-11 .hljs-title.function_ {
- color: rgb(34,84,192);
-}
-
-.emotion-11 .hljs-comment {
- font: var(--echoes-typography-code-comment);
- color: rgb(109,111,119);
-}
-
-.emotion-11 .hljs-keyword,
-.emotion-11 .hljs-tag,
-.emotion-11 .hljs-type {
- color: rgb(152,29,150);
-}
-
-.emotion-11 .hljs-literal,
-.emotion-11 .hljs-number {
- color: rgb(126,83,5);
-}
-
-.emotion-11 .hljs-string {
- color: rgb(32,105,31);
-}
-
-.emotion-11 .hljs-meta .hljs-keyword {
- color: rgb(47,103,48);
-}
-
-.emotion-11 .sonar-underline {
- -webkit-text-decoration: underline rgb(253,162,155);
- text-decoration: underline rgb(253,162,155);
- -webkit-text-decoration: underline rgb(253,162,155) wavy;
- text-decoration: underline rgb(253,162,155) wavy;
- text-decoration-thickness: 2px;
- text-decoration-skip-ink: none;
-}
-
-.emotion-11.code-wrap {
- white-space: pre-wrap;
- word-break: break-all;
-}
-
-.emotion-11.code-wrap.wrap-words {
- word-break: normal;
- overflow-wrap: break-word;
-}
-
-.emotion-11 mark {
- font-weight: 400;
- padding: 0.25rem;
- border-radius: 0.25rem;
- background-color: rgb(197,205,223);
- color: rgb(217,45,32);
-}
-
-<div>
- <div
- class="sw-code fs-mask emotion-0 emotion-1"
- >
- <button
- class="sw-select-none emotion-2 emotion-3 emotion-4"
- data-state="closed"
- type="button"
- >
- <span
- class="emotion-5 emotion-6"
- >
- <span
- aria-hidden="true"
- class="emotion-7 emotion-8"
- >
- 
- </span>
- <span
- class="emotion-9 emotion-10"
- >
- Copy
- </span>
- </span>
- </button>
- <span
- class="hljs sw-overflow-auto sw-pr-24 sw-flex emotion-11 emotion-12"
- >
- <pre>
- foo
-bar
- </pre>
- </span>
- </div>
-</div>
-`;
-
-exports[`should show reduced size when single line with no editing 1`] = `
-.emotion-0 {
- background-color: rgb(252,252,253);
- border: 1px solid rgb(225,230,243);
- border-radius: 0.5rem;
- position: relative;
- margin-top: 0.5rem;
- margin-bottom: 0.5rem;
-}
-
-.emotion-0.code-snippet-simple-oneline {
- margin-top: 0;
- margin-bottom: 0;
- border-radius: 0.25rem;
-}
-
-.emotion-3 {
- box-sizing: border-box;
- display: -webkit-inline-box;
- display: -webkit-inline-flex;
- display: -ms-inline-flexbox;
- display: inline-flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- padding: var(--echoes-dimension-space-0) var(--button-padding);
- height: var(--button-height);
- min-height: var(--button-height);
- overflow: hidden;
- font: var(--echoes-typography-others-label);
- color: var(--button-color);
- -webkit-text-decoration: none;
- text-decoration: none;
- background-color: var(--button-background);
- border: var(--button-border);
- border-radius: var(--echoes-border-radius-400);
- outline: none;
- cursor: pointer;
- --button-color: var(--echoes-color-text-default);
- --button-border: var(--echoes-color-border-bold) solid var(--echoes-border-width-default);
- --button-background: var(--echoes-color-background-default);
- --button-background-hover: var(--echoes-color-background-default-hover);
- --button-background-active: var(--echoes-color-background-default-active);
- --button-background-focus: var(--echoes-color-background-default);
- --button-background-disabled: var(--echoes-color-background-disabled);
- --button-padding: var(--echoes-dimension-space-150);
- --button-height: var(--echoes-sizes-buttons-large);
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- font: var(--echoes-typography-text-default-regular);
- right: 1.5rem;
- top: 1.5rem;
- position: absolute;
- bottom: 1rem;
- top: 1rem;
-}
-
-.emotion-3:focus,
-.emotion-3:focus-visible {
- background-color: var(--button-background-focus);
- outline: var(--echoes-color-focus-default) solid var(--echoes-focus-border-width-default);
- outline-offset: var(--echoes-focus-border-offset-default);
-}
-
-.emotion-3:hover {
- background-color: var(--button-background-hover);
-}
-
-.emotion-3:active {
- background-color: var(--button-background-active);
-}
-
-.emotion-3:disabled,
-.emotion-3:disabled:has(:hover, :active, :focus, :focus-visible) {
- color: var(--echoes-color-text-disabled);
- background-color: var(--button-background-disabled);
- border: none;
- cursor: not-allowed;
- pointer-events: none;
-}
-
-.code-snippet-highlighted-oneline .emotion-3 {
- bottom: 0.5rem;
-}
-
-.emotion-5 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- gap: var(--echoes-dimension-space-75);
- overflow: hidden;
-}
-
-.emotion-7 {
- -moz-osx-font-smoothing: grayscale;
- -webkit-font-smoothing: antialiased;
- display: inline-block;
- font-size: calc(1em + 4px);
- font-style: normal;
- font-weight: normal;
- height: calc(2em - 16px);
- line-height: calc(2em - 16px);
- text-align: center;
- vertical-align: bottom;
- width: calc(2em - 16px);
- font-family: 'Material Symbols Rounded';
-}
-
-.emotion-9 {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.emotion-11 code {
- font: var(--echoes-typography-code-default);
- background: rgb(252,252,253);
- color: rgb(51,53,60);
-}
-
-.emotion-11 code.hljs {
- padding: unset;
-}
-
-.emotion-11 .hljs-meta,
-.emotion-11 .hljs-variable {
- color: rgb(51,53,60);
-}
-
-.emotion-11 .hljs-doctag,
-.emotion-11 .hljs-title,
-.emotion-11 .hljs-title.class_,
-.emotion-11 .hljs-title.function_ {
- color: rgb(34,84,192);
-}
-
-.emotion-11 .hljs-comment {
- font: var(--echoes-typography-code-comment);
- color: rgb(109,111,119);
-}
-
-.emotion-11 .hljs-keyword,
-.emotion-11 .hljs-tag,
-.emotion-11 .hljs-type {
- color: rgb(152,29,150);
-}
-
-.emotion-11 .hljs-literal,
-.emotion-11 .hljs-number {
- color: rgb(126,83,5);
-}
-
-.emotion-11 .hljs-string {
- color: rgb(32,105,31);
-}
-
-.emotion-11 .hljs-meta .hljs-keyword {
- color: rgb(47,103,48);
-}
-
-.emotion-11 .sonar-underline {
- -webkit-text-decoration: underline rgb(253,162,155);
- text-decoration: underline rgb(253,162,155);
- -webkit-text-decoration: underline rgb(253,162,155) wavy;
- text-decoration: underline rgb(253,162,155) wavy;
- text-decoration-thickness: 2px;
- text-decoration-skip-ink: none;
-}
-
-.emotion-11.code-wrap {
- white-space: pre-wrap;
- word-break: break-all;
-}
-
-.emotion-11.code-wrap.wrap-words {
- word-break: normal;
- overflow-wrap: break-word;
-}
-
-.emotion-11 mark {
- font-weight: 400;
- padding: 0.25rem;
- border-radius: 0.25rem;
- background-color: rgb(197,205,223);
- color: rgb(217,45,32);
-}
-
-<div>
- <div
- class="sw-code sw-py-6 code-snippet-highlighted-oneline fs-mask emotion-0 emotion-1"
- >
- <button
- class="sw-select-none emotion-2 emotion-3 emotion-4"
- data-state="closed"
- type="button"
- >
- <span
- class="emotion-5 emotion-6"
- >
- <span
- aria-hidden="true"
- class="emotion-7 emotion-8"
- >
- 
- </span>
- <span
- class="emotion-9 emotion-10"
- >
- Copy
- </span>
- </span>
- </button>
- <span
- class="hljs sw-overflow-auto sw-pr-24 sw-flex emotion-11 emotion-12"
- >
- <code>
- foobar
- </code>
- </span>
- </div>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/CoverageIndicator-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/CoverageIndicator-test.tsx.snap
deleted file mode 100644
index f04fb70a190..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/CoverageIndicator-test.tsx.snap
+++ /dev/null
@@ -1,83 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should display CoverageIndicator 1`] = `
-<body>
- <div>
- <svg
- class="donut-chart"
- height="24"
- width="24"
- >
- <g
- transform="translate(0, 0)"
- >
- <g
- transform="translate(12, 12)"
- >
- <path
- d="M0.75,-11.977A12,12,0,0,1,7.222,-9.583L5.265,-7.299A9,9,0,0,0,0.75,-8.969Z"
- style="fill: rgb(18,183,106);"
- />
- <path
- d="M8.361,-8.608A12,12,0,1,1,-0.75,-11.977L-0.75,-8.969A9,9,0,1,0,6.404,-6.324Z"
- style="fill: rgb(180,35,24);"
- />
- </g>
- </g>
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display CoverageIndicator with correct aria properties 1`] = `
-<body>
- <div>
- <svg
- aria-hidden="true"
- aria-label="label"
- fill="none"
- height="24"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="24"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- >
- <path
- clip-rule="evenodd"
- d="M16 8C16 12.4183 12.4183 16 8 16C5.5106 16 3.28676 14.863 1.81951 13.0799L15.4913 5.1865C15.8201 6.06172 16 7.00986 16 8ZM14.5574 3.41624L0.750565 11.3876C0.269025 10.3589 0 9.21089 0 8C0 3.58172 3.58172 0 8 0C10.7132 0 13.1109 1.35064 14.5574 3.41624Z"
- fill="#E1E6F3"
- fill-rule="evenodd"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display CoverageIndicator without value 1`] = `
-<body>
- <div>
- <svg
- aria-hidden="true"
- fill="none"
- height="24"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="24"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- >
- <path
- clip-rule="evenodd"
- d="M16 8C16 12.4183 12.4183 16 8 16C5.5106 16 3.28676 14.863 1.81951 13.0799L15.4913 5.1865C15.8201 6.06172 16 7.00986 16 8ZM14.5574 3.41624L0.750565 11.3876C0.269025 10.3589 0 9.21089 0 8C0 3.58172 3.58172 0 8 0C10.7132 0 13.1109 1.35064 14.5574 3.41624Z"
- fill="#E1E6F3"
- fill-rule="evenodd"
- />
- </svg>
- </div>
-</body>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/DuplicationsIndicator-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/DuplicationsIndicator-test.tsx.snap
deleted file mode 100644
index 677207098fe..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/DuplicationsIndicator-test.tsx.snap
+++ /dev/null
@@ -1,203 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should display DuplicationsIndicator with rating 1`] = `
-<body>
- <div>
- <svg
- height="24"
- viewBox="0 0 16 16"
- width="24"
- >
- <circle
- cx="8"
- cy="8"
- fill="rgb(18,183,106)"
- r="2"
- />
- <path
- clip-rule="evenodd"
- d="M8 14c3.3137 0 6-2.6863 6-6 0-3.31371-2.6863-6-6-6-3.31371 0-6 2.68629-6 6 0 3.3137 2.68629 6 6 6Zm0 2c4.4183 0 8-3.5817 8-8 0-4.41828-3.5817-8-8-8-4.41828 0-8 3.58172-8 8 0 4.4183 3.58172 8 8 8Z"
- fill="rgb(239,242,249)"
- fill-rule="evenodd"
- />
- <circle
- cx="8"
- cy="8"
- fill="rgb(18,183,106)"
- r="2"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display DuplicationsIndicator with rating 2`] = `
-<body>
- <div>
- <svg
- height="24"
- viewBox="0 0 16 16"
- width="24"
- >
- <circle
- cx="8"
- cy="8"
- fill="rgb(18,183,106)"
- r="2"
- />
- <path
- clip-rule="evenodd"
- d="M8 14c3.3137 0 6-2.6863 6-6 0-3.31371-2.6863-6-6-6-3.31371 0-6 2.68629-6 6 0 3.3137 2.68629 6 6 6Zm0 2c4.4183 0 8-3.5817 8-8 0-4.41828-3.5817-8-8-8-4.41828 0-8 3.58172-8 8 0 4.4183 3.58172 8 8 8Z"
- fill="rgb(239,242,249)"
- fill-rule="evenodd"
- />
- <path
- d="M8 0c.81879 0 1.63272.125698 2.4134.372702L9.81002 2.27953A5.99976 5.99976 0 0 0 8 2V0Z"
- fill="rgb(18,183,106)"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display DuplicationsIndicator with rating 3`] = `
-<body>
- <div>
- <svg
- height="24"
- viewBox="0 0 16 16"
- width="24"
- >
- <circle
- cx="8"
- cy="8"
- fill="rgb(110,183,18)"
- r="2"
- />
- <path
- clip-rule="evenodd"
- d="M8 14c3.3137 0 6-2.6863 6-6 0-3.31371-2.6863-6-6-6-3.31371 0-6 2.68629-6 6 0 3.3137 2.68629 6 6 6Zm0 2c4.4183 0 8-3.5817 8-8 0-4.41828-3.5817-8-8-8-4.41828 0-8 3.58172-8 8 0 4.4183 3.58172 8 8 8Z"
- fill="rgb(239,242,249)"
- fill-rule="evenodd"
- />
- <path
- d="M8 0c1.89071 2e-8 3.7203.669649 5.1643 1.89017l-1.2911 1.52746C10.7902 2.50224 9.41803 2 8 2V0Z"
- fill="rgb(110,183,18)"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display DuplicationsIndicator with rating 4`] = `
-<body>
- <div>
- <svg
- height="24"
- viewBox="0 0 16 16"
- width="24"
- >
- <circle
- cx="8"
- cy="8"
- fill="rgb(245,184,64)"
- r="2"
- />
- <path
- clip-rule="evenodd"
- d="M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"
- fill="rgb(239,242,249)"
- fill-rule="evenodd"
- />
- <path
- d="M8 0a7.9999 7.9999 0 0 1 4.5815 1.44181 7.99949 7.99949 0 0 1 2.9301 3.80574l-1.8779.68811A6.00009 6.00009 0 0 0 8 2V0Z"
- fill="rgb(245,184,64)"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display DuplicationsIndicator with rating 5`] = `
-<body>
- <div>
- <svg
- height="24"
- viewBox="0 0 16 16"
- width="24"
- >
- <circle
- cx="8"
- cy="8"
- fill="rgb(247,95,9)"
- r="2"
- />
- <path
- clip-rule="evenodd"
- d="M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"
- fill="rgb(239,242,249)"
- fill-rule="evenodd"
- />
- <path
- d="M8 0a8 8 0 0 1 5.0686 1.81054 8.00033 8.00033 0 0 1 2.7744 4.61211l-1.9608.39434a5.99958 5.99958 0 0 0-2.0808-3.45908A5.99972 5.99972 0 0 0 8 2V0Z"
- fill="rgb(247,95,9)"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display DuplicationsIndicator with rating 6`] = `
-<body>
- <div>
- <svg
- height="24"
- viewBox="0 0 16 16"
- width="24"
- >
- <circle
- cx="8"
- cy="8"
- fill="rgb(240,68,56)"
- r="2"
- />
- <path
- clip-rule="evenodd"
- d="M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"
- fill="rgb(239,242,249)"
- fill-rule="evenodd"
- />
- <path
- d="M8 0a8.0002 8.0002 0 0 1 5.6569 13.6569l-1.4143-1.4143a5.9993 5.9993 0 0 0 1.3007-6.5387A5.9999 5.9999 0 0 0 8 2V0Z"
- fill="rgb(240,68,56)"
- />
- </svg>
- </div>
-</body>
-`;
-
-exports[`should display DuplicationsIndicator without rating 1`] = `
-<body>
- <div>
- <svg
- aria-hidden="true"
- fill="none"
- height="24"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="24"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- >
- <path
- clip-rule="evenodd"
- d="M16 8C16 12.4183 12.4183 16 8 16C5.5106 16 3.28676 14.863 1.81951 13.0799L15.4913 5.1865C15.8201 6.06172 16 7.00986 16 8ZM14.5574 3.41624L0.750565 11.3876C0.269025 10.3589 0 9.21089 0 8C0 3.58172 3.58172 0 8 0C10.7132 0 13.1109 1.35064 14.5574 3.41624Z"
- fill="#E1E6F3"
- fill-rule="evenodd"
- />
- </svg>
- </div>
-</body>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/FavoriteButton-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/FavoriteButton-test.tsx.snap
deleted file mode 100644
index ac4eb0e769e..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/FavoriteButton-test.tsx.snap
+++ /dev/null
@@ -1,167 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render favorite empty 1`] = `
-.emotion-1 {
- box-sizing: border-box;
- border: none;
- outline: none;
- -webkit-text-decoration: none;
- text-decoration: none;
- color: var(--color);
- background-color: var(--background);
- -webkit-transition: background-color 0.2s ease,outline 0.2s ease,color 0.2s ease;
- transition: background-color 0.2s ease,outline 0.2s ease,color 0.2s ease;
- display: -webkit-inline-box;
- display: -webkit-inline-flex;
- display: -ms-inline-flexbox;
- display: inline-flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- cursor: pointer;
- height: 1.5rem;
- border-radius: 0.125rem;
- padding-left: 0.25rem;
- padding-right: 0.25rem;
- --background: transparent;
- --backgroundHover: rgb(232,235,255);
- --color: rgb(75,86,187);
- --colorHover: rgb(43,51,104);
- --focus: rgba(93,108,208,0.2);
-}
-
-.emotion-1:hover,
-.emotion-1:focus,
-.emotion-1:active {
- color: var(--colorHover);
- background-color: var(--backgroundHover);
-}
-
-.emotion-1:focus,
-.emotion-1:active {
- outline: 4px solid var(--focus);
-}
-
-.emotion-1:disabled,
-.emotion-1:disabled:hover {
- color: var(--echoes-color-icon-disabled);
- background-color: var(--background);
- cursor: not-allowed;
-}
-
-.emotion-3 {
- fill: rgb(237,148,106);
-}
-
-<div>
- <button
- aria-describedby="tooltip-2"
- aria-label="label-info"
- class="it__favorite-link it__is-filled emotion-0 emotion-1 emotion-2"
- type="button"
- >
- <svg
- aria-hidden="true"
- class=" emotion-3 emotion-4"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"
- />
- </svg>
- </button>
-</div>
-`;
-
-exports[`should render favorite filled 1`] = `
-.emotion-1 {
- box-sizing: border-box;
- border: none;
- outline: none;
- -webkit-text-decoration: none;
- text-decoration: none;
- color: var(--color);
- background-color: var(--background);
- -webkit-transition: background-color 0.2s ease,outline 0.2s ease,color 0.2s ease;
- transition: background-color 0.2s ease,outline 0.2s ease,color 0.2s ease;
- display: -webkit-inline-box;
- display: -webkit-inline-flex;
- display: -ms-inline-flexbox;
- display: inline-flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- cursor: pointer;
- height: 1.5rem;
- border-radius: 0.125rem;
- padding-left: 0.25rem;
- padding-right: 0.25rem;
- --background: transparent;
- --backgroundHover: rgb(232,235,255);
- --color: rgb(75,86,187);
- --colorHover: rgb(43,51,104);
- --focus: rgba(93,108,208,0.2);
-}
-
-.emotion-1:hover,
-.emotion-1:focus,
-.emotion-1:active {
- color: var(--colorHover);
- background-color: var(--backgroundHover);
-}
-
-.emotion-1:focus,
-.emotion-1:active {
- outline: 4px solid var(--focus);
-}
-
-.emotion-1:disabled,
-.emotion-1:disabled:hover {
- color: var(--echoes-color-icon-disabled);
- background-color: var(--background);
- cursor: not-allowed;
-}
-
-.emotion-3 {
- fill: rgb(237,148,106);
-}
-
-<div>
- <button
- aria-describedby="tooltip-1"
- aria-label="label-info"
- class="it__favorite-link it__is-filled emotion-0 emotion-1 emotion-2"
- type="button"
- >
- <svg
- aria-hidden="true"
- class=" emotion-3 emotion-4"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"
- />
- </svg>
- </button>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/Histogram-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/Histogram-test.tsx.snap
deleted file mode 100644
index e3653d1d3e2..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/Histogram-test.tsx.snap
+++ /dev/null
@@ -1,369 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly 1`] = `
-.emotion-0 {
- fill: rgb(93,108,208);
-}
-
-<div>
- <svg
- height="75"
- width="100"
- >
- <g
- transform="translate(10, 10)"
- >
- <g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="54"
- x="0"
- y="10"
- />
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="41"
- x="0"
- y="28"
- />
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="81"
- x="0"
- y="46"
- />
- </g>
- </g>
- </g>
- </svg>
-</div>
-`;
-
-exports[`renders correctly with yValues 1`] = `
-.emotion-0 {
- fill: rgb(93,108,208);
-}
-
-.emotion-2 {
- font: var(--echoes-typography-text-default-regular);
- fill: var(--echoes-color-text-subdued);
-}
-
-.e1vbniy52 .emotion-2 {
- fill: rgb(255,255,255);
-}
-
-<div>
- <svg
- height="75"
- width="100"
- >
- <g
- transform="translate(10, 10)"
- >
- <g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="54"
- x="0"
- y="10"
- />
- <text
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="53.33333333333333"
- y="15"
- >
- 100.0
- </text>
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="41"
- x="0"
- y="28"
- />
- <text
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="40"
- y="33"
- >
- 75.0
- </text>
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="81"
- x="0"
- y="46"
- />
- <text
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="80"
- y="51"
- >
- 150.0
- </text>
- </g>
- </g>
- </g>
- </svg>
-</div>
-`;
-
-exports[`renders correctly with yValues and yTicks 1`] = `
-.emotion-0 {
- fill: rgb(93,108,208);
-}
-
-.emotion-2 {
- font: var(--echoes-typography-text-default-regular);
- fill: var(--echoes-color-text-subdued);
-}
-
-.e1vbniy52 .emotion-2 {
- fill: rgb(255,255,255);
-}
-
-<div>
- <svg
- height="75"
- width="100"
- >
- <g
- transform="translate(10, 10)"
- >
- <g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="54"
- x="0"
- y="10"
- />
- <text
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="53.33333333333333"
- y="15"
- >
- 100.0
- </text>
- <text
- class="emotion-2 emotion-3"
- dx="-1em"
- dy="0.3em"
- text-anchor="end"
- x="0"
- y="15"
- >
- a
- </text>
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="41"
- x="0"
- y="28"
- />
- <text
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="40"
- y="33"
- >
- 75.0
- </text>
- <text
- class="emotion-2 emotion-3"
- dx="-1em"
- dy="0.3em"
- text-anchor="end"
- x="0"
- y="33"
- >
- b
- </text>
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="81"
- x="0"
- y="46"
- />
- <text
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="80"
- y="51"
- >
- 150.0
- </text>
- <text
- class="emotion-2 emotion-3"
- dx="-1em"
- dy="0.3em"
- text-anchor="end"
- x="0"
- y="51"
- >
- c
- </text>
- </g>
- </g>
- </g>
- </svg>
-</div>
-`;
-
-exports[`renders correctly with yValues, yTicks, and yTooltips 1`] = `
-.emotion-0 {
- fill: rgb(93,108,208);
-}
-
-.emotion-2 {
- font: var(--echoes-typography-text-default-regular);
- fill: var(--echoes-color-text-subdued);
-}
-
-.e1vbniy52 .emotion-2 {
- fill: rgb(255,255,255);
-}
-
-<div>
- <svg
- height="75"
- width="100"
- >
- <g
- transform="translate(10, 10)"
- >
- <g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="54"
- x="0"
- y="10"
- />
- <text
- aria-describedby="tooltip-1"
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="53.33333333333333"
- y="15"
- >
- 100.0
- </text>
- <text
- class="emotion-2 emotion-3"
- dx="-1em"
- dy="0.3em"
- text-anchor="end"
- x="0"
- y="15"
- >
- a
- </text>
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="41"
- x="0"
- y="28"
- />
- <text
- aria-describedby="tooltip-2"
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="40"
- y="33"
- >
- 75.0
- </text>
- <text
- class="emotion-2 emotion-3"
- dx="-1em"
- dy="0.3em"
- text-anchor="end"
- x="0"
- y="33"
- >
- b
- </text>
- </g>
- <g>
- <rect
- class="emotion-0 emotion-1"
- height="10"
- width="81"
- x="0"
- y="46"
- />
- <text
- aria-describedby="tooltip-3"
- class="emotion-2 emotion-3"
- dx="1em"
- dy="0.3em"
- text-anchor="start"
- x="80"
- y="51"
- >
- 150.0
- </text>
- <text
- class="emotion-2 emotion-3"
- dx="-1em"
- dy="0.3em"
- text-anchor="end"
- x="0"
- y="51"
- >
- c
- </text>
- </g>
- </g>
- </g>
- </svg>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/HotspotRating-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/HotspotRating-test.tsx.snap
deleted file mode 100644
index 741beaababd..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/HotspotRating-test.tsx.snap
+++ /dev/null
@@ -1,118 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render HotspotRating with HIGH rating 1`] = `
-<svg
- aria-hidden="false"
- aria-label="label"
- fill="none"
- height="16"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="16"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
->
- <circle
- cx="8"
- cy="8"
- fill="rgb(254,205,202)"
- r="7"
- />
- <path
- d="M5 6.67113C5 6.56986 5.05583 6.47727 5.14421 6.43198L7.88334 5.02823C7.95678 4.99059 8.04322 4.99059 8.11666 5.02823L10.8558 6.43198C10.9442 6.47727 11 6.56986 11 6.67113V10.7324C11 10.9191 10.8181 11.0483 10.6475 10.9827L8.0916 10.0003C8.03254 9.97763 7.96746 9.97763 7.9084 10.0003L5.35247 10.9827C5.18192 11.0483 5 10.9191 5 10.7324V6.67113Z"
- fill="rgb(93,29,19)"
- />
-</svg>
-`;
-
-exports[`should render HotspotRating with LOW rating 1`] = `
-<svg
- aria-hidden="false"
- aria-label="label"
- fill="none"
- height="16"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="16"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
->
- <circle
- cx="8"
- cy="8"
- fill="rgb(252,233,163)"
- r="7"
- />
- <path
- d="M5.23223 6.93223L8 9.7L10.7678 6.93223"
- stroke="rgb(102,64,15)"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.5"
- />
-</svg>
-`;
-
-exports[`should render HotspotRating with MEDIUM rating 1`] = `
-<svg
- aria-hidden="false"
- aria-label="label"
- fill="none"
- height="16"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="16"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
->
- <circle
- cx="8"
- cy="8"
- fill="rgb(255,214,175)"
- r="7"
- />
- <path
- d="M10.7678 9.5 8 6.73223 5.23223 9.5"
- stroke="rgb(122,46,14)"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.5"
- />
-</svg>
-`;
-
-exports[`should render HotspotRating with default LOW rating 1`] = `
-<svg
- aria-hidden="false"
- aria-label="label"
- fill="none"
- height="16"
- role="img"
- style="clip-rule: evenodd; display: inline-block; fill-rule: evenodd; user-select: none; vertical-align: middle; stroke-linejoin: round; stroke-miterlimit: 1.414;"
- version="1.1"
- viewBox="0 0 16 16"
- width="16"
- xml:space="preserve"
- xmlns:xlink="http://www.w3.org/1999/xlink"
->
- <circle
- cx="8"
- cy="8"
- fill="rgb(252,233,163)"
- r="7"
- />
- <path
- d="M5.23223 6.93223L8 9.7L10.7678 6.93223"
- stroke="rgb(102,64,15)"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.5"
- />
-</svg>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/IssueMessageHighlighting-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/IssueMessageHighlighting-test.tsx.snap
deleted file mode 100644
index 932cc06d0f8..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/IssueMessageHighlighting-test.tsx.snap
+++ /dev/null
@@ -1,148 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should format the string with highlights 1`] = `<DocumentFragment />`;
-
-exports[`should format the string with highlights 2`] = `
-<DocumentFragment>
- message
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 3`] = `
-<DocumentFragment>
- message
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 4`] = `
-<DocumentFragment>
- <span>
- message
- </span>
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 5`] = `
-<DocumentFragment>
- .emotion-0 {
- background: rgb(252,252,253);
- border-color: rgb(225,230,243);
- color: rgb(62,67,87);
- padding-top: 0.125rem;
- padding-bottom: 0.125rem;
-}
-
-a .emotion-0 {
- padding-bottom: 0;
-}
-
-<span>
- m
- <span
- class="sw-code sw-rounded-1 sw-px-1 sw-border sw-border-solid emotion-0 emotion-1"
- >
- ess
- </span>
- a
- <span
- class="sw-code sw-rounded-1 sw-px-1 sw-border sw-border-solid emotion-0 emotion-1"
- >
- g
- </span>
- e
- </span>
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 6`] = `
-<DocumentFragment>
- <span>
- a somewhat longer message with overlapping ranges
- </span>
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 7`] = `
-<DocumentFragment>
- .emotion-0 {
- background: rgb(252,252,253);
- border-color: rgb(225,230,243);
- color: rgb(62,67,87);
- padding-top: 0.125rem;
- padding-bottom: 0.125rem;
-}
-
-a .emotion-0 {
- padding-bottom: 0;
-}
-
-<span>
- a somewhat longer message with overlapping range
- <span
- class="sw-code sw-rounded-1 sw-px-1 sw-border sw-border-solid emotion-0 emotion-1"
- >
- s
- </span>
- </span>
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 8`] = `
-<DocumentFragment>
- <span>
- a somewhat longer message with overlapping ranges
- </span>
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 9`] = `
-<DocumentFragment>
- .emotion-0 {
- background: rgb(252,252,253);
- border-color: rgb(225,230,243);
- color: rgb(62,67,87);
- padding-top: 0.125rem;
- padding-bottom: 0.125rem;
-}
-
-a .emotion-0 {
- padding-bottom: 0;
-}
-
-<span>
- a
- <span
- class="sw-code sw-rounded-1 sw-px-1 sw-border sw-border-solid emotion-0 emotion-1"
- >
- somewhat longer message
- </span>
- with overlapping ranges
- </span>
-</DocumentFragment>
-`;
-
-exports[`should format the string with highlights 10`] = `
-<DocumentFragment>
- .emotion-0 {
- background: rgb(252,252,253);
- border-color: rgb(225,230,243);
- color: rgb(62,67,87);
- padding-top: 0.125rem;
- padding-bottom: 0.125rem;
-}
-
-a .emotion-0 {
- padding-bottom: 0;
-}
-
-<span>
- a
- <span
- class="sw-code sw-rounded-1 sw-px-1 sw-border sw-border-solid emotion-0 emotion-1"
- >
- somewhat longer message with
- </span>
- overlapping ranges
- </span>
-</DocumentFragment>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHint-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHint-test.tsx.snap
deleted file mode 100644
index bc08e8388ec..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHint-test.tsx.snap
+++ /dev/null
@@ -1,291 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders on mac 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- color: var(--echoes-color-text-subdued);
-}
-
-.emotion-2 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="emotion-0 emotion-1"
- >
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-2 emotion-3"
- >
- ⌘
- </span>
- <span
- class=" emotion-2 emotion-3"
- >
- ⌥
- </span>
- </div>
- </div>
-</div>
-`;
-
-exports[`renders on windows 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- color: var(--echoes-color-text-subdued);
-}
-
-.emotion-2 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="emotion-0 emotion-1"
- >
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-2 emotion-3"
- >
- Ctrl
- </span>
- <span
- class=" emotion-2 emotion-3"
- >
- Alt
- </span>
- </div>
- </div>
-</div>
-`;
-
-exports[`renders with command 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- color: var(--echoes-color-text-subdued);
-}
-
-.emotion-2 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="emotion-0 emotion-1"
- >
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class="sw-px-1 emotion-2 emotion-3"
- >
- command
- </span>
- </div>
- </div>
-</div>
-`;
-
-exports[`renders with title 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- color: var(--echoes-color-text-subdued);
-}
-
-.emotion-2 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="emotion-0 emotion-1"
- >
- <span
- class="sw-truncate"
- >
- title
- </span>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-2 emotion-3"
- >
- click
- </span>
- </div>
- </div>
-</div>
-`;
-
-exports[`renders without title 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- color: var(--echoes-color-text-subdued);
-}
-
-.emotion-2 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="emotion-0 emotion-1"
- >
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-2 emotion-3"
- >
- click
- </span>
- </div>
- </div>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHintKeys-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHintKeys-test.tsx.snap
deleted file mode 100644
index 5817a21adb1..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/KeyboardHintKeys-test.tsx.snap
+++ /dev/null
@@ -1,552 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render Alt 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- Alt
- </span>
- </div>
-</div>
-`;
-
-exports[`should render ArrowDown 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-down"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"
- />
- </svg>
- </span>
- </div>
-</div>
-`;
-
-exports[`should render ArrowLeft 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-left"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="M9.573 4.427 6.177 7.823a.25.25 0 0 0 0 .354l3.396 3.396a.25.25 0 0 0 .427-.177V4.604a.25.25 0 0 0-.427-.177Z"
- />
- </svg>
- </span>
- </div>
-</div>
-`;
-
-exports[`should render ArrowRight 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-right"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"
- />
- </svg>
- </span>
- </div>
-</div>
-`;
-
-exports[`should render ArrowUp 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-up"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m4.427 9.573 3.396-3.396a.25.25 0 0 1 .354 0l3.396 3.396a.25.25 0 0 1-.177.427H4.604a.25.25 0 0 1-.177-.427Z"
- />
- </svg>
- </span>
- </div>
-</div>
-`;
-
-exports[`should render Click 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- click
- </span>
- </div>
-</div>
-`;
-
-exports[`should render Command 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- ⌘
- </span>
- </div>
-</div>
-`;
-
-exports[`should render Control 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- Ctrl
- </span>
- </div>
-</div>
-`;
-
-exports[`should render Option 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- ⌥
- </span>
- </div>
-</div>
-`;
-
-exports[`should render a default text if no keys match 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- Ctrl
- </span>
- <span>
- +
- </span>
- <span
- class=" emotion-0 emotion-1"
- >
- click
- </span>
- </div>
-</div>
-`;
-
-exports[`should render multiple keys 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class="sw-px-1 emotion-0 emotion-1"
- >
- Use
- </span>
- <span
- class=" emotion-0 emotion-1"
- >
- Ctrl
- </span>
- <span>
- +
- </span>
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-up"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m4.427 9.573 3.396-3.396a.25.25 0 0 1 .354 0l3.396 3.396a.25.25 0 0 1-.177.427H4.604a.25.25 0 0 1-.177-.427Z"
- />
- </svg>
- </span>
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-down"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"
- />
- </svg>
- </span>
- </div>
-</div>
-`;
-
-exports[`should render multiple keys with non-key symbols 1`] = `
-.emotion-0 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- padding-left: 0.125rem;
- padding-right: 0.125rem;
- border-radius: 0.125rem;
- background-color: rgb(225,230,243);
- color: rgb(62,67,87);
-}
-
-<div>
- <div
- class="sw-flex sw-gap-1"
- >
- <span
- class=" emotion-0 emotion-1"
- >
- Ctrl
- </span>
- <span>
- +
- </span>
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-down"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"
- />
- </svg>
- </span>
- <span
- class=" emotion-0 emotion-1"
- >
- <svg
- aria-hidden="true"
- class="octicon octicon-triangle-up"
- fill="currentColor"
- focusable="false"
- height="16"
- style="display: inline-block; user-select: none; vertical-align: middle; overflow: visible;"
- viewBox="0 0 16 16"
- width="16"
- >
- <path
- d="m4.427 9.573 3.396-3.396a.25.25 0 0 1 .354 0l3.396 3.396a.25.25 0 0 1-.177.427H4.604a.25.25 0 0 1-.177-.427Z"
- />
- </svg>
- </span>
- </div>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineCoverage-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineCoverage-test.tsx.snap
deleted file mode 100644
index 3be6058daf7..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineCoverage-test.tsx.snap
+++ /dev/null
@@ -1,237 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly when covered 1`] = `
-.emotion-0 {
- color: var(--echoes-color-text-subdued);
- background-color: var(--line-background);
- outline: none;
- height: 100%;
- width: 100%;
- box-sizing: border-box;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.e97pm2l13:hover .emotion-0 {
- background-color: rgb(239,242,249);
-}
-
-.emotion-2 {
- height: 100%;
- width: 0.25rem;
- margin-left: 0.125rem;
- background-color: rgb(166,244,197);
-}
-
-.emotion-2,
-.emotion-2 svg {
- outline: none;
-}
-
-<tr>
- <td
- aria-describedby="tooltip-1"
- class="emotion-0 emotion-1"
- data-line-number="16"
- >
- <div
- aria-label="OK"
- class="emotion-2 emotion-3"
- />
- </td>
-</tr>
-`;
-
-exports[`should render correctly when no data 1`] = `
-.emotion-0 {
- color: var(--echoes-color-text-subdued);
- background-color: var(--line-background);
- outline: none;
- height: 100%;
- width: 100%;
- box-sizing: border-box;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.e97pm2l13:hover .emotion-0 {
- background-color: rgb(239,242,249);
-}
-
-<tr>
- <td
- class="emotion-0 emotion-1"
- data-line-number="16"
- />
-</tr>
-`;
-
-exports[`should render correctly when partially covered with 5/10 conditions 1`] = `
-.emotion-0 {
- color: var(--echoes-color-text-subdued);
- background-color: var(--line-background);
- outline: none;
- height: 100%;
- width: 100%;
- box-sizing: border-box;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.e97pm2l13:hover .emotion-0 {
- background-color: rgb(239,242,249);
-}
-
-.emotion-2 {
- height: 100%;
- width: 0.25rem;
- margin-left: 0.125rem;
-}
-
-.emotion-2,
-.emotion-2 svg {
- outline: none;
-}
-
-<tr>
- <td
- aria-describedby="tooltip-4"
- class="emotion-0 emotion-1"
- data-line-number="16"
- >
- <div
- aria-label="OK"
- class="emotion-2 emotion-3"
- >
- <svg
- fill="none"
- viewBox="0 0 4 18"
- xmlns="http://www.w3.org/2000/svg"
- >
- <rect
- fill="rgb(217,45,32)"
- height="18"
- width="4"
- />
- <path
- clip-rule="evenodd"
- d="M0 0L4 3V6L0 3V0ZM0 6L4 9V12L0 9V6ZM4 15L0 12V15L4 18V15Z"
- fill="rgb(255,255,255)"
- fill-rule="evenodd"
- />
- </svg>
- </div>
- </td>
-</tr>
-`;
-
-exports[`should render correctly when partially covered without conditions 1`] = `
-.emotion-0 {
- color: var(--echoes-color-text-subdued);
- background-color: var(--line-background);
- outline: none;
- height: 100%;
- width: 100%;
- box-sizing: border-box;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.e97pm2l13:hover .emotion-0 {
- background-color: rgb(239,242,249);
-}
-
-.emotion-2 {
- height: 100%;
- width: 0.25rem;
- margin-left: 0.125rem;
-}
-
-.emotion-2,
-.emotion-2 svg {
- outline: none;
-}
-
-<tr>
- <td
- aria-describedby="tooltip-3"
- class="emotion-0 emotion-1"
- data-line-number="16"
- >
- <div
- aria-label="OK"
- class="emotion-2 emotion-3"
- >
- <svg
- fill="none"
- viewBox="0 0 4 18"
- xmlns="http://www.w3.org/2000/svg"
- >
- <rect
- fill="rgb(217,45,32)"
- height="18"
- width="4"
- />
- <path
- clip-rule="evenodd"
- d="M0 0L4 3V6L0 3V0ZM0 6L4 9V12L0 9V6ZM4 15L0 12V15L4 18V15Z"
- fill="rgb(255,255,255)"
- fill-rule="evenodd"
- />
- </svg>
- </div>
- </td>
-</tr>
-`;
-
-exports[`should render correctly when uncovered 1`] = `
-.emotion-0 {
- color: var(--echoes-color-text-subdued);
- background-color: var(--line-background);
- outline: none;
- height: 100%;
- width: 100%;
- box-sizing: border-box;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.e97pm2l13:hover .emotion-0 {
- background-color: rgb(239,242,249);
-}
-
-.emotion-2 {
- height: 100%;
- width: 0.25rem;
- margin-left: 0.125rem;
- background-color: rgb(217,45,32);
-}
-
-.emotion-2,
-.emotion-2 svg {
- outline: none;
-}
-
-<tr>
- <td
- aria-describedby="tooltip-2"
- class="emotion-0 emotion-1"
- data-line-number="16"
- >
- <div
- aria-label="OK"
- class="emotion-2 emotion-3"
- />
- </td>
-</tr>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap
deleted file mode 100644
index 7e61c609169..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap
+++ /dev/null
@@ -1,64 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly as button 1`] = `
-.emotion-0 {
- all: unset;
- cursor: pointer;
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- gap: 0.5rem;
- margin-left: 0.25rem;
- margin-right: 0.25rem;
- margin-top: 0.75rem;
- margin-bottom: 0.75rem;
- border-radius: 0.25rem;
- padding-left: 0.75rem;
- padding-right: 0.75rem;
- width: 100%;
- box-sizing: border-box;
- padding-top: 0.75rem;
- padding-bottom: 0.75rem;
- font: var(--echoes-typography-text-large-semi-bold);
- cursor: default;
- border: 1px solid rgb(253,162,155);
- color: rgb(62,67,87);
- word-break: break-word;
- background-color: rgb(255,255,255);
-}
-
-.emotion-0:focus-visible {
- background-color: rgb(239,242,249);
-}
-
-.emotion-0:hover {
- box-shadow: 0px 1px 3px 0px rgba(29,33,47,0.05),0px 1px 25px 0px rgba(29,33,47,0.05);
-}
-
-.emotion-2 {
- all: unset;
- cursor: pointer;
-}
-
-.emotion-2:focus-visible {
- background-color: rgb(239,242,249);
-}
-
-<div>
- <div
- class="emotion-0 emotion-1"
- data-issue="key"
- >
- <button
- class="emotion-2 emotion-3"
- >
- message
- </button>
- </div>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineWrapper-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineWrapper-test.tsx.snap
deleted file mode 100644
index bb8bcca7efc..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineWrapper-test.tsx.snap
+++ /dev/null
@@ -1,21 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render with correct styling 1`] = `
-.emotion-0 {
- display: grid;
- grid-template-rows: auto;
- grid-template-columns: var(--columns);
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- font: var(--echoes-typography-code-default);
-}
-
-<tbody>
- <tr
- class="emotion-0 emotion-1"
- style="--columns: 44px 50px 26px repeat(3, 6px) 1fr; --line-background: rgb(255,255,255);"
- />
-</tbody>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/TreeMap-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/TreeMap-test.tsx.snap
deleted file mode 100644
index f9b2a493f78..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/TreeMap-test.tsx.snap
+++ /dev/null
@@ -1,194 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly and forward click event 1`] = `
-.emotion-0 {
- position: relative;
-}
-
-.emotion-2 {
- position: absolute;
- box-sizing: border-box;
- border-right: 1px solid #fff;
- border-bottom: 1px solid #fff;
-}
-
-.emotion-4 {
- height: 100%;
- width: 100%;
- border-width: 0px;
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-flex-direction: column;
- -ms-flex-direction: column;
- flex-direction: column;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- color: rgb(62,67,87);
-}
-
-.emotion-4:hover,
-.emotion-4:active,
-.emotion-4:focus {
- border-width: 0px;
- outline: none;
-}
-
-.emotion-4:focus .treemap-text,
-.emotion-4:hover .treemap-text {
- text-decoration-line: underline;
-}
-
-.emotion-6 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- line-height: 1.2;
- max-width: 83px;
-}
-
-.emotion-6 .treemap-text {
- -webkit-flex-shrink: 1;
- -ms-flex-negative: 1;
- flex-shrink: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- text-align: left;
-}
-
-.emotion-8 {
- position: absolute!important;
- left: -10000px!important;
- top: auto!important;
- width: 1px!important;
- height: 1px!important;
- overflow: hidden!important;
-}
-
-.emotion-22 {
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- -webkit-align-items: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- gap: 0.5rem;
- line-height: 1.2;
- max-width: 17px;
-}
-
-.emotion-22 .treemap-text {
- -webkit-flex-shrink: 1;
- -ms-flex-negative: 1;
- flex-shrink: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- text-align: left;
-}
-
-<div>
- <ul
- class="emotion-0 emotion-1"
- style="width: 100px; height: 100px;"
- >
- <li
- class="emotion-2 emotion-3"
- style="left: 0px; top: 0px; width: 83px; height: 60px; background-color: rgb(119, 119, 119); font-size: 12.974358974358974px; line-height: 60px;"
- >
- <a
- class="emotion-4 emotion-5"
- href="#"
- >
- <div
- class="emotion-6 emotion-7"
- width="83"
- >
- <span
- class="shrink-0"
- />
- <span
- class="treemap-text"
- >
- SonarQube_Web
- </span>
- <span
- class="emotion-8 emotion-9"
- />
- </div>
- </a>
- </li>
- <li
- class="emotion-2 emotion-3"
- style="left: 0px; top: 60px; width: 83px; height: 40px; font-size: 12.276041666666668px; line-height: 40px;"
- >
- <a
- class="emotion-4 emotion-5"
- href="#"
- >
- <div
- class="emotion-6 emotion-7"
- width="83"
- >
- <span
- class="shrink-0"
- />
- <span
- class="emotion-8 emotion-9"
- />
- </div>
- </a>
- </li>
- <li
- class="emotion-2 emotion-3"
- style="left: 83px; top: 0px; width: 17px; height: 100px; background-color: rgb(119, 119, 119); font-size: 11px; line-height: 100px;"
- >
- <a
- class="emotion-4 emotion-5"
- href="#"
- >
- <div
- class="emotion-22 emotion-7"
- width="17"
- >
- <span
- class="emotion-8 emotion-9"
- />
- </div>
- </a>
- </li>
- </ul>
-</div>
-`;
diff --git a/server/sonar-web/design-system/src/components/__tests__/clipboard-test.tsx b/server/sonar-web/design-system/src/components/__tests__/clipboard-test.tsx
deleted file mode 100644
index e073810552e..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/clipboard-test.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { screen, waitForElementToBeRemoved } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import { renderWithContext } from '../../helpers/testUtils';
-import { ClipboardButton, ClipboardIconButton } from '../clipboard';
-
-beforeEach(() => {
- jest.useFakeTimers();
-});
-
-afterEach(() => {
- jest.runOnlyPendingTimers();
- jest.useRealTimers();
-});
-
-describe('ClipboardButton', () => {
- it('should display and function correctly', async () => {
- /* Delay: null is necessary to play well with fake timers
- * https://github.com/testing-library/user-event/issues/833
- */
- const user = userEvent.setup({ delay: null });
- renderClipboardButton();
-
- expect(screen.getByRole('button', { name: 'Copy' })).toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { name: 'Copy' }));
-
- expect(await screen.findByRole('tooltip', { name: 'Copied' })).toBeInTheDocument();
-
- await waitForElementToBeRemoved(() => screen.queryByRole('tooltip', { name: 'Copied' }));
- jest.runAllTimers();
- });
-
- it('should render a custom label if provided', () => {
- renderClipboardButton('Foo Bar');
- expect(screen.getByRole('button', { name: 'Foo Bar' })).toBeInTheDocument();
- });
-
- function renderClipboardButton(children?: React.ReactNode) {
- renderWithContext(<ClipboardButton copyValue="foo">{children}</ClipboardButton>);
- }
-});
-
-describe('ClipboardIconButton', () => {
- it('should display and function correctly', async () => {
- /* Delay: null is necessary to play well with fake timers
- * https://github.com/testing-library/user-event/issues/833
- */
- const user = userEvent.setup({ delay: null });
- renderWithContext(<ClipboardIconButton copyValue="foo" />);
-
- const copyButton = screen.getByRole('button', { name: 'Copy to clipboard' });
- expect(copyButton).toBeInTheDocument();
-
- expect(screen.getByRole('button', { name: 'Copy to clipboard' })).toBeInTheDocument();
-
- await user.click(screen.getByRole('button', { name: 'Copy to clipboard' }));
-
- expect(await screen.findByRole('tooltip', { name: 'Copied' })).toBeInTheDocument();
-
- await waitForElementToBeRemoved(() => screen.queryByRole('tooltip', { name: 'Copied' }));
- jest.runAllTimers();
- });
-});
diff --git a/server/sonar-web/design-system/src/components/__tests__/layouts-test.tsx b/server/sonar-web/design-system/src/components/__tests__/layouts-test.tsx
deleted file mode 100644
index ba3fc86984a..00000000000
--- a/server/sonar-web/design-system/src/components/__tests__/layouts-test.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2024 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import { render, screen } from '@testing-library/react';
-import { CenteredLayout, LargeCenteredLayout } from '../layouts';
-
-describe('CenteredLayout', () => {
- it('should render as expected', () => {
- render(<CenteredLayout>content</CenteredLayout>);
-
- expect(screen.getByText('content')).toHaveStyle({
- 'min-width': '1280px',
- 'max-width': '1280px',
- });
- });
-});
-
-describe('LargeCenteredLayout', () => {
- it('should render as expected', () => {
- render(<LargeCenteredLayout>content</LargeCenteredLayout>);
-
- expect(screen.getByText('content')).toHaveStyle({
- 'min-width': '1280px',
- 'max-width': '1680px',
- });
- });
-});