diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2023-10-02 17:40:14 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-10-06 20:02:52 +0000 |
commit | cc0541b2f45d6b534decc56ac71d998ed71e5e1b (patch) | |
tree | ceb4af7c84d67b59bb8e261dc8fe75996079593c | |
parent | c18b48ce701d7b9f646681a3c1cc707e34abce2d (diff) | |
download | sonarqube-cc0541b2f45d6b534decc56ac71d998ed71e5e1b.tar.gz sonarqube-cc0541b2f45d6b534decc56ac71d998ed71e5e1b.zip |
SONAR-20323 Remove last enzyme tests
173 files changed, 201 insertions, 18689 deletions
diff --git a/server/sonar-web/config/jest/SetupEnzyme.ts b/server/sonar-web/config/jest/SetupEnzyme.ts deleted file mode 100644 index 68f920f86cb..00000000000 --- a/server/sonar-web/config/jest/SetupEnzyme.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 Adapter from '@wojtekmaj/enzyme-adapter-react-17'; -import Enzyme from 'enzyme'; - -Enzyme.configure({ adapter: new Adapter() }); diff --git a/server/sonar-web/jest.config.js b/server/sonar-web/jest.config.js index 92fa4a39329..4aa418c407d 100644 --- a/server/sonar-web/jest.config.js +++ b/server/sonar-web/jest.config.js @@ -15,7 +15,6 @@ module.exports = { }, setupFiles: [ '<rootDir>/config/polyfills.ts', - '<rootDir>/config/jest/SetupEnzyme.ts', '<rootDir>/config/jest/SetupTestEnvironment.ts', '<rootDir>/config/jest/SetupTheme.js', ], @@ -23,7 +22,7 @@ module.exports = { '<rootDir>/config/jest/SetupReactTestingLibrary.ts', '<rootDir>/config/jest/SetupJestAxe.ts', ], - snapshotSerializers: ['enzyme-to-json/serializer', '@emotion/jest/serializer'], + snapshotSerializers: ['@emotion/jest/serializer'], testEnvironment: 'jsdom', testPathIgnorePatterns: [ '<rootDir>/config', diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 342f7a37d21..f11e453f7c7 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -62,7 +62,6 @@ "@types/d3-shape": "3.1.2", "@types/diff": "5.0.3", "@types/dompurify": "3.0.2", - "@types/enzyme": "3.10.13", "@types/jest": "29.5.4", "@types/jest-axe": "3.5.5", "@types/lodash": "4.14.197", @@ -76,13 +75,10 @@ "@types/valid-url": "1.0.4", "@typescript-eslint/eslint-plugin": "5.59.11", "@typescript-eslint/parser": "5.59.11", - "@wojtekmaj/enzyme-adapter-react-17": "0.8.0", "autoprefixer": "10.4.15", "chalk": "4.1.2", "chokidar": "3.5.3", "design-system": "1.0.0", - "enzyme": "3.11.0", - "enzyme-to-json": "3.6.2", "esbuild": "0.19.2", "eslint": "8.48.0", "eslint-config-sonarqube": "2.1.3", diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx deleted file mode 100644 index 684f2153e93..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../../../helpers/testUtils'; -import PendingPluginsActionNotif from '../PendingPluginsActionNotif'; - -jest.mock('../../../../../api/plugins', () => ({ - cancelPendingPlugins: jest.fn(() => Promise.resolve()), -})); - -const cancelPendingPlugins = require('../../../../../api/plugins') - .cancelPendingPlugins as jest.Mock<any>; - -beforeEach(() => { - cancelPendingPlugins.mockClear(); -}); - -it('should display pending actions', () => { - expect(getWrapper()).toMatchSnapshot(); -}); - -it('should not display anything', () => { - expect(getWrapper({ pending: { installing: [], updating: [], removing: [] } }).type()).toBeNull(); -}); - -it('should cancel all pending and refresh them', async () => { - const refreshPending = jest.fn(); - const wrapper = getWrapper({ refreshPending }); - click(wrapper.find('.js-cancel-all')); - expect(cancelPendingPlugins).toHaveBeenCalled(); - await new Promise(setImmediate); - - expect(refreshPending).toHaveBeenCalled(); -}); - -function getWrapper(props = {}) { - return shallow( - <PendingPluginsActionNotif - fetchSystemStatus={jest.fn()} - pending={{ - installing: [ - { - key: 'foo', - name: 'Foo', - description: 'foo description', - version: 'fooversion', - implementationBuild: 'foobuild', - }, - { - key: 'bar', - name: 'Bar', - description: 'bar description', - version: 'barversion', - implementationBuild: 'barbuild', - }, - ], - updating: [], - removing: [ - { - key: 'baz', - name: 'Baz', - description: 'baz description', - version: 'bazversion', - implementationBuild: 'bazbuild', - }, - ], - }} - refreshPending={() => {}} - systemStatus="UP" - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx deleted file mode 100644 index fe1cf677498..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockLocation } from '../../../../../helpers/testMocks'; -import { AdminPageExtension } from '../../../../../types/extension'; -import { SettingsNav } from '../SettingsNav'; - -it('should work with extensions', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('Dropdown')).toMatchSnapshot(); -}); - -it('should display a pending plugin notif', () => { - const wrapper = shallowRender({ - pendingPlugins: { - installing: [ - { - key: 'foo', - name: 'Foo', - version: '1.0', - implementationBuild: '1', - }, - ], - removing: [], - updating: [], - }, - }); - expect(wrapper.find('ContextNavBar').prop('notif')).toMatchSnapshot(); -}); - -it('should display restart notif', () => { - const wrapper = shallowRender({ systemStatus: 'RESTARTING' }); - expect(wrapper.find('ContextNavBar').prop('notif')).toMatchSnapshot(); -}); - -it('should render correctly when governance is active', () => { - expect( - shallowRender({ - extensions: [{ key: AdminPageExtension.GovernanceConsole, name: 'governance' }], - }), - ).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<SettingsNav['props']> = {}) { - return shallow( - <SettingsNav - extensions={[{ key: 'foo', name: 'Foo' }]} - fetchPendingPlugins={jest.fn()} - fetchSystemStatus={jest.fn()} - location={mockLocation()} - pendingPlugins={{ installing: [], removing: [], updating: [] }} - systemStatus="UP" - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx deleted file mode 100644 index 548208ed18d..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SystemRestartNotif-test.tsx +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import SystemRestartNotif from '../SystemRestartNotif'; - -it('should render correctly', () => { - expect(shallow(<SystemRestartNotif />)).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap deleted file mode 100644 index 5c98124e87b..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/PendingPluginsActionNotif-test.tsx.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display pending actions 1`] = ` -<Alert - className="js-pending" - display="banner" - variant="info" -> - <div - className="display-flex-center" - > - <span - className="little-spacer-right" - > - <InstanceMessage - message="marketplace.instance_needs_to_be_restarted_to" - /> - </span> - <span - key="marketplace.install_x_plugins" - > - <FormattedMessage - defaultMessage="marketplace.install_x_plugins" - id="marketplace.install_x_plugins" - values={ - { - "nb": <strong> - 2 - </strong>, - } - } - /> - </span> - <span - key="marketplace.uninstall_x_plugins" - > - ; - <FormattedMessage - defaultMessage="marketplace.uninstall_x_plugins" - id="marketplace.uninstall_x_plugins" - values={ - { - "nb": <strong> - 1 - </strong>, - } - } - /> - </span> - <RestartButton - className="spacer-left" - fetchSystemStatus={[MockFunction]} - systemStatus="UP" - /> - <Button - className="spacer-left js-cancel-all" - onClick={[Function]} - > - marketplace.revert - </Button> - </div> -</Alert> -`; diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap deleted file mode 100644 index 9f662b53101..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap +++ /dev/null @@ -1,442 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display a pending plugin notif 1`] = ` -<PendingPluginsActionNotif - fetchSystemStatus={[MockFunction]} - pending={ - { - "installing": [ - { - "implementationBuild": "1", - "key": "foo", - "name": "Foo", - "version": "1.0", - }, - ], - "removing": [], - "updating": [], - } - } - refreshPending={[MockFunction]} - systemStatus="UP" -/> -`; - -exports[`should display restart notif 1`] = `<SystemRestartNotif />`; - -exports[`should render correctly when governance is active 1`] = ` -<ContextNavBar - height={72} - id="context-navigation" - label="settings" -> - <div - className="navbar-context-header" - > - <h1> - layout.settings - </h1> - </div> - <NavBarTabs> - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/settings" - > - settings.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/settings/encryption" - > - property.category.security.encryption - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/webhooks" - > - webhooks.page - </NavLink> - </li> - <li> - <NavLink - to="/admin/extension/governance/views_console" - > - governance - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown> - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/users" - > - users.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/groups" - > - user_groups.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/permissions" - > - global_permissions.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/permission_templates" - > - permission_templates - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown> - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/projects_management" - > - management - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/background_tasks" - > - background_tasks.page - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown> - <li> - <NavLink - end={true} - to="/admin/system" - > - sidebar.system - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/marketplace" - > - marketplace.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/audit" - > - audit_logs.page - </NavLink> - </li> - </NavBarTabs> -</ContextNavBar> -`; - -exports[`should work with extensions 1`] = ` -<ContextNavBar - height={72} - id="context-navigation" - label="settings" -> - <div - className="navbar-context-header" - > - <h1> - layout.settings - </h1> - </div> - <NavBarTabs> - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/settings" - > - settings.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/settings/encryption" - > - property.category.security.encryption - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/webhooks" - > - webhooks.page - </NavLink> - </li> - <li> - <NavLink - to="/admin/extension/foo" - > - Foo - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown> - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/users" - > - users.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/groups" - > - user_groups.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/permissions" - > - global_permissions.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/permission_templates" - > - permission_templates - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown> - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/projects_management" - > - management - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/background_tasks" - > - background_tasks.page - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown> - <li> - <NavLink - end={true} - to="/admin/system" - > - sidebar.system - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/marketplace" - > - marketplace.page - </NavLink> - </li> - </NavBarTabs> -</ContextNavBar> -`; - -exports[`should work with extensions 2`] = ` -[ - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/settings" - > - settings.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/settings/encryption" - > - property.category.security.encryption - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/webhooks" - > - webhooks.page - </NavLink> - </li> - <li> - <NavLink - to="/admin/extension/foo" - > - Foo - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown>, - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/users" - > - users.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/groups" - > - user_groups.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/permissions" - > - global_permissions.page - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/permission_templates" - > - permission_templates - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown>, - <Dropdown - overlay={ - <ul - className="menu dropdown-menu" - > - <li> - <NavLink - end={true} - to="/admin/projects_management" - > - management - </NavLink> - </li> - <li> - <NavLink - end={true} - to="/admin/background_tasks" - > - background_tasks.page - </NavLink> - </li> - </ul> - } - tagName="li" - > - <Component /> - </Dropdown>, -] -`; diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap deleted file mode 100644 index 0c0644356e9..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<Alert - display="banner" - variant="info" -> - <FormattedMessage - defaultMessage="system.instance_restarting" - id="system.instance_restarting" - values={ - { - "instance": undefined, - "link": <ForwardRef(Link) - to="/admin/background_tasks" - > - background_tasks.page - </ForwardRef(Link)>, - } - } - /> -</Alert> -`; diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx deleted file mode 100644 index 85c551b6783..00000000000 --- a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import React from 'react'; -import { dismissNotice } from '../../../../api/users'; -import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { NoticeType } from '../../../../types/users'; -import { CurrentUserContextInterface } from '../../current-user/CurrentUserContext'; -import { PromotionNotification } from '../PromotionNotification'; - -jest.mock('../../../../api/users', () => ({ - dismissNotice: jest.fn().mockResolvedValue({}), -})); - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('anonymous'); - expect( - shallowRender({ - currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: true } }), - }), - ).toMatchSnapshot('adAlreadySeen'); - expect(shallowRender({ currentUser: mockLoggedInUser() })).toMatchSnapshot('loggedIn'); -}); - -it('should remove the toaster when click on dismiss', async () => { - const updateDismissedNotices = jest.fn(); - const wrapper = shallowRender({ - currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: false } }), - updateDismissedNotices, - }); - wrapper.find('.toaster-actions ButtonLink').simulate('click'); - expect(dismissNotice).toHaveBeenCalled(); - await waitAndUpdate(wrapper); - expect(updateDismissedNotices).toHaveBeenCalled(); -}); - -it('should remove the toaster and navigate to sonarlint when click on learn more', async () => { - const updateDismissedNotices = jest.fn(); - const wrapper = shallowRender({ - currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: false } }), - updateDismissedNotices, - }); - wrapper.find('.toaster-actions .button-primary').simulate('click'); - expect(dismissNotice).toHaveBeenCalled(); - await waitAndUpdate(wrapper); - expect(updateDismissedNotices).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial<CurrentUserContextInterface> = {}) { - return shallow( - <PromotionNotification - currentUser={mockCurrentUser()} - updateDismissedNotices={jest.fn()} - updateCurrentUserHomepage={jest.fn()} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap deleted file mode 100644 index 0fda1c82608..00000000000 --- a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/__snapshots__/PromotionNotification-test.tsx.snap +++ /dev/null @@ -1,54 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: adAlreadySeen 1`] = `""`; - -exports[`should render correctly: anonymous 1`] = `""`; - -exports[`should render correctly: loggedIn 1`] = ` -<div - className="toaster display-flex-center big-padded-left big-padded-right" -> - <div - className="toaster-icon spacer-right" - > - <img - alt="SonarQube + SonarLint" - height={80} - src="/images/sq-sl.svg" - /> - </div> - <div - className="toaster-content flex-1 padded-left padded-right big-padded-top big-padded-bottom" - > - <span - className="toaster-title text-bold medium" - > - promotion.sonarlint.title - </span> - <p - className="spacer-top" - > - promotion.sonarlint.content - </p> - </div> - <div - className="toaster-actions spacer-left padded-left display-flex-column display-flex-center" - > - <a - className="button button-primary big-spacer-bottom" - href="https://www.sonarsource.com/products/sonarlint/?referrer=sonarqube-welcome" - onClick={[Function]} - rel="noreferrer" - target="_blank" - > - learn_more - </a> - <ButtonLink - className="toaster-link" - onClick={[Function]} - > - dismiss - </ButtonLink> - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx deleted file mode 100644 index a3b01520871..00000000000 --- a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx +++ /dev/null @@ -1,195 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { getSystemUpgrades } from '../../../../api/system'; -import { Alert } from '../../../../components/ui/Alert'; -import DismissableAlert from '../../../../components/ui/DismissableAlert'; -import { mockSystemUpgrade } from '../../../../helpers/mocks/system-upgrades'; -import { mockAppState, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { Permissions } from '../../../../types/permissions'; -import { UpdateNotification } from '../UpdateNotification'; - -jest.mock('../../../../api/system', () => { - const { mockSystemUpgrade } = jest.requireActual('../../../../helpers/mocks/system-upgrades'); - return { - getSystemUpgrades: jest - .fn() - .mockResolvedValue({ upgrades: [mockSystemUpgrade({ version: '9.1' })], latestLTS: '8.9' }), - }; -}); - -function formatDate(date: Date): string { - return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; -} - -it('should render correctly', async () => { - let wrapper = shallowRender({ - appState: mockAppState({ version: '9.0' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot('default'); - - wrapper = shallowRender({ - appState: mockAppState({ version: '9.0' }), - currentUser: mockCurrentUser(), - }); - expect(wrapper.type()).toBeNull(); -}); - -it('should not show prompt when not admin', async () => { - //As anonymous - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); - - // As non admin user - wrapper.setProps({ currentUser: mockLoggedInUser() }); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should not show prompt when no current version', async () => { - const wrapper = shallowRender({ appState: mockAppState({ version: 'NOVERSION' }) }); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should not show prompt when no upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ upgrades: [], latestLTS: '8.9' }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '9.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should show prompt when no lts date', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockSystemUpgrade({ version: '8.9', releaseDate: 'INVALID' })], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('previous_lts8.9'); - expect(wrapper.contains('admin_notification.update.previous_lts')).toBe(true); -}); - -it('should show prompt when minor upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1' })], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '9.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('new_minor_version9.2'); - expect(wrapper.contains('admin_notification.update.new_minor_version')).toBe(true); -}); - -it('should show prompt when patch upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1.1' })], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '9.1' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('new_patch9.2'); - expect(wrapper.contains('admin_notification.update.new_patch')).toBe(true); -}); - -it('should show prompt when lts upgrade', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [ - mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), - mockSystemUpgrade({ version: '9.2' }), - mockSystemUpgrade({ version: '9.1.1' }), - ], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.8' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('pre_lts8.9'); - expect(wrapper.contains('admin_notification.update.pre_lts')).toBe(true); -}); - -it('should show prompt when lts upgrade is more than 6 month', async () => { - const ltsDate = new Date(Date.now()); - ltsDate.setMonth(ltsDate.getMonth() - 7); - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [ - mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(ltsDate) }), - mockSystemUpgrade({ version: '9.2' }), - mockSystemUpgrade({ version: '9.1.1' }), - ], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.8' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).props().alertKey).toBe('previous_lts8.9'); - expect(wrapper.contains('admin_notification.update.previous_lts')).toBe(true); -}); - -it('should show correct alert when not dismissable', async () => { - (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [ - mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), - mockSystemUpgrade({ version: '9.2' }), - mockSystemUpgrade({ version: '9.1.1' }), - ], - latestLTS: '8.9', - }); - const wrapper = shallowRender({ - appState: mockAppState({ version: '8.8' }), - currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }), - }); - await waitAndUpdate(wrapper); - expect(wrapper.find(DismissableAlert).type).toBeDefined(); - wrapper.setProps({ dismissable: false }); - expect(wrapper.find(Alert).type).toBeDefined(); -}); - -function shallowRender(props: Partial<UpdateNotification['props']> = {}) { - return shallow( - <UpdateNotification - dismissable - appState={mockAppState()} - currentUser={mockCurrentUser()} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap deleted file mode 100644 index 64487bc4c38..00000000000 --- a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/__snapshots__/UpdateNotification-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` -<DismissableAlert - alertKey="new_minor_version9.1" - className="promote-update-notification it__upgrade-prompt-new_minor_version" - variant="info" -> - admin_notification.update.new_minor_version - <SystemUpgradeButton - latestLTS="8.9" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.7 description", - "downloadUrl": "downloadurl", - "releaseDate": "2017-03-01", - "version": "9.1", - }, - ] - } - updateUseCase="new_minor_version" - /> -</DismissableAlert> -`; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx deleted file mode 100644 index 7b627fbae35..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ListStyleFacet-test.tsx +++ /dev/null @@ -1,219 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { ListStyleFacet, Props } from '../ListStyleFacet'; - -it('should render', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should select items', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange }); - const instance = wrapper.instance() as ListStyleFacet<string>; - - // select one item - instance.handleItemClick('b', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); - wrapper.setProps({ values: ['b'] }); - - // select another item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['a'] }); - wrapper.setProps({ values: ['a'] }); - - // unselect item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: [] }); - wrapper.setProps({ values: [] }); - - // select multiple items - wrapper.setProps({ values: ['b'] }); - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b', 'c'] }); - wrapper.setProps({ values: ['b', 'c'] }); - - // unselect item - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); -}); - -it('should toggle', () => { - const onToggle = jest.fn(); - const wrapper = shallowRender({ onToggle }); - wrapper.find('FacetBox').prop<Function>('onClick')(); - expect(onToggle).toHaveBeenCalled(); -}); - -it('should clear', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange, values: ['a'] }); - wrapper.find('FacetBox').prop<Function>('onClear')(); - expect(onChange).toHaveBeenCalledWith({ foo: [] }); -}); - -it('should search', async () => { - const onSearch = jest.fn().mockResolvedValue({ - results: ['d', 'e'], - paging: { pageIndex: 1, pageSize: 2, total: 3 }, - }); - - const loadSearchResultCount = jest.fn().mockResolvedValue({ d: 7, e: 3 }); - const wrapper = shallowRender({ loadSearchResultCount, onSearch }); - - // search - wrapper.find('InputSearch').prop<Function>('onChange')('query'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query'); - expect(loadSearchResultCount).toHaveBeenLastCalledWith(['d', 'e']); - - // load more results - onSearch.mockResolvedValue({ - results: ['f'], - paging: { pageIndex: 2, pageSize: 2, total: 3 }, - }); - - loadSearchResultCount.mockResolvedValue({ f: 5 }); - wrapper.find('ListFooter').prop<Function>('loadMore')(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query', 2); - - // clear search - onSearch.mockClear(); - loadSearchResultCount.mockClear(); - wrapper.find('InputSearch').prop<Function>('onChange')(''); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).not.toHaveBeenCalled(); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search for no results - onSearch.mockResolvedValue({ results: [], paging: { pageIndex: 1, pageSize: 2, total: 0 } }); - wrapper.find('InputSearch').prop<Function>('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search fails - onSearch.mockRejectedValue(undefined); - wrapper.find('InputSearch').prop<Function>('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); // should render previous results - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); -}); - -it('should limit the number of items', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 5 }); - expect(wrapper.find('FacetItem').length).toBe(2); - - wrapper.find('ListStyleFacetFooter').prop<Function>('showMore')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(3); - - wrapper.find('ListStyleFacetFooter').prop<Function>('showLess')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(2); -}); - -it('should show warning that there might be more results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.find('ListStyleFacetFooter').prop<Function>('showMore')(); - wrapper.update(); - expect(wrapper.find('FlagMessage').exists()).toBe(true); -}); - -// eslint-disable-next-line jest/expect-expect -it('should reset state when closes', () => { - const wrapper = shallowRender(); - - wrapper.setState({ - query: 'foobar', - searchResults: ['foo', 'bar'], - searching: true, - showFullList: true, - }); - - wrapper.setProps({ open: false }); - checkInitialState(wrapper); -}); - -// eslint-disable-next-line jest/expect-expect -it('should reset search when query changes', () => { - const wrapper = shallowRender({ query: { a: ['foo'] } }); - wrapper.setState({ query: 'foo', searchResults: ['foo'], searchResultsCounts: { foo: 3 } }); - wrapper.setProps({ query: { a: ['foo'], b: ['bar'] } }); - checkInitialState(wrapper); -}); - -it('should collapse list when new stats have few results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.setState({ showFullList: true }); - - wrapper.setProps({ stats: { d: 1 } }); - expect(wrapper.state('showFullList')).toBe(false); -}); - -it('should display all selected items', () => { - const wrapper = shallowRender({ - maxInitialItems: 2, - stats: { a: 10, b: 5, c: 3 }, - values: ['a', 'b', 'c'], - }); - - expect(wrapper).toMatchSnapshot(); -}); - -it('should be disabled', () => { - const wrapper = shallowRender({ disabled: true }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<Props<string>> = {}) { - return shallow( - <ListStyleFacet - facetHeader="facet header" - fetching={false} - onChange={jest.fn()} - onSearch={jest.fn()} - onToggle={jest.fn()} - open - property="foo" - searchPlaceholder="search for foo..." - stats={{ a: 10, b: 8, c: 1 }} - values={[]} - {...props} - />, - ); -} - -function checkInitialState(wrapper: ShallowWrapper) { - expect(wrapper.state('query')).toBe(''); - expect(wrapper.state('searchResults')).toBeUndefined(); - expect(wrapper.state('searching')).toBe(false); - expect(wrapper.state('searchResultsCounts')).toEqual({}); - expect(wrapper.state('showFullList')).toBe(false); -} diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap deleted file mode 100644 index 4b2f846624e..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap +++ /dev/null @@ -1,480 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should be disabled 1`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - disabled={true} - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - open={false} - tooltipComponent={[Function]} -/> -`; - -exports[`should display all selected items 1`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={3} - countLabel="x_selected.3" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={true} - className="it__search-navigator-facet" - key="a" - name="a" - onClick={[Function]} - stat="10" - tooltip="a" - value="a" - /> - <FacetItem - active={true} - className="it__search-navigator-facet" - key="b" - name="b" - onClick={[Function]} - stat="5" - tooltip="b" - value="b" - /> - </FacetItemsList> - <div - className="note spacer-bottom text-center" - > - ⋯ - </div> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={true} - className="it__search-navigator-facet" - key="c" - name="c" - onClick={[Function]} - stat="3" - tooltip="c" - value="c" - /> - </FacetItemsList> - <ListStyleFacetFooter - nbShown={3} - showMore={[Function]} - total={3} - /> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={3} - /> - </span> -</FacetBox> -`; - -exports[`should render 1`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - className="it__search-navigator-facet" - key="a" - name="a" - onClick={[Function]} - stat="10" - tooltip="a" - value="a" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="b" - name="b" - onClick={[Function]} - stat="8" - tooltip="b" - value="b" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="c" - name="c" - onClick={[Function]} - stat="1" - tooltip="c" - value="c" - /> - </FacetItemsList> - <ListStyleFacetFooter - nbShown={3} - showMore={[Function]} - total={3} - /> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={0} - /> - </span> -</FacetBox> -`; - -exports[`should search 1`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="query" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - className="it__search-navigator-facet" - key="d" - name="d" - onClick={[Function]} - stat="7" - tooltip="d" - value="d" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="e" - name="e" - onClick={[Function]} - stat="3" - tooltip="e" - value="e" - /> - </FacetItemsList> - <ListFooter - className="sw-mb-2" - count={2} - loadMore={[Function]} - ready={true} - total={3} - useMIUIButtons={true} - /> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={0} - /> - </span> -</FacetBox> -`; - -exports[`should search 2`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="query" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - className="it__search-navigator-facet" - key="d" - name="d" - onClick={[Function]} - stat="7" - tooltip="d" - value="d" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="e" - name="e" - onClick={[Function]} - stat="3" - tooltip="e" - value="e" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="f" - name="f" - onClick={[Function]} - stat="5" - tooltip="f" - value="f" - /> - </FacetItemsList> - <ListFooter - className="sw-mb-2" - count={3} - loadMore={[Function]} - ready={true} - total={3} - useMIUIButtons={true} - /> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={0} - /> - </span> -</FacetBox> -`; - -exports[`should search 3`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - className="it__search-navigator-facet" - key="a" - name="a" - onClick={[Function]} - stat="10" - tooltip="a" - value="a" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="b" - name="b" - onClick={[Function]} - stat="8" - tooltip="b" - value="b" - /> - <FacetItem - active={false} - className="it__search-navigator-facet" - key="c" - name="c" - onClick={[Function]} - stat="1" - tooltip="c" - value="c" - /> - </FacetItemsList> - <ListStyleFacetFooter - nbShown={3} - showMore={[Function]} - total={3} - /> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={0} - /> - </span> -</FacetBox> -`; - -exports[`should search 4`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="blabla" - /> - <div - className="sw-mb-2" - > - no_results - </div> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={0} - /> - </span> -</FacetBox> -`; - -exports[`should search 5`] = ` -<FacetBox - className="it__search-navigator-facet-box it__search-navigator-facet-header" - clearIconLabel="clear" - count={0} - countLabel="x_selected.0" - data-property="foo" - id="facet_foo" - loading={false} - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - tooltipComponent={[Function]} -> - <span - className="it__search-navigator-facet-list" - > - <InputSearch - autoFocus={false} - className="it__search-box-input sw-mb-4 sw-w-full" - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - searchInputAriaLabel="search_verb" - size="auto" - value="blabla" - /> - <div - className="sw-mb-2" - > - no_results - </div> - <MultipleSelectionHint - nbSelectableItems={3} - nbSelectedItems={0} - /> - </span> -</FacetBox> -`; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx index cf51ccf8c44..ebef45448cb 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx @@ -298,7 +298,7 @@ it('should be able to compare profiles', async () => { await selectEvent.select(ui.compareDropdown.get(), 'java quality profile #2'); expect(ui.comparisonDiffTableHeading(1, 'java quality profile').get()).toBeInTheDocument(); expect(ui.comparisonDiffTableHeading(1, 'java quality profile #2').get()).toBeInTheDocument(); - expect(ui.comparisonModifiedTableHeading(1).query()).toBeInTheDocument(); + expect(ui.comparisonModifiedTableHeading(1).get()).toBeInTheDocument(); // java quality profile is not editable expect(ui.activeRuleButton('java quality profile').query()).not.toBeInTheDocument(); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx deleted file mode 100644 index 3497e9a8f30..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockBranch } from '../../../helpers/mocks/branch-like'; -import { mockSourceLine } from '../../../helpers/mocks/sources'; -import { mockIssue } from '../../../helpers/testMocks'; -import { MetricKey } from '../../../types/metrics'; -import Line from '../components/Line'; -import SourceViewerCode from '../SourceViewerCode'; - -it('should correctly flag a line for scrolling', () => { - const sources = [ - mockSourceLine({ line: 1, coverageStatus: 'covered', isNew: false }), - mockSourceLine({ line: 2, coverageStatus: 'partially-covered', isNew: false }), - mockSourceLine({ line: 3, coverageStatus: 'uncovered', isNew: true }), - ]; - let wrapper = shallowRender({ sources, metricKey: MetricKey.uncovered_lines }); - - expect(wrapper.find(Line).at(1).props().scrollToUncoveredLine).toBe(true); - expect(wrapper.find(Line).at(2).props().scrollToUncoveredLine).toBe(false); - - wrapper = shallowRender({ - sources, - metricKey: MetricKey.new_uncovered_lines, - }); - - expect(wrapper.find(Line).at(1).props().scrollToUncoveredLine).toBe(false); - expect(wrapper.find(Line).at(2).props().scrollToUncoveredLine).toBe(true); -}); - -function shallowRender(props: Partial<SourceViewerCode['props']> = {}) { - return shallow<SourceViewerCode>( - <SourceViewerCode - branchLike={mockBranch()} - duplications={[]} - duplicationsByLine={[]} - hasSourcesAfter={false} - hasSourcesBefore={false} - highlightedLine={undefined} - highlightedLocationMessage={undefined} - highlightedLocations={undefined} - highlightedSymbols={[]} - issueLocationsByLine={{}} - issuePopup={undefined} - issues={[mockIssue(), mockIssue()]} - issuesByLine={{}} - loadDuplications={jest.fn()} - loadingSourcesAfter={false} - loadingSourcesBefore={false} - loadSourcesAfter={jest.fn()} - loadSourcesBefore={jest.fn()} - onIssueChange={jest.fn()} - onIssuePopupToggle={jest.fn()} - onIssuesClose={jest.fn()} - onIssueSelect={jest.fn()} - onIssuesOpen={jest.fn()} - onIssueUnselect={jest.fn()} - onLocationSelect={jest.fn()} - onSymbolClick={jest.fn()} - openIssuesByLine={{}} - renderDuplicationPopup={jest.fn()} - selectedIssue={undefined} - sources={[mockSourceLine(), mockSourceLine(), mockSourceLine()]} - symbolsByLine={{}} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx deleted file mode 100644 index 62a97ff3b6a..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { mockSourceLine } from '../../../../helpers/mocks/sources'; -import { mockIssue } from '../../../../helpers/testMocks'; -import LineIssuesList, { LineIssuesListProps } from '../LineIssuesList'; - -it('should render issues', () => { - const wrapper = shallowRender({ - selectedIssue: 'issue', - issueLocationsByLine: { '1': [{ from: 1, to: 1, line: 1 }] }, - line: mockSourceLine({ line: 1 }), - issuesForLine: [mockIssue(false, { key: 'issue' })], - }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<LineIssuesListProps> = {}) { - return shallow( - <LineIssuesList - selectedIssue="" - displayWhyIsThisAnIssue - onIssueChange={jest.fn()} - onIssueClick={jest.fn()} - onIssuePopupToggle={jest.fn()} - openIssuesByLine={{}} - branchLike={mockBranch()} - issueLocationsByLine={{}} - line={mockSourceLine()} - issuePopup={undefined} - issuesForLine={[]} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx deleted file mode 100644 index fb355868c66..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx +++ /dev/null @@ -1,182 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { click, waitAndUpdate } from '../../../../helpers/testUtils'; -import { ComponentQualifier } from '../../../../types/component'; -import { MetricKey } from '../../../../types/metrics'; -import { SourceViewerFile } from '../../../../types/types'; -import MeasuresOverlay from '../MeasuresOverlay'; - -jest.mock('../../../../api/issues', () => ({ - getFacets: () => - Promise.resolve({ - facets: [ - { - property: 'types', - values: [ - { val: 'CODE_SMELL', count: 2 }, - { val: 'BUG', count: 1 }, - { val: 'VULNERABILITY', count: 0 }, - ], - }, - { - property: 'severities', - values: [ - { val: 'MAJOR', count: 1 }, - { val: 'INFO', count: 2 }, - { val: 'MINOR', count: 3 }, - { val: 'CRITICAL', count: 4 }, - { val: 'BLOCKER', count: 5 }, - ], - }, - { - property: 'tags', - values: [ - { val: 'bad-practice', count: 1 }, - { val: 'cert', count: 3 }, - { val: 'design', count: 1 }, - ], - }, - ], - }), -})); - -jest.mock('../../../../api/measures', () => ({ - getMeasures: () => - Promise.resolve([ - { metric: MetricKey.vulnerabilities, value: '0' }, - { metric: MetricKey.complexity, value: '1' }, - { metric: MetricKey.test_errors, value: '1' }, - { metric: MetricKey.comment_lines_density, value: '20.0' }, - { metric: MetricKey.wont_fix_issues, value: '0' }, - { metric: MetricKey.uncovered_lines, value: '1' }, - { metric: MetricKey.functions, value: '1' }, - { metric: MetricKey.duplicated_files, value: '1' }, - { metric: MetricKey.duplicated_blocks, value: '3' }, - { metric: MetricKey.line_coverage, value: '75.0' }, - { metric: MetricKey.duplicated_lines_density, value: '0.0' }, - { metric: MetricKey.comment_lines, value: '2' }, - { metric: MetricKey.ncloc, value: '8' }, - { metric: MetricKey.reliability_rating, value: '1.0' }, - { metric: MetricKey.false_positive_issues, value: '0' }, - { metric: MetricKey.reliability_remediation_effort, value: '0' }, - { metric: MetricKey.code_smells, value: '2' }, - { metric: MetricKey.security_rating, value: '1.0' }, - { metric: MetricKey.test_success_density, value: '100.0' }, - { metric: MetricKey.cognitive_complexity, value: '0' }, - { metric: MetricKey.files, value: '1' }, - { metric: MetricKey.duplicated_lines, value: '0' }, - { metric: MetricKey.lines, value: '18' }, - { metric: MetricKey.classes, value: '1' }, - { metric: MetricKey.bugs, value: '0' }, - { metric: MetricKey.lines_to_cover, value: '4' }, - { metric: MetricKey.sqale_index, value: '40' }, - { metric: MetricKey.sqale_debt_ratio, value: '16.7' }, - { metric: MetricKey.coverage, value: '75.0' }, - { metric: MetricKey.security_remediation_effort, value: '0' }, - { metric: MetricKey.statements, value: '3' }, - { metric: MetricKey.skipped_tests, value: '0' }, - { metric: MetricKey.test_failures, value: '0' }, - { metric: MetricKey.violations, value: '1' }, - ]), -})); - -jest.mock('../../../../api/metrics', () => ({ - getAllMetrics: () => - Promise.resolve([ - { key: MetricKey.vulnerabilities, type: 'INT', domain: 'Security' }, - { key: MetricKey.complexity, type: 'INT', domain: 'Complexity' }, - { key: MetricKey.test_errors, type: 'INT', domain: 'Tests' }, - { key: MetricKey.comment_lines_density, type: 'PERCENT', domain: 'Size' }, - { key: MetricKey.wont_fix_issues, type: 'INT', domain: 'Issues' }, - { key: MetricKey.uncovered_lines, type: 'INT', domain: 'Coverage' }, - { key: MetricKey.functions, type: 'INT', domain: 'Size' }, - { key: MetricKey.duplicated_files, type: 'INT', domain: 'Duplications' }, - { key: MetricKey.duplicated_blocks, type: 'INT', domain: 'Duplications' }, - { key: MetricKey.line_coverage, type: 'PERCENT', domain: 'Coverage' }, - { key: MetricKey.duplicated_lines_density, type: 'PERCENT', domain: 'Duplications' }, - { key: MetricKey.comment_lines, type: 'INT', domain: 'Size' }, - { key: MetricKey.ncloc, type: 'INT', domain: 'Size' }, - { key: MetricKey.reliability_rating, type: 'RATING', domain: 'Reliability' }, - { key: MetricKey.false_positive_issues, type: 'INT', domain: 'Issues' }, - { key: MetricKey.code_smells, type: 'INT', domain: 'Maintainability' }, - { key: MetricKey.security_rating, type: 'RATING', domain: 'Security' }, - { key: MetricKey.test_success_density, type: 'PERCENT', domain: 'Tests' }, - { key: MetricKey.cognitive_complexity, type: 'INT', domain: 'Complexity' }, - { key: MetricKey.files, type: 'INT', domain: 'Size' }, - { key: MetricKey.duplicated_lines, type: 'INT', domain: 'Duplications' }, - { key: MetricKey.lines, type: 'INT', domain: 'Size' }, - { key: MetricKey.classes, type: 'INT', domain: 'Size' }, - { key: MetricKey.bugs, type: 'INT', domain: 'Reliability' }, - { key: MetricKey.lines_to_cover, type: 'INT', domain: 'Coverage' }, - { key: MetricKey.sqale_index, type: 'WORK_DUR', domain: 'Maintainability' }, - { key: MetricKey.sqale_debt_ratio, type: 'PERCENT', domain: 'Maintainability' }, - { key: MetricKey.coverage, type: 'PERCENT', domain: 'Coverage' }, - { key: MetricKey.statements, type: 'INT', domain: 'Size' }, - { key: MetricKey.skipped_tests, type: 'INT', domain: 'Tests' }, - { key: MetricKey.test_failures, type: 'INT', domain: 'Tests' }, - { key: MetricKey.violations, type: 'INT', domain: 'Issues' }, - // next two must be filtered out - { key: 'data', type: 'DATA' }, - { key: 'hidden', hidden: true }, - ]), -})); - -const sourceViewerFile: SourceViewerFile = { - key: 'component-key', - measures: {}, - path: 'src/file.js', - project: 'project-key', - projectName: 'Project Name', - q: ComponentQualifier.File, - uuid: 'abcd123', -}; - -const branchLike = mockBranch({ name: 'feature' }); - -it('should render source file', async () => { - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - - click(wrapper.find('.js-show-all-measures')); - expect(wrapper).toMatchSnapshot(); -}); - -it('should render test file', async () => { - const wrapper = shallowRender({ - sourceViewerFile: { ...sourceViewerFile, q: ComponentQualifier.TestFile }, - }); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<MeasuresOverlay['props']> = {}) { - return shallow( - <MeasuresOverlay - branchLike={branchLike} - onClose={jest.fn()} - sourceViewerFile={sourceViewerFile} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx deleted file mode 100644 index 8e11917aadf..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import MeasuresOverlayMeasure from '../MeasuresOverlayMeasure'; - -it('should render', () => { - expect( - shallow( - <MeasuresOverlayMeasure - measure={{ - metric: { id: '1', key: 'coverage', name: 'Coverage', type: 'PERCENT' }, - value: '72', - }} - />, - ), - ).toMatchSnapshot(); -}); - -it('should render issues icon', () => { - expect( - shallow( - <MeasuresOverlayMeasure - measure={{ - metric: { id: '1', key: 'bugs', name: 'Bugs', type: 'INT' }, - value: '2', - }} - />, - ), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap deleted file mode 100644 index 4f776d6e497..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap +++ /dev/null @@ -1,65 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render issues 1`] = ` -<div - className="issue-list" -> - <Issue - branchLike={ - { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": false, - "name": "branch-6.7", - } - } - displayWhyIsThisAnIssue={true} - issue={ - { - "actions": [], - "cleanCodeAttribute": "RESPECTFUL", - "cleanCodeAttributeCategory": "RESPONSIBLE", - "component": "main.js", - "componentEnabled": true, - "componentLongName": "main.js", - "componentQualifier": "FIL", - "componentUuid": "foo1234", - "creationDate": "2017-03-01T09:36:01+0100", - "flows": [], - "flowsWithType": [], - "impacts": [ - { - "severity": "MEDIUM", - "softwareQuality": "MAINTAINABILITY", - }, - ], - "key": "issue", - "line": 25, - "message": "Reduce the number of conditional operators (4) used in the expression", - "project": "myproject", - "projectKey": "foo", - "projectName": "Foo", - "rule": "javascript:S1067", - "ruleName": "foo", - "scope": "MAIN", - "secondaryLocations": [], - "severity": "MAJOR", - "status": "OPEN", - "textRange": { - "endLine": 26, - "endOffset": 15, - "startLine": 25, - "startOffset": 0, - }, - "transitions": [], - "type": "BUG", - } - } - key="issue" - onChange={[MockFunction]} - onPopupToggle={[MockFunction]} - onSelect={[MockFunction]} - selected={true} - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap deleted file mode 100644 index e0330d87479..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap +++ /dev/null @@ -1,1849 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render source file 1`] = ` -<Modal - contentLabel="component_viewer.file_measures" - onRequestClose={[MockFunction]} - size="large" -> - <div - className="modal-head" - > - <h2> - component_viewer.file_measures - </h2> - </div> - <div - className="modal-body modal-container" - > - <div - className="measures-viewer-header big-spacer-bottom" - > - <div> - <QualifierIcon - className="little-spacer-right" - qualifier="TRK" - /> - <ForwardRef(Link) - to={ - { - "pathname": "/dashboard", - "search": "?branch=feature&id=project-key", - } - } - > - Project Name - </ForwardRef(Link)> - </div> - <div - className="display-flex-center little-spacer-top" - > - <QualifierIcon - className="little-spacer-right" - qualifier="FIL" - /> - src/file.js - </div> - </div> - <div - className="measures-viewer" - > - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <MeasuresOverlayMeasure - key="lines" - measure={ - { - "metric": { - "domain": "Size", - "key": "lines", - "type": "INT", - }, - "value": "18", - } - } - /> - <MeasuresOverlayMeasure - key="ncloc" - measure={ - { - "metric": { - "domain": "Size", - "key": "ncloc", - "type": "INT", - }, - "value": "8", - } - } - /> - <MeasuresOverlayMeasure - key="comment_lines" - measure={ - { - "metric": { - "domain": "Size", - "key": "comment_lines", - "type": "INT", - }, - "value": "2", - } - } - /> - <MeasuresOverlayMeasure - key="comment_lines_density" - measure={ - { - "metric": { - "domain": "Size", - "key": "comment_lines_density", - "type": "PERCENT", - }, - "value": "20.0", - } - } - /> - </div> - <div - className="measures" - > - <MeasuresOverlayMeasure - key="cognitive_complexity" - measure={ - { - "metric": { - "domain": "Complexity", - "key": "cognitive_complexity", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="complexity" - measure={ - { - "metric": { - "domain": "Complexity", - "key": "complexity", - "type": "INT", - }, - "value": "1", - } - } - /> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <div - className="measure measure-big" - data-metric="violations" - > - <span - className="measure-value" - > - <Measure - metricKey="violations" - metricType="INT" - value="1" - /> - </span> - <span - className="measure-name" - > - violations - </span> - </div> - <div - className="measure measure-big" - data-metric="sqale_index" - > - <span - className="measure-value" - > - <Measure - metricKey="sqale_index" - metricType="WORK_DUR" - value="40" - /> - </span> - <span - className="measure-name" - > - sqale_index - </span> - </div> - </div> - <div - className="measures" - > - <div - className="measure measure-one-line" - key="BUG" - > - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="BUG" - /> - issue.type.BUG - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - <div - className="measure measure-one-line" - key="VULNERABILITY" - > - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="VULNERABILITY" - /> - issue.type.VULNERABILITY - </span> - <span - className="measure-value" - > - 0 - </span> - </div> - <div - className="measure measure-one-line" - key="CODE_SMELL" - > - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="CODE_SMELL" - /> - issue.type.CODE_SMELL - </span> - <span - className="measure-value" - > - 2 - </span> - </div> - </div> - <div - className="measures" - > - <div - className="measure measure-one-line" - key="BLOCKER" - > - <span - className="measure-name" - > - <SeverityHelper - severity="BLOCKER" - /> - </span> - <span - className="measure-value" - > - 5 - </span> - </div> - <div - className="measure measure-one-line" - key="CRITICAL" - > - <span - className="measure-name" - > - <SeverityHelper - severity="CRITICAL" - /> - </span> - <span - className="measure-value" - > - 4 - </span> - </div> - <div - className="measure measure-one-line" - key="MAJOR" - > - <span - className="measure-name" - > - <SeverityHelper - severity="MAJOR" - /> - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - <div - className="measure measure-one-line" - key="MINOR" - > - <span - className="measure-name" - > - <SeverityHelper - severity="MINOR" - /> - </span> - <span - className="measure-value" - > - 3 - </span> - </div> - <div - className="measure measure-one-line" - key="INFO" - > - <span - className="measure-name" - > - <SeverityHelper - severity="INFO" - /> - </span> - <span - className="measure-value" - > - 2 - </span> - </div> - </div> - <div - className="measures" - > - <div - className="measure measure-one-line" - key="bad-practice" - > - <span - className="measure-name" - > - <TagsIcon - className="little-spacer-right" - /> - bad-practice - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - <div - className="measure measure-one-line" - key="cert" - > - <span - className="measure-name" - > - <TagsIcon - className="little-spacer-right" - /> - cert - </span> - <span - className="measure-value" - > - 3 - </span> - </div> - <div - className="measure measure-one-line" - key="design" - > - <span - className="measure-name" - > - <TagsIcon - className="little-spacer-right" - /> - design - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <div - className="measures-chart" - > - <CoverageRating - size="big" - value="75.0" - /> - </div> - <div - className="measure measure-big" - data-metric="coverage" - > - <span - className="measure-value" - > - <Measure - metricKey="coverage" - metricType="PERCENT" - value="75.0" - /> - </span> - <span - className="measure-name" - > - coverage - </span> - </div> - </div> - <div - className="measures" - > - <MeasuresOverlayMeasure - key="uncovered_lines" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "uncovered_lines", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="lines_to_cover" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "lines_to_cover", - "type": "INT", - }, - "value": "4", - } - } - /> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <div - className="measures-chart" - > - <DuplicationsRating - muted={false} - size="big" - value={0} - /> - </div> - <div - className="measure measure-big" - data-metric="duplicated_lines_density" - > - <span - className="measure-value" - > - <Measure - metricKey="duplicated_lines_density" - metricType="PERCENT" - value="0.0" - /> - </span> - <span - className="measure-name" - > - duplicated_lines_density - </span> - </div> - </div> - <div - className="measures" - > - <MeasuresOverlayMeasure - key="duplicated_blocks" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_blocks", - "type": "INT", - }, - "value": "3", - } - } - /> - <MeasuresOverlayMeasure - key="duplicated_lines" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_lines", - "type": "INT", - }, - "value": "0", - } - } - /> - </div> - </div> - </div> - </div> - <div - className="spacer-top" - > - <a - className="js-show-all-measures" - href="#" - onClick={[Function]} - > - component_viewer.show_all_measures - </a> - </div> - </div> - <footer - className="modal-foot" - > - <ResetButtonLink - onClick={[MockFunction]} - > - close - </ResetButtonLink> - </footer> -</Modal> -`; - -exports[`should render source file 2`] = ` -<Modal - contentLabel="component_viewer.file_measures" - onRequestClose={[MockFunction]} - size="large" -> - <div - className="modal-head" - > - <h2> - component_viewer.file_measures - </h2> - </div> - <div - className="modal-body modal-container" - > - <div - className="measures-viewer-header big-spacer-bottom" - > - <div> - <QualifierIcon - className="little-spacer-right" - qualifier="TRK" - /> - <ForwardRef(Link) - to={ - { - "pathname": "/dashboard", - "search": "?branch=feature&id=project-key", - } - } - > - Project Name - </ForwardRef(Link)> - </div> - <div - className="display-flex-center little-spacer-top" - > - <QualifierIcon - className="little-spacer-right" - qualifier="FIL" - /> - src/file.js - </div> - </div> - <div - className="measures-viewer" - > - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <MeasuresOverlayMeasure - key="lines" - measure={ - { - "metric": { - "domain": "Size", - "key": "lines", - "type": "INT", - }, - "value": "18", - } - } - /> - <MeasuresOverlayMeasure - key="ncloc" - measure={ - { - "metric": { - "domain": "Size", - "key": "ncloc", - "type": "INT", - }, - "value": "8", - } - } - /> - <MeasuresOverlayMeasure - key="comment_lines" - measure={ - { - "metric": { - "domain": "Size", - "key": "comment_lines", - "type": "INT", - }, - "value": "2", - } - } - /> - <MeasuresOverlayMeasure - key="comment_lines_density" - measure={ - { - "metric": { - "domain": "Size", - "key": "comment_lines_density", - "type": "PERCENT", - }, - "value": "20.0", - } - } - /> - </div> - <div - className="measures" - > - <MeasuresOverlayMeasure - key="cognitive_complexity" - measure={ - { - "metric": { - "domain": "Complexity", - "key": "cognitive_complexity", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="complexity" - measure={ - { - "metric": { - "domain": "Complexity", - "key": "complexity", - "type": "INT", - }, - "value": "1", - } - } - /> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <div - className="measure measure-big" - data-metric="violations" - > - <span - className="measure-value" - > - <Measure - metricKey="violations" - metricType="INT" - value="1" - /> - </span> - <span - className="measure-name" - > - violations - </span> - </div> - <div - className="measure measure-big" - data-metric="sqale_index" - > - <span - className="measure-value" - > - <Measure - metricKey="sqale_index" - metricType="WORK_DUR" - value="40" - /> - </span> - <span - className="measure-name" - > - sqale_index - </span> - </div> - </div> - <div - className="measures" - > - <div - className="measure measure-one-line" - key="BUG" - > - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="BUG" - /> - issue.type.BUG - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - <div - className="measure measure-one-line" - key="VULNERABILITY" - > - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="VULNERABILITY" - /> - issue.type.VULNERABILITY - </span> - <span - className="measure-value" - > - 0 - </span> - </div> - <div - className="measure measure-one-line" - key="CODE_SMELL" - > - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="CODE_SMELL" - /> - issue.type.CODE_SMELL - </span> - <span - className="measure-value" - > - 2 - </span> - </div> - </div> - <div - className="measures" - > - <div - className="measure measure-one-line" - key="BLOCKER" - > - <span - className="measure-name" - > - <SeverityHelper - severity="BLOCKER" - /> - </span> - <span - className="measure-value" - > - 5 - </span> - </div> - <div - className="measure measure-one-line" - key="CRITICAL" - > - <span - className="measure-name" - > - <SeverityHelper - severity="CRITICAL" - /> - </span> - <span - className="measure-value" - > - 4 - </span> - </div> - <div - className="measure measure-one-line" - key="MAJOR" - > - <span - className="measure-name" - > - <SeverityHelper - severity="MAJOR" - /> - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - <div - className="measure measure-one-line" - key="MINOR" - > - <span - className="measure-name" - > - <SeverityHelper - severity="MINOR" - /> - </span> - <span - className="measure-value" - > - 3 - </span> - </div> - <div - className="measure measure-one-line" - key="INFO" - > - <span - className="measure-name" - > - <SeverityHelper - severity="INFO" - /> - </span> - <span - className="measure-value" - > - 2 - </span> - </div> - </div> - <div - className="measures" - > - <div - className="measure measure-one-line" - key="bad-practice" - > - <span - className="measure-name" - > - <TagsIcon - className="little-spacer-right" - /> - bad-practice - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - <div - className="measure measure-one-line" - key="cert" - > - <span - className="measure-name" - > - <TagsIcon - className="little-spacer-right" - /> - cert - </span> - <span - className="measure-value" - > - 3 - </span> - </div> - <div - className="measure measure-one-line" - key="design" - > - <span - className="measure-name" - > - <TagsIcon - className="little-spacer-right" - /> - design - </span> - <span - className="measure-value" - > - 1 - </span> - </div> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <div - className="measures-chart" - > - <CoverageRating - size="big" - value="75.0" - /> - </div> - <div - className="measure measure-big" - data-metric="coverage" - > - <span - className="measure-value" - > - <Measure - metricKey="coverage" - metricType="PERCENT" - value="75.0" - /> - </span> - <span - className="measure-name" - > - coverage - </span> - </div> - </div> - <div - className="measures" - > - <MeasuresOverlayMeasure - key="uncovered_lines" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "uncovered_lines", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="lines_to_cover" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "lines_to_cover", - "type": "INT", - }, - "value": "4", - } - } - /> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <div - className="measures-chart" - > - <DuplicationsRating - muted={false} - size="big" - value={0} - /> - </div> - <div - className="measure measure-big" - data-metric="duplicated_lines_density" - > - <span - className="measure-value" - > - <Measure - metricKey="duplicated_lines_density" - metricType="PERCENT" - value="0.0" - /> - </span> - <span - className="measure-name" - > - duplicated_lines_density - </span> - </div> - </div> - <div - className="measures" - > - <MeasuresOverlayMeasure - key="duplicated_blocks" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_blocks", - "type": "INT", - }, - "value": "3", - } - } - /> - <MeasuresOverlayMeasure - key="duplicated_lines" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_lines", - "type": "INT", - }, - "value": "0", - } - } - /> - </div> - </div> - </div> - </div> - <div - className="spacer-top" - > - <div - className="measures-viewer measures-viewer-secondary" - > - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - key="Complexity" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Complexity - </span> - </div> - <MeasuresOverlayMeasure - key="cognitive_complexity" - measure={ - { - "metric": { - "domain": "Complexity", - "key": "cognitive_complexity", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="complexity" - measure={ - { - "metric": { - "domain": "Complexity", - "key": "complexity", - "type": "INT", - }, - "value": "1", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Size" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Size - </span> - </div> - <MeasuresOverlayMeasure - key="classes" - measure={ - { - "metric": { - "domain": "Size", - "key": "classes", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="comment_lines" - measure={ - { - "metric": { - "domain": "Size", - "key": "comment_lines", - "type": "INT", - }, - "value": "2", - } - } - /> - <MeasuresOverlayMeasure - key="comment_lines_density" - measure={ - { - "metric": { - "domain": "Size", - "key": "comment_lines_density", - "type": "PERCENT", - }, - "value": "20.0", - } - } - /> - <MeasuresOverlayMeasure - key="files" - measure={ - { - "metric": { - "domain": "Size", - "key": "files", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="functions" - measure={ - { - "metric": { - "domain": "Size", - "key": "functions", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="lines" - measure={ - { - "metric": { - "domain": "Size", - "key": "lines", - "type": "INT", - }, - "value": "18", - } - } - /> - <MeasuresOverlayMeasure - key="ncloc" - measure={ - { - "metric": { - "domain": "Size", - "key": "ncloc", - "type": "INT", - }, - "value": "8", - } - } - /> - <MeasuresOverlayMeasure - key="statements" - measure={ - { - "metric": { - "domain": "Size", - "key": "statements", - "type": "INT", - }, - "value": "3", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Coverage" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Coverage - </span> - </div> - <MeasuresOverlayMeasure - key="coverage" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "coverage", - "type": "PERCENT", - }, - "value": "75.0", - } - } - /> - <MeasuresOverlayMeasure - key="line_coverage" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "line_coverage", - "type": "PERCENT", - }, - "value": "75.0", - } - } - /> - <MeasuresOverlayMeasure - key="lines_to_cover" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "lines_to_cover", - "type": "INT", - }, - "value": "4", - } - } - /> - <MeasuresOverlayMeasure - key="uncovered_lines" - measure={ - { - "metric": { - "domain": "Coverage", - "key": "uncovered_lines", - "type": "INT", - }, - "value": "1", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Reliability" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Reliability - </span> - </div> - <MeasuresOverlayMeasure - key="bugs" - measure={ - { - "metric": { - "domain": "Reliability", - "key": "bugs", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="reliability_rating" - measure={ - { - "metric": { - "domain": "Reliability", - "key": "reliability_rating", - "type": "RATING", - }, - "value": "1.0", - } - } - /> - </div> - </div> - </div> - <div - className="measures-viewer-section" - > - <div - className="measures-viewer-card" - key="Security" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Security - </span> - </div> - <MeasuresOverlayMeasure - key="security_rating" - measure={ - { - "metric": { - "domain": "Security", - "key": "security_rating", - "type": "RATING", - }, - "value": "1.0", - } - } - /> - <MeasuresOverlayMeasure - key="vulnerabilities" - measure={ - { - "metric": { - "domain": "Security", - "key": "vulnerabilities", - "type": "INT", - }, - "value": "0", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Tests" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Tests - </span> - </div> - <MeasuresOverlayMeasure - key="skipped_tests" - measure={ - { - "metric": { - "domain": "Tests", - "key": "skipped_tests", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="test_errors" - measure={ - { - "metric": { - "domain": "Tests", - "key": "test_errors", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="test_failures" - measure={ - { - "metric": { - "domain": "Tests", - "key": "test_failures", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="test_success_density" - measure={ - { - "metric": { - "domain": "Tests", - "key": "test_success_density", - "type": "PERCENT", - }, - "value": "100.0", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Issues" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Issues - </span> - </div> - <MeasuresOverlayMeasure - key="false_positive_issues" - measure={ - { - "metric": { - "domain": "Issues", - "key": "false_positive_issues", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="violations" - measure={ - { - "metric": { - "domain": "Issues", - "key": "violations", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="wont_fix_issues" - measure={ - { - "metric": { - "domain": "Issues", - "key": "wont_fix_issues", - "type": "INT", - }, - "value": "0", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Duplications" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Duplications - </span> - </div> - <MeasuresOverlayMeasure - key="duplicated_blocks" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_blocks", - "type": "INT", - }, - "value": "3", - } - } - /> - <MeasuresOverlayMeasure - key="duplicated_files" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_files", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="duplicated_lines" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_lines", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="duplicated_lines_density" - measure={ - { - "metric": { - "domain": "Duplications", - "key": "duplicated_lines_density", - "type": "PERCENT", - }, - "value": "0.0", - } - } - /> - </div> - </div> - <div - className="measures-viewer-card" - key="Maintainability" - > - <div - className="measures" - > - <div - className="measure measure-big" - > - <span - className="measure-name" - > - metric_domain.Maintainability - </span> - </div> - <MeasuresOverlayMeasure - key="code_smells" - measure={ - { - "metric": { - "domain": "Maintainability", - "key": "code_smells", - "type": "INT", - }, - "value": "2", - } - } - /> - <MeasuresOverlayMeasure - key="sqale_debt_ratio" - measure={ - { - "metric": { - "domain": "Maintainability", - "key": "sqale_debt_ratio", - "type": "PERCENT", - }, - "value": "16.7", - } - } - /> - <MeasuresOverlayMeasure - key="sqale_index" - measure={ - { - "metric": { - "domain": "Maintainability", - "key": "sqale_index", - "type": "WORK_DUR", - }, - "value": "40", - } - } - /> - </div> - </div> - </div> - </div> - </div> - </div> - <footer - className="modal-foot" - > - <ResetButtonLink - onClick={[MockFunction]} - > - close - </ResetButtonLink> - </footer> -</Modal> -`; - -exports[`should render test file 1`] = ` -<Modal - contentLabel="component_viewer.file_measures" - onRequestClose={[MockFunction]} - size="large" -> - <div - className="modal-head" - > - <h2> - component_viewer.file_measures - </h2> - </div> - <div - className="modal-body modal-container" - > - <div - className="measures-viewer-header big-spacer-bottom" - > - <div> - <QualifierIcon - className="little-spacer-right" - qualifier="TRK" - /> - <ForwardRef(Link) - to={ - { - "pathname": "/dashboard", - "search": "?branch=feature&id=project-key", - } - } - > - Project Name - </ForwardRef(Link)> - </div> - <div - className="display-flex-center little-spacer-top" - > - <QualifierIcon - className="little-spacer-right" - qualifier="UTS" - /> - src/file.js - </div> - </div> - <div - className="measures-viewer" - > - <div - className="measures-viewer-section measures-viewer-section-limited" - > - <div - className="measures-viewer-card" - > - <div - className="measures" - > - <MeasuresOverlayMeasure - key="test_success_density" - measure={ - { - "metric": { - "domain": "Tests", - "key": "test_success_density", - "type": "PERCENT", - }, - "value": "100.0", - } - } - /> - <MeasuresOverlayMeasure - key="test_failures" - measure={ - { - "metric": { - "domain": "Tests", - "key": "test_failures", - "type": "INT", - }, - "value": "0", - } - } - /> - <MeasuresOverlayMeasure - key="test_errors" - measure={ - { - "metric": { - "domain": "Tests", - "key": "test_errors", - "type": "INT", - }, - "value": "1", - } - } - /> - <MeasuresOverlayMeasure - key="skipped_tests" - measure={ - { - "metric": { - "domain": "Tests", - "key": "skipped_tests", - "type": "INT", - }, - "value": "0", - } - } - /> - </div> - </div> - </div> - </div> - <div - className="spacer-top" - > - <a - className="js-show-all-measures" - href="#" - onClick={[Function]} - > - component_viewer.show_all_measures - </a> - </div> - </div> - <footer - className="modal-foot" - > - <ResetButtonLink - onClick={[MockFunction]} - > - close - </ResetButtonLink> - </footer> -</Modal> -`; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap deleted file mode 100644 index 4612ee4034a..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayMeasure-test.tsx.snap +++ /dev/null @@ -1,53 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<div - className="measure measure-one-line" - data-metric="coverage" - key="coverage" -> - <span - className="measure-name" - > - Coverage - </span> - <span - className="measure-value" - > - <Measure - metricKey="coverage" - metricType="PERCENT" - small={true} - value="72" - /> - </span> -</div> -`; - -exports[`should render issues icon 1`] = ` -<div - className="measure measure-one-line" - data-metric="bugs" - key="bugs" -> - <span - className="measure-name" - > - <IssueTypeIcon - className="little-spacer-right" - query="bugs" - /> - Bugs - </span> - <span - className="measure-value" - > - <Measure - metricKey="bugs" - metricType="INT" - small={true} - value="2" - /> - </span> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx new file mode 100644 index 00000000000..94fff12982b --- /dev/null +++ b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yLinks-test.tsx @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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 userEvent from '@testing-library/user-event'; +import * as React from 'react'; +import { renderComponent } from '../../../helpers/testReactTestingUtils'; +import { byRole } from '../../../helpers/testSelector'; +import { A11yContext } from '../A11yContext'; +import A11yProvider from '../A11yProvider'; +import A11ySkipLinks from '../A11ySkipLinks'; + +const ui = { + links: byRole('link'), + + // specific to test + addButton: byRole('button', { name: 'Add' }), + removeButton: byRole('button', { name: 'Remove' }), +}; + +it('should render correctly', async () => { + const user = userEvent.setup(); + + renderA11ySkipLinks(); + + expect(ui.links.queryAll()).toHaveLength(0); + + await user.click(ui.addButton.get()); + expect(ui.links.getAll()).toHaveLength(1); + + await user.click(ui.addButton.get()); + expect(ui.links.getAll()).toHaveLength(2); + + await user.click(ui.removeButton.get()); + expect(ui.links.getAll()).toHaveLength(1); +}); + +function renderA11ySkipLinks() { + return renderComponent( + <A11yProvider> + <A11ySkipLinks /> + + <LinkTester /> + </A11yProvider>, + '/', + {}, + ); +} + +let count = 0; + +function LinkTester() { + const { addA11ySkipLink, removeA11ySkipLink } = React.useContext(A11yContext); + + return ( + <> + <button + onClick={() => { + count += 1; + addA11ySkipLink({ key: `${count}`, label: `link #${count}` }); + }} + type="button" + > + Add + </button> + <button + onClick={() => { + removeA11ySkipLink({ key: `${count}`, label: `link #${count}` }); + count -= 1; + }} + type="button" + > + Remove + </button> + </> + ); +} diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx deleted file mode 100644 index d90fac4b41a..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import { A11yContextShape } from '../A11yContext'; -import A11yProvider from '../A11yProvider'; - -const link1 = { key: 'link1', label: 'Link 1', weight: 0 }; -const link2 = { key: 'link2', label: 'Link 2', weight: -10 }; -const link3 = { key: 'link3', label: 'Link 3', weight: 0 }; - -it('should allow to register new skip links', () => { - const wrapper = shallowRender(); - const instance = wrapper.instance(); - expect(wrapper.state('links')).toEqual([]); - - // Check that an absence of weight is treated as "0". - instance.addA11ySkipLink({ ...link1, weight: undefined }); - expect(wrapper.state('links')).toEqual([link1]); - - instance.addA11ySkipLink(link2); - expect(wrapper.state('links')).toEqual([link1, link2]); -}); - -it('should pass the ordered links to the consumers', () => { - const wrapper = shallowRender(); - const instance = wrapper.instance(); - instance.setState({ links: [link1, link2, link3] }); - waitAndUpdate(wrapper); - expect((wrapper.prop('value') as A11yContextShape).links).toEqual([link2, link1, link3]); -}); - -it('should allow to unregister skip links', () => { - const wrapper = shallowRender(); - const instance = wrapper.instance(); - instance.setState({ links: [link1, link2, link3] }); - - instance.removeA11ySkipLink(link1); - expect(wrapper.state('links')).toEqual([link2, link3]); - - instance.removeA11ySkipLink(link2); - expect(wrapper.state('links')).toEqual([link3]); -}); - -function shallowRender() { - return shallow<A11yProvider>( - <A11yProvider> - <div /> - </A11yProvider>, - ); -} diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx deleted file mode 100644 index 83c1d74f918..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import A11ySkipLinks from '../A11ySkipLinks'; - -jest.mock('../A11yContext', () => ({ - A11yContext: { - Consumer: ({ children }: any) => { - return children({ - links: [ - { key: 'link1', label: 'Label 1' }, - { key: 'link2', label: 'Label 2' }, - ], - }); - }, - }, -})); - -it('should render correctly', () => { - expect(shallow(<A11ySkipLinks />).dive()).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx deleted file mode 100644 index 4aebc7f17fb..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount } from 'enzyme'; -import * as React from 'react'; -import { A11ySkipTargetInner } from '../A11ySkipTarget'; - -it('should render correctly, and (un)register the link when (un)mounted', () => { - const link = { key: 'main', label: 'Skip to content' }; - const addA11ySkipLink = jest.fn(); - const removeA11ySkipLink = jest.fn(); - const wrapper = mount( - <A11ySkipTargetInner - addA11ySkipLink={addA11ySkipLink} - anchor={link.key} - label={link.label} - removeA11ySkipLink={removeA11ySkipLink} - />, - ); - - expect(wrapper).toMatchSnapshot(); - expect(addA11ySkipLink).toHaveBeenCalledWith(link); - wrapper.unmount(); - expect(removeA11ySkipLink).toHaveBeenCalledWith(link); -}); diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap b/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap deleted file mode 100644 index 2918cc6adf2..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap +++ /dev/null @@ -1,20 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -[ - <a - className="a11y-skip-link" - href="#a11y_target__link1" - key="link1" - > - Label 1 - </a>, - <a - className="a11y-skip-link" - href="#a11y_target__link2" - key="link2" - > - Label 2 - </a>, -] -`; diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap b/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap deleted file mode 100644 index 5b6fbdc757b..00000000000 --- a/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly, and (un)register the link when (un)mounted 1`] = ` -<A11ySkipTargetInner - addA11ySkipLink={ - [MockFunction] { - "calls": [ - [ - { - "key": "main", - "label": "Skip to content", - "weight": undefined, - }, - ], - ], - "results": [ - { - "type": "return", - "value": undefined, - }, - ], - } - } - anchor="main" - label="Skip to content" - removeA11ySkipLink={[MockFunction]} -> - <span - id="a11y_target__main" - /> -</A11ySkipTargetInner> -`; diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx deleted file mode 100644 index 83b5bc2a22d..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import BarChart from '../BarChart'; - -it('should display bars', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const chart = shallow(<BarChart barsWidth={20} data={data} height={100} width={100} />); - expect(chart.find('.bar-chart-bar').length).toBe(3); -}); - -it('should display ticks', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const ticks = ['A', 'B', 'C']; - const chart = shallow( - <BarChart barsWidth={20} data={data} height={100} width={100} xTicks={ticks} />, - ); - expect(chart.find('.bar-chart-tick').length).toBe(3); -}); - -it('should display values', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const values = ['A', 'B', 'C']; - const chart = shallow( - <BarChart barsWidth={20} data={data} height={100} width={100} xValues={values} />, - ); - expect(chart.find('.bar-chart-tick').length).toBe(3); -}); - -it('should display bars, ticks and values', () => { - const data = [ - { x: 1, y: 10, description: '' }, - { x: 2, y: 30, description: '' }, - { x: 3, y: 20, description: '' }, - ]; - const ticks = ['A', 'B', 'C']; - const values = ['A', 'B', 'C']; - const chart = shallow( - <BarChart - barsWidth={20} - data={data} - height={100} - width={100} - xTicks={ticks} - xValues={values} - />, - ); - expect(chart.find('.bar-chart-bar').length).toBe(3); - expect(chart.find('.bar-chart-tick').length).toBe(6); -}); diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx deleted file mode 100644 index d31efbc5099..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { scaleLinear } from 'd3-scale'; -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { colors } from '../../../app/theme'; -import ColorGradientLegend from '../ColorGradientLegend'; - -const COLORS = [colors.green, colors.lightGreen, colors.yellow, colors.orange, colors.red]; - -it('should render properly', () => { - const colorScale = scaleLinear<string, string>().domain([0, 25, 50, 75, 100]).range(COLORS); - const wrapper = shallow( - <ColorGradientLegend - className="measure-details-treemap-legend" - colorScale={colorScale} - showColorNA - height={20} - width={200} - />, - ); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx deleted file mode 100644 index f5351a2edfe..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import DonutChart, { DonutChartProps } from '../DonutChart'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('Sector').first().dive()).toMatchSnapshot(); -}); - -it('should render correctly with padding and pad angle too', () => { - expect(shallowRender({ padAngle: 0.1, padding: [2, 2, 2, 2] })).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<DonutChartProps> = {}) { - return shallow( - <DonutChart - data={[ - { fill: '#000000', value: 25 }, - { fill: '#ffffff', value: 75 }, - ]} - height={20} - thickness={2} - width={20} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx deleted file mode 100644 index 70942003c34..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import LineChart from '../LineChart'; - -it('should display line', () => { - const data = [ - { x: 1, y: 10 }, - { x: 2, y: 30 }, - { x: 3, y: 20 }, - ]; - const chart = shallow(<LineChart data={data} height={100} width={100} />); - expect(chart.find('.line-chart-path').length).toBe(1); -}); - -it('should display ticks', () => { - const data = [ - { x: 1, y: 10 }, - { x: 2, y: 30 }, - { x: 3, y: 20 }, - ]; - const ticks = ['A', 'B', 'C']; - const chart = shallow(<LineChart data={data} height={100} width={100} xTicks={ticks} />); - expect(chart.find('.line-chart-tick').length).toBe(3); -}); - -it('should display values', () => { - const data = [ - { x: 1, y: 10 }, - { x: 2, y: 30 }, - { x: 3, y: 20 }, - ]; - const values = ['A', 'B', 'C']; - const chart = shallow(<LineChart data={data} height={100} width={100} xValues={values} />); - expect(chart.find('.line-chart-tick').length).toBe(3); -}); diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap deleted file mode 100644 index f57804837fd..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/ColorGradientLegend-test.tsx.snap +++ /dev/null @@ -1,220 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render properly 1`] = ` -<svg - className="measure-details-treemap-legend" - height={20} - width={200} -> - <defs> - <linearGradient - id="gradient-legend" - > - <stop - key="0" - offset={0} - stopColor="#00aa00" - /> - <stop - key="1" - offset={0.25} - stopColor="#b0d513" - /> - <stop - key="2" - offset={0.5} - stopColor="#eabe06" - /> - <stop - key="3" - offset={0.75} - stopColor="#ed7d20" - /> - <stop - key="4" - offset={1} - stopColor="#D02F3A" - /> - </linearGradient> - <pattern - height="30" - id="stripes" - patternTransform="rotate(45 0 0)" - patternUnits="userSpaceOnUse" - width="30" - > - <line - style={ - { - "stroke": "#b4b4b4", - "strokeWidth": 4, - } - } - x1={0} - x2={0} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#888", - "strokeWidth": 4, - } - } - x1={4} - x2={4} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#b4b4b4", - "strokeWidth": 4, - } - } - x1={8} - x2={8} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#888", - "strokeWidth": 4, - } - } - x1={12} - x2={12} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#b4b4b4", - "strokeWidth": 4, - } - } - x1={16} - x2={16} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#888", - "strokeWidth": 4, - } - } - x1={20} - x2={20} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#b4b4b4", - "strokeWidth": 4, - } - } - x1={24} - x2={24} - y1="0" - y2="30" - /> - <line - style={ - { - "stroke": "#888", - "strokeWidth": 4, - } - } - x1={28} - x2={28} - y1="0" - y2="30" - /> - </pattern> - </defs> - <g - transform="translate(0, 12)" - > - <rect - fill="url(#gradient-legend)" - height={8} - width={176} - x={0} - y={0} - /> - <text - className="gradient-legend-text" - dy="-2px" - key="0" - x={0} - y={0} - > - 0 - </text> - <text - className="gradient-legend-text" - dy="-2px" - key="1" - x={44} - y={0} - > - 25 - </text> - <text - className="gradient-legend-text" - dy="-2px" - key="2" - x={88} - y={0} - > - 50 - </text> - <text - className="gradient-legend-text" - dy="-2px" - key="3" - x={132} - y={0} - > - 75 - </text> - <text - className="gradient-legend-text" - dy="-2px" - key="4" - x={176} - y={0} - > - 100 - </text> - </g> - <g - transform="translate(176, 12)" - > - <rect - fill="url(#stripes)" - height={8} - width={20} - x={4} - y={0} - /> - <text - className="gradient-legend-na" - dy="-2px" - x={14} - y={0} - > - N/A - </text> - </g> -</svg> -`; diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap b/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap deleted file mode 100644 index f85bb20e41e..00000000000 --- a/server/sonar-web/src/main/js/components/charts/__tests__/__snapshots__/DonutChart-test.tsx.snap +++ /dev/null @@ -1,122 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<svg - className="donut-chart" - height={20} - width={20} -> - <g - transform="translate(0, 0)" - > - <g - transform="translate(10, 10)" - > - <Sector - data={ - { - "data": { - "fill": "#000000", - "value": 25, - }, - "endAngle": 1.5707963267948968, - "index": 0, - "padAngle": 0, - "startAngle": 0, - "value": 25, - } - } - fill="#000000" - key="0" - radius={10} - thickness={2} - /> - <Sector - data={ - { - "data": { - "fill": "#ffffff", - "value": 75, - }, - "endAngle": 6.283185307179586, - "index": 1, - "padAngle": 0, - "startAngle": 1.5707963267948968, - "value": 75, - } - } - fill="#ffffff" - key="1" - radius={10} - thickness={2} - /> - </g> - </g> -</svg> -`; - -exports[`should render correctly 2`] = ` -<path - d="M0,-10A10,10,0,0,1,10,0L8,0A8,8,0,0,0,0,-8Z" - style={ - { - "fill": "#000000", - } - } -/> -`; - -exports[`should render correctly with padding and pad angle too 1`] = ` -<svg - className="donut-chart" - height={20} - width={20} -> - <g - transform="translate(2, 2)" - > - <g - transform="translate(8, 8)" - > - <Sector - data={ - { - "data": { - "fill": "#000000", - "value": 25, - }, - "endAngle": 1.6207963267948966, - "index": 0, - "padAngle": 0.1, - "startAngle": 0, - "value": 25, - } - } - fill="#000000" - key="0" - radius={8} - thickness={2} - /> - <Sector - data={ - { - "data": { - "fill": "#ffffff", - "value": 75, - }, - "endAngle": 6.283185307179585, - "index": 1, - "padAngle": 0.1, - "startAngle": 1.6207963267948966, - "value": 75, - } - } - fill="#ffffff" - key="1" - radius={8} - thickness={2} - /> - </g> - </g> -</svg> -`; diff --git a/server/sonar-web/src/main/js/components/common/DocumentationLink.tsx b/server/sonar-web/src/main/js/components/common/DocumentationLink.tsx deleted file mode 100644 index ae066847439..00000000000 --- a/server/sonar-web/src/main/js/components/common/DocumentationLink.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { Link, LinkProps } from 'design-system'; -import * as React from 'react'; -import { useDocUrl } from '../../helpers/docs'; - -type Props = Omit<LinkProps, 'to'> & { to: string; innerRef?: React.Ref<HTMLAnchorElement> }; - -export default function DocumentationLink({ to, innerRef, ...props }: Props) { - const toStatic = useDocUrl(to); - return <Link ref={innerRef} to={toStatic} target="_blank" {...props} />; -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx deleted file mode 100644 index d8d9f98db7e..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import CodeSnippet, { CodeSnippetProps } from '../CodeSnippet'; - -beforeEach(jest.clearAllMocks); - -it('renders correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ noCopy: true })).toMatchSnapshot('no copy'); - expect(shallowRender({ snippet: ['foo', 'bar'] })).toMatchSnapshot('array snippet'); - expect(shallowRender({ isOneLine: true, snippet: ['foo', 'bar'] })).toMatchSnapshot( - 'single line with array snippet', - ); -}); - -function shallowRender(props: Partial<CodeSnippetProps> = {}) { - return shallow<CodeSnippetProps>(<CodeSnippet snippet={'foo\nbar'} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx deleted file mode 100644 index 100f8379354..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import DisableableSelectOption, { DisableableSelectOptionProps } from '../DisableableSelectOption'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ option: { value: 'baz' } })).toMatchSnapshot('no label'); - expect( - shallowRender({ option: { label: 'Bar', value: 'bar', isDisabled: true } }), - ).toMatchSnapshot('disabled'); - expect( - shallowRender({ - option: { label: 'Bar', value: 'bar', isDisabled: true }, - disabledReason: 'bar baz', - }), - ).toMatchSnapshot('disabled, with explanation'); -}); - -function shallowRender(props: Partial<DisableableSelectOptionProps> = {}) { - return shallow<DisableableSelectOptionProps>( - <DisableableSelectOption - option={{ label: 'Foo', value: 'foo' }} - disableTooltipOverlay={() => 'foo bar'} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx deleted file mode 100644 index b223dc80b15..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/InstanceMessage-test.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { getInstance } from '../../../helpers/system'; -import InstanceMessage from '../InstanceMessage'; - -jest.mock('../../../helpers/system', () => ({ getInstance: jest.fn() })); - -it('should replace {instance} with "SonarQube"', () => { - const childFunc = jest.fn(); - shallowRender(childFunc, 'foo {instance} bar'); - expect(childFunc).toHaveBeenCalledWith('foo SonarQube bar'); -}); - -it('should replace {instance} with "SonarCloud"', () => { - const childFunc = jest.fn(); - shallowRender(childFunc, 'foo {instance} bar', true); - expect(childFunc).toHaveBeenCalledWith('foo SonarCloud bar'); -}); - -it('should return the same message', () => { - const childFunc = jest.fn(); - shallowRender(childFunc, 'no instance to replace'); - expect(childFunc).toHaveBeenCalledWith('no instance to replace'); -}); - -function shallowRender( - children: (msg: string) => React.ReactChild, - message: string, - onSonarCloud = false, -) { - (getInstance as jest.Mock).mockImplementation(() => (onSonarCloud ? 'SonarCloud' : 'SonarQube')); - return shallow(<InstanceMessage message={message}>{children}</InstanceMessage>); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx deleted file mode 100644 index 5365faa7256..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/MeasuresLink-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockMainBranch } from '../../../helpers/mocks/branch-like'; -import MeasuresLink, { MeasuresLinkProps } from '../MeasuresLink'; - -it('renders', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ label: 'Foo' })).toMatchSnapshot(); - expect(shallowRender({ branchLike: mockMainBranch() })).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<MeasuresLinkProps> = {}) { - return shallow(<MeasuresLink component="foo" metric="security_rating" {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx deleted file mode 100644 index 69275013760..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/PageCounter-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import PageCounter, { PageCounterProps } from '../PageCounter'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<PageCounterProps> = {}) { - return shallow<PageCounterProps>( - <PageCounter label="label" current={123} total={1234} {...props} />, - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx deleted file mode 100644 index 914e7b3f512..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { ComponentQualifier, Visibility } from '../../../types/component'; -import PrivacyBadge from '../PrivacyBadgeContainer'; - -it('renders', () => { - expect(getWrapper()).toMatchSnapshot(); -}); - -it('should render public', () => { - expect(getWrapper({ visibility: Visibility.Public })).toMatchSnapshot(); -}); - -function getWrapper(props = {}) { - return shallow( - <PrivacyBadge - qualifier={ComponentQualifier.Project} - visibility={Visibility.Private} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx deleted file mode 100644 index 456fd04a47d..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/ProjectKeyInput-test.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import ValidationInput from '../../../components/controls/ValidationInput'; -import ProjectKeyInput, { ProjectKeyInputProps } from '../ProjectKeyInput'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ projectKey: 'foo' })).toMatchSnapshot('with value'); - expect( - shallowRender({ help: 'foo.help', label: 'foo.label', placeholder: 'foo.placeholder' }), - ).toMatchSnapshot('with label, help, and placeholder'); - expect(shallowRender({ touched: true })).toMatchSnapshot('valid'); - expect(shallowRender({ touched: true, error: 'bar.baz' })).toMatchSnapshot('invalid'); - expect(shallowRender({ touched: true, validating: true })).toMatchSnapshot('validating'); - expect(shallowRender({ autofocus: true })).toMatchSnapshot('autofocus'); -}); - -it('should not display any status when the key is not defined', () => { - const wrapper = shallowRender(); - const input = wrapper.find(ValidationInput); - expect(input.props().isInvalid).toBe(false); - expect(input.props().isValid).toBe(false); -}); - -function shallowRender(props: Partial<ProjectKeyInputProps> = {}) { - return shallow<ProjectKeyInputProps>( - <ProjectKeyInput onProjectKeyChange={jest.fn()} touched={false} {...props} />, - ); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx deleted file mode 100644 index 8e86f5a1d4a..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx +++ /dev/null @@ -1,109 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { changePassword } from '../../../api/users'; -import { mockLoggedInUser } from '../../../helpers/testMocks'; -import { mockEvent, waitAndUpdate } from '../../../helpers/testUtils'; -import { ChangePasswordResults } from '../../../types/users'; -import { Alert } from '../../ui/Alert'; -import ResetPasswordForm from '../ResetPasswordForm'; - -jest.mock('../../../api/users', () => ({ - changePassword: jest.fn().mockResolvedValue({}), -})); - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should trigger on password change prop', () => { - const onPasswordChange = jest.fn(); - const wrapper = shallowRender({ onPasswordChange }); - wrapper.instance().handleSuccessfulChange(); - expect(onPasswordChange).not.toHaveBeenCalled(); - wrapper.instance().oldPassword = { value: '' } as HTMLInputElement; - wrapper.instance().password = { value: '' } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: '' } as HTMLInputElement; - wrapper.instance().handleSuccessfulChange(); - expect(onPasswordChange).toHaveBeenCalled(); -}); - -it('should not trigger password change', () => { - const wrapper = shallowRender(); - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test', focus: () => {} } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test1' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - expect(changePassword).not.toHaveBeenCalled(); - expect(wrapper.state().errors).toBeDefined(); -}); - -it('should not change password if new password is same as old', async () => { - jest.mocked(changePassword).mockRejectedValueOnce(ChangePasswordResults.NewPasswordSameAsOld); - - const wrapper = shallowRender(); - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test', focus: () => {} } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - expect(wrapper.find(Alert)).toMatchSnapshot(); -}); - -it('should not change password if old password is incorrect', async () => { - jest.mocked(changePassword).mockRejectedValueOnce(ChangePasswordResults.OldPasswordIncorrect); - - const wrapper = shallowRender(); - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test', focus: () => {} } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - expect(wrapper.find(Alert)).toMatchSnapshot(); -}); - -it('should trigger password change', async () => { - const user = mockLoggedInUser(); - const wrapper = shallowRender({ user }); - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - expect(changePassword).not.toHaveBeenCalled(); - - wrapper.instance().oldPassword = { value: 'testold' } as HTMLInputElement; - wrapper.instance().password = { value: 'test' } as HTMLInputElement; - wrapper.instance().passwordConfirmation = { value: 'test' } as HTMLInputElement; - wrapper.instance().handleChangePassword(mockEvent()); - await waitAndUpdate(wrapper); - - expect(changePassword).toHaveBeenCalledWith({ - login: user.login, - password: 'test', - previousPassword: 'testold', - }); -}); - -it('renders correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -function shallowRender(props?: Partial<ResetPasswordForm['props']>) { - return shallow<ResetPasswordForm>(<ResetPasswordForm user={mockLoggedInUser()} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx deleted file mode 100644 index e0d0c513630..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/RestartButton-test.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import RestartButton from '../RestartButton'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<RestartButton['props']> = {}) { - return shallow(<RestartButton fetchSystemStatus={jest.fn()} systemStatus="UP" {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx deleted file mode 100644 index e17fc5d92ce..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/SatusIndicator-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import StatusIndicator, { StatusIndicatorProps } from '../StatusIndicator'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ color: 'green' })).toMatchSnapshot('green'); - expect(shallowRender({ size: 'small' })).toMatchSnapshot('small'); - expect(shallowRender({ size: 'big' })).toMatchSnapshot('big'); -}); - -function shallowRender(props: Partial<StatusIndicatorProps> = {}) { - return shallow<StatusIndicatorProps>(<StatusIndicator className="my-class" {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap deleted file mode 100644 index 86f625595c1..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/CodeSnippet-test.tsx.snap +++ /dev/null @@ -1,67 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders correctly: array snippet 1`] = ` -<div - className="code-snippet spacer-top spacer-bottom display-flex-row" -> - <pre - className="flex-1" - tabIndex={0} - > - foo \\ - bar - </pre> - <ClipboardButton - copyValue="foo \\ - bar" - /> -</div> -`; - -exports[`renders correctly: default 1`] = ` -<div - className="code-snippet spacer-top spacer-bottom display-flex-row" -> - <pre - className="flex-1" - tabIndex={0} - > - foo -bar - </pre> - <ClipboardButton - copyValue="foo -bar" - /> -</div> -`; - -exports[`renders correctly: no copy 1`] = ` -<div - className="code-snippet spacer-top spacer-bottom display-flex-row" -> - <pre - className="flex-1" - tabIndex={0} - > - foo -bar - </pre> -</div> -`; - -exports[`renders correctly: single line with array snippet 1`] = ` -<div - className="code-snippet spacer-top spacer-bottom display-flex-row" -> - <pre - className="flex-1" - tabIndex={0} - > - foo bar - </pre> - <ClipboardButton - copyValue="foo bar" - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap deleted file mode 100644 index 5ed0c2ae05a..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DisableableSelectOption-test.tsx.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` -<span> - Foo -</span> -`; - -exports[`should render correctly: disabled 1`] = ` -<Tooltip - overlay="foo bar" - placement="left" -> - <span> - Bar - </span> -</Tooltip> -`; - -exports[`should render correctly: disabled, with explanation 1`] = ` -<Tooltip - overlay="foo bar" - placement="left" -> - <span> - Bar - <em - className="small little-spacer-left" - > - ( - bar baz - ) - </em> - </span> -</Tooltip> -`; - -exports[`should render correctly: no label 1`] = ` -<span> - baz -</span> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap deleted file mode 100644 index 80ac25cbe87..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap +++ /dev/null @@ -1,61 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` -<ForwardRef(Link) - className="measures-link" - to={ - { - "pathname": "/component_measures", - "search": "?id=foo&metric=security_rating", - } - } -> - <MeasuresIcon - className="little-spacer-right" - size={14} - /> - <span> - portfolio.measures_link - </span> -</ForwardRef(Link)> -`; - -exports[`renders 2`] = ` -<ForwardRef(Link) - className="measures-link" - to={ - { - "pathname": "/component_measures", - "search": "?id=foo&metric=security_rating", - } - } -> - <MeasuresIcon - className="little-spacer-right" - size={14} - /> - <span> - Foo - </span> -</ForwardRef(Link)> -`; - -exports[`renders 3`] = ` -<ForwardRef(Link) - className="measures-link" - to={ - { - "pathname": "/component_measures", - "search": "?id=foo&metric=security_rating", - } - } -> - <MeasuresIcon - className="little-spacer-right" - size={14} - /> - <span> - portfolio.measures_link - </span> -</ForwardRef(Link)> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap deleted file mode 100644 index a36f29997fd..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PageCounter-test.tsx.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div> - <strong - className="sw-mr-1" - > - 124 / - <span - className="it__page-counter-total" - > - 1,234 - </span> - </strong> - label -</div> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap deleted file mode 100644 index 4bbe4a4a09a..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` -<Tooltip - overlay="visibility.private.description.TRK" -> - <div - className="badge" - > - visibility.private - </div> -</Tooltip> -`; - -exports[`should render public 1`] = ` -<Tooltip - overlay="visibility.public.description.TRK" -> - <div - className="badge" - > - visibility.public - </div> -</Tooltip> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap deleted file mode 100644 index d8e65b043ed..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ProjectKeyInput-test.tsx.snap +++ /dev/null @@ -1,154 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: autofocus 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - isInvalid={false} - isValid={false} - labelHtmlFor="project-key" - required={false} -> - <input - autoFocus={true} - className="input-super-large" - id="project-key" - maxLength={400} - minLength={1} - onChange={[MockFunction]} - type="text" - /> -</ValidationInput> -`; - -exports[`should render correctly: default 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - isInvalid={false} - isValid={false} - labelHtmlFor="project-key" - required={false} -> - <input - autoFocus={false} - className="input-super-large" - id="project-key" - maxLength={400} - minLength={1} - onChange={[MockFunction]} - type="text" - /> -</ValidationInput> -`; - -exports[`should render correctly: invalid 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - error="bar.baz" - isInvalid={true} - isValid={false} - labelHtmlFor="project-key" - required={false} -> - <input - autoFocus={false} - className="input-super-large is-invalid" - id="project-key" - maxLength={400} - minLength={1} - onChange={[MockFunction]} - type="text" - /> -</ValidationInput> -`; - -exports[`should render correctly: valid 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - isInvalid={false} - isValid={true} - labelHtmlFor="project-key" - required={false} -> - <input - autoFocus={false} - className="input-super-large is-valid" - id="project-key" - maxLength={400} - minLength={1} - onChange={[MockFunction]} - type="text" - /> -</ValidationInput> -`; - -exports[`should render correctly: validating 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - isInvalid={false} - isValid={false} - labelHtmlFor="project-key" - required={false} -> - <input - autoFocus={false} - className="input-super-large" - id="project-key" - maxLength={400} - minLength={1} - onChange={[MockFunction]} - type="text" - /> -</ValidationInput> -`; - -exports[`should render correctly: with label, help, and placeholder 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - help="foo.help" - isInvalid={false} - isValid={false} - label="foo.label" - labelHtmlFor="project-key" - required={true} -> - <input - autoFocus={false} - className="input-super-large" - id="project-key" - maxLength={400} - minLength={1} - name="foo.label" - onChange={[MockFunction]} - placeholder="foo.placeholder" - type="text" - /> -</ValidationInput> -`; - -exports[`should render correctly: with value 1`] = ` -<ValidationInput - className="form-field" - description="onboarding.create_project.project_key.description" - isInvalid={false} - isValid={false} - labelHtmlFor="project-key" - required={false} -> - <input - autoFocus={false} - className="input-super-large" - id="project-key" - maxLength={400} - minLength={1} - onChange={[MockFunction]} - type="text" - value="foo" - /> -</ValidationInput> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap deleted file mode 100644 index 120f08f447f..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ResetPasswordForm-test.tsx.snap +++ /dev/null @@ -1,89 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders correctly 1`] = ` -<form - onSubmit={[Function]} -> - <MandatoryFieldsExplanation - className="form-field" - /> - <div - className="form-field" - > - <label - htmlFor="old_password" - > - my_profile.password.old - <MandatoryFieldMarker /> - </label> - <input - autoComplete="off" - id="old_password" - name="old_password" - required={true} - type="password" - /> - </div> - <div - className="form-field" - > - <label - htmlFor="password" - > - my_profile.password.new - <MandatoryFieldMarker /> - </label> - <input - autoComplete="off" - id="password" - name="password" - required={true} - type="password" - /> - </div> - <div - className="form-field" - > - <label - htmlFor="password_confirmation" - > - my_profile.password.confirm - <MandatoryFieldMarker /> - </label> - <input - autoComplete="off" - id="password_confirmation" - name="password_confirmation" - required={true} - type="password" - /> - </div> - <div - className="form-field" - > - <SubmitButton - id="change-password" - > - update_verb - </SubmitButton> - </div> -</form> -`; - -exports[`should not change password if new password is same as old 1`] = ` -<Alert - key="user.new_password_same_as_old" - variant="error" -> - user.new_password_same_as_old -</Alert> -`; - -exports[`should not change password if old password is incorrect 1`] = ` -<Alert - key="user.old_password_incorrect" - variant="error" -> - user.old_password_incorrect -</Alert> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap deleted file mode 100644 index 4d612a7bcff..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/RestartButton-test.tsx.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<ConfirmButton - confirmButtonText="restart" - modalBody={ - <React.Fragment> - <p - className="spacer-top spacer-bottom" - > - system.are_you_sure_to_restart - </p> - <p - className="spacer-bottom" - > - system.forcing_shutdown_not_recommended - </p> - <p> - system.restart_does_not_reload_sonar_properties - </p> - </React.Fragment> - } - modalHeader="system.restart_server" - onConfirm={[Function]} -> - <Component /> -</ConfirmButton> -`; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap deleted file mode 100644 index e2fc7608203..00000000000 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/SatusIndicator-test.tsx.snap +++ /dev/null @@ -1,34 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: big 1`] = ` -<Fragment> - <i - className="spacer-left status-indicator big-status-indicator my-class" - /> -</Fragment> -`; - -exports[`should render correctly: default 1`] = ` -<Fragment> - <i - className="spacer-left status-indicator my-class" - /> -</Fragment> -`; - -exports[`should render correctly: green 1`] = ` -<Fragment> - system.current_health.green - <i - className="spacer-left status-indicator green my-class" - /> -</Fragment> -`; - -exports[`should render correctly: small 1`] = ` -<Fragment> - <i - className="spacer-left status-indicator small-status-indicator my-class" - /> -</Fragment> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx deleted file mode 100644 index d72ae50bf91..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { PopupPlacement } from '../../ui/popups'; -import ActionsDropdown, { - ActionsDropdownDivider, - ActionsDropdownItem, - ActionsDropdownProps, -} from '../ActionsDropdown'; -import { ButtonPlain } from '../buttons'; - -describe('ActionsDropdown', () => { - it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ small: false })).toMatchSnapshot(); - }); - - function shallowRender(props: Partial<ActionsDropdownProps> = {}) { - return shallow( - <ActionsDropdown - className="foo" - onOpen={jest.fn()} - overlayPlacement={PopupPlacement.Bottom} - small - toggleClassName="bar" - {...props} - > - <span>Hello world</span> - </ActionsDropdown>, - ); - } -}); - -describe('ActionsDropdownItem', () => { - it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ destructive: true, id: 'baz', to: 'path/name' })).toMatchSnapshot(); - expect(shallowRender({ download: 'foo/bar', to: 'path/name' })).toMatchSnapshot(); - }); - - it('should trigger click', () => { - const onClick = jest.fn(); - const wrapper = shallowRender({ onClick }); - - click(wrapper.find(ButtonPlain)); - expect(onClick).toHaveBeenCalled(); - }); - - function shallowRender(props: Partial<ActionsDropdownItem['props']> = {}) { - return shallow(renderContent(props)); - } - - function renderContent(props: Partial<ActionsDropdownItem['props']> = {}) { - return ( - <ActionsDropdownItem className="foo" {...props}> - <span>Hello world</span> - </ActionsDropdownItem> - ); - } -}); - -describe('ActionsDropdownDivider', () => { - it('should render correctly', () => { - expect(shallow(<ActionsDropdownDivider />)).toMatchSnapshot(); - }); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx deleted file mode 100644 index 56e7b3dd7c4..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/BackButton-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import BackButton from '../BackButton'; - -it('should render properly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -it('should handle click', () => { - const onClick = jest.fn(); - const wrapper = shallowRender({ onClick }); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find('a')); - expect(onClick).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial<BackButton['props']> = {}) { - return shallow<BackButton>(<BackButton onClick={jest.fn()} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx deleted file mode 100644 index ecb9d46f15a..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import BoxedTabs, { BoxedTabsProps } from '../BoxedTabs'; - -it('should render correctly', () => { - expect(mountRender()).toMatchSnapshot(); -}); - -it('should call onSelect when a tab is clicked', () => { - const onSelect = jest.fn(); - const wrapper = shallowRender({ onSelect }); - - wrapper.find('Styled(button)').get(1).props.onClick(); - - expect(onSelect).toHaveBeenCalledWith('b'); -}); - -function shallowRender(overrides: Partial<BoxedTabsProps<string>> = {}) { - return shallow(dom(overrides)); -} - -function mountRender(overrides: Partial<BoxedTabsProps<string>> = {}) { - return mount(dom(overrides)); -} - -function dom(overrides: Partial<BoxedTabsProps<string>>) { - return ( - <BoxedTabs - className="boxed-tabs" - onSelect={jest.fn()} - selected="a" - tabs={[ - { key: 'a', label: 'labela' }, - { key: 'b', label: 'labelb' }, - { - key: 'c', - label: ( - <span> - Complex label <strong>!!!</strong> - </span> - ), - }, - ]} - {...overrides} - /> - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx deleted file mode 100644 index 9ecb24b98a5..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ClickEventBoundary-test.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount } from 'enzyme'; -import * as React from 'react'; -import ClickEventBoundary from '../ClickEventBoundary'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should correctly capture a click event', () => { - const parentOnClick = jest.fn(); - const childOnClick = jest.fn(); - const wrapper = shallowRender({ onClick: parentOnClick }, { onClick: childOnClick }); - // Don't use our click() helper, so we make sure the bubbling works correctly. - wrapper.find('button').simulate('click'); - expect(childOnClick).toHaveBeenCalled(); - expect(parentOnClick).not.toHaveBeenCalled(); -}); - -function shallowRender(parentProps = {}, childProps = {}) { - // We need to mount in order to support event bubbling. - return mount( - <div {...parentProps}> - <ClickEventBoundary> - <button type="button" {...childProps}> - Click me - </button> - </ClickEventBoundary> - </div>, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx deleted file mode 100644 index a2d1a96be4c..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/DateInput-test.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { addDays, subDays } from 'date-fns'; -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { DayPicker } from 'react-day-picker'; -import { parseDate } from '../../../helpers/dates'; -import DateInput from '../DateInput'; - -beforeAll(() => { - Date.prototype.getFullYear = jest.fn().mockReturnValue(2018); // eslint-disable-line no-extend-native -}); - -const dateA = parseDate('2018-01-17T00:00:00.000Z'); -const dateB = parseDate('2018-02-05T00:00:00.000Z'); - -it('should render', () => { - const { wrapper } = shallowRender(); - - expect(wrapper).toMatchSnapshot(); - - wrapper.setProps({ value: dateA }); - expect(wrapper).toMatchSnapshot(); - - wrapper.setState({ open: true }); - expect(wrapper).toMatchSnapshot(); -}); - -it('should select a day', () => { - const onChange = jest.fn(); - const { wrapper, instance } = shallowRender({ onChange }); - wrapper.setState({ open: true }); - - instance.handleDayClick(dateA, { disabled: true }); - expect(onChange).not.toHaveBeenCalled(); - expect(wrapper.state().open).toBe(true); - - instance.handleDayClick(dateA, {}); - expect(onChange).toHaveBeenLastCalledWith(dateA); - wrapper.update(); - expect(wrapper.state().open).toBe(false); - expect(wrapper).toMatchSnapshot(); - - instance.handleResetClick(); - expect(onChange).toHaveBeenLastCalledWith(undefined); -}); - -it('should hightlightFrom range', () => { - const { wrapper, instance } = shallowRender({ highlightFrom: dateA }); - wrapper.setState({ open: true }); - - const dateC = addDays(dateA, 3); - instance.handleDayMouseEnter(dateC, {}); - wrapper.update(); - const dayPicker = wrapper.find(DayPicker); - expect(dayPicker.props().modifiers).toEqual({ highlighted: { from: dateA, to: dateC } }); -}); - -it('should hightlightTo range', () => { - const { wrapper, instance } = shallowRender({ highlightTo: dateB }); - wrapper.setState({ open: true }); - - const dateC = subDays(dateB, 5); - instance.handleDayMouseEnter(dateC, {}); - wrapper.update(); - const dayPicker = wrapper.find(DayPicker); - expect(dayPicker.props().modifiers).toEqual({ highlighted: { from: dateC, to: dateB } }); -}); - -function shallowRender(props?: Partial<DateInput['props']>) { - const wrapper = shallow<DateInput>( - <DateInput - currentMonth={dateA} - // pass `maxDate` and `minDate` to avoid differences in snapshots - maxDate={dateB} - minDate={dateA} - onChange={jest.fn()} - placeholder="placeholder" - {...props} - />, - ); - const instance = wrapper.instance(); - return { wrapper, instance }; -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx deleted file mode 100644 index 160a01fdcae..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/DateRangeInput-test.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { parseDate } from '../../../helpers/dates'; -import DateRangeInput from '../DateRangeInput'; - -const dateA = parseDate('2018-01-17T00:00:00.000Z'); -const dateB = parseDate('2018-02-05T00:00:00.000Z'); - -it('should render', () => { - expect( - shallow(<DateRangeInput onChange={jest.fn()} value={{ from: dateA, to: dateB }} />), - ).toMatchSnapshot(); - - expect( - shallow(<DateRangeInput onChange={jest.fn()} minDate={dateA} maxDate={dateB} />), - ).toMatchSnapshot('with min/max'); - - expect( - shallow( - <DateRangeInput - onChange={jest.fn()} - minDate={dateA} - maxDate={dateB} - value={{ from: dateA, to: dateB }} - />, - ), - ).toMatchSnapshot('with min/max and value'); -}); - -it('should change', () => { - const onChange = jest.fn(); - const wrapper = shallow(<DateRangeInput onChange={onChange} />); - - wrapper.find('DateInput[data-test="from"]').prop<Function>('onChange')(dateA); - expect(onChange).toHaveBeenLastCalledWith({ from: dateA, to: undefined }); - wrapper.setProps({ value: { from: dateA } }); - - wrapper.find('DateInput[data-test="to"]').prop<Function>('onChange')(dateB); - wrapper.update(); - expect(onChange).toHaveBeenLastCalledWith({ from: dateA, to: dateB }); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx deleted file mode 100644 index d8fc4295858..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/Dropdown-test.tsx +++ /dev/null @@ -1,113 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 jest/expect-expect */ - -import { mount, shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { Popup, PopupPlacement } from '../../ui/popups'; -import { Button } from '../buttons'; -import Dropdown, { DropdownOverlay } from '../Dropdown'; -import ScreenPositionFixer from '../ScreenPositionFixer'; - -describe('Dropdown', () => { - it('renders', () => { - expect( - shallow(<Dropdown overlay={<div id="overlay" />}>{() => <div />}</Dropdown>) - .find('div') - .exists(), - ).toBe(true); - }); - - it('toggles with element child', () => { - checkToggle( - shallow( - <Dropdown overlay={<div id="overlay" />}> - <Button /> - </Dropdown>, - ), - ); - - checkToggle( - shallow( - <Dropdown overlay={<div id="overlay" />}> - <a href="#">click me!</a> - </Dropdown>, - ), - 'a', - ); - }); - - it('toggles with render prop', () => { - checkToggle( - shallow( - <Dropdown overlay={<div id="overlay" />}> - {({ onToggleClick }) => <Button onClick={onToggleClick} />} - </Dropdown>, - ), - ); - }); - - it('should call onOpen', () => { - const onOpen = jest.fn(); - const wrapper = mount( - <Dropdown onOpen={onOpen} overlay={<div id="overlay" />}> - <Button /> - </Dropdown>, - ); - expect(onOpen).not.toHaveBeenCalled(); - click(wrapper.find('Button')); - expect(onOpen).toHaveBeenCalled(); - }); - - function checkToggle(wrapper: ShallowWrapper, selector = 'Button') { - expect(wrapper.state()).toEqual({ open: false }); - - click(wrapper.find(selector)); - expect(wrapper.state()).toEqual({ open: true }); - - click(wrapper.find(selector)); - expect(wrapper.state()).toEqual({ open: false }); - } -}); - -describe('DropdownOverlay', () => { - it('should render overlay with screen fixer', () => { - const wrapper = shallow( - <DropdownOverlay> - <div /> - </DropdownOverlay>, - // disable ScreenPositionFixer positioning - { disableLifecycleMethods: true }, - ); - - expect(wrapper.is(ScreenPositionFixer)).toBe(true); - expect(wrapper.dive().is(Popup)).toBe(true); - }); - - it('should render overlay without screen fixer', () => { - const wrapper = shallow( - <DropdownOverlay placement={PopupPlacement.BottomRight}> - <div /> - </DropdownOverlay>, - ); - expect(wrapper.is('Popup')).toBe(true); - }); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/HelpTooltip-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/HelpTooltip-test.tsx deleted file mode 100644 index 9a55c01f64f..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/HelpTooltip-test.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import HelpTooltip, { DarkHelpTooltip } from '../HelpTooltip'; - -it('should render properly', () => { - const wrapper = shallow(<HelpTooltip overlay={<div className="my-overlay" />} />); - expect(wrapper).toMatchSnapshot('default'); -}); - -it('should render dark helptooltip properly', () => { - const wrapper = shallow(<DarkHelpTooltip overlay={<div className="my-overlay" />} size={14} />); - expect(wrapper).toMatchSnapshot('dark'); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx deleted file mode 100644 index ddc7e15e003..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import IdentityProviderLink from '../IdentityProviderLink'; - -const identityProvider = { - backgroundColor: '#000', - iconPath: '/some/path', - key: 'foo', - name: 'Foo', -}; - -it('should render correctly', () => { - expect( - shallow( - <IdentityProviderLink - backgroundColor={identityProvider.backgroundColor} - iconPath={identityProvider.iconPath} - name={identityProvider.name} - url="/url/foo/bar" - > - Link text - </IdentityProviderLink>, - ), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/InputValidationField-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/InputValidationField-test.tsx deleted file mode 100644 index 097ff2b9495..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/InputValidationField-test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import InputValidationField from '../InputValidationField'; - -it('should render correctly', () => { - expect(getWrapper()).toMatchSnapshot(); -}); - -function getWrapper(props = {}) { - return shallow( - <InputValidationField - description="Field description" - dirty - disabled={false} - error="Bad formatting" - label="Foo field" - name="field" - onBlur={jest.fn()} - onChange={jest.fn()} - touched - value="foo" - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx deleted file mode 100644 index a7112724695..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import ModalValidationField from '../ModalValidationField'; - -it('should display the field without any error/validation', () => { - expect(getWrapper({ description: 'Describe Foo.', touched: false })).toMatchSnapshot(); - expect(getWrapper({ dirty: false })).toMatchSnapshot(); -}); - -it('should display the field as valid', () => { - expect(getWrapper({ error: undefined })).toMatchSnapshot(); -}); - -it('should display the field with an error', () => { - expect(getWrapper()).toMatchSnapshot(); -}); - -function getWrapper(props = {}) { - return shallow( - <ModalValidationField - dirty - error="Is required" - // eslint-disable-next-line jsx-a11y/label-has-associated-control - label={<label>Foo</label>} - touched - {...props} - > - {({ className }) => <input className={className} type="text" />} - </ModalValidationField>, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx deleted file mode 100644 index cf501229767..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/Radio-test.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import Radio from '../Radio'; - -it('should render properly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot('not checked'); - - wrapper.setProps({ checked: true }); - expect(wrapper).toMatchSnapshot('checked'); -}); - -it('should invoke callback on click', () => { - const onCheck = jest.fn(); - const value = 'value'; - const wrapper = shallowRender({ onCheck, value }); - - click(wrapper); - expect(onCheck).toHaveBeenCalled(); -}); - -it('should not invoke callback on click when disabled', () => { - const onCheck = jest.fn(); - const wrapper = shallowRender({ disabled: true, onCheck }); - - click(wrapper); - expect(onCheck).not.toHaveBeenCalled(); -}); - -function shallowRender(props?: Partial<Radio['props']>) { - return shallow<Radio>(<Radio checked={false} onCheck={jest.fn()} value="value" {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx deleted file mode 100644 index 671a62bbd80..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import RadioCard from '../RadioCard'; - -it('should render correctly', () => { - expect( - shallow( - <RadioCard recommended="Recommended for you" title="Radio Card" titleInfo="info"> - <div>content</div> - </RadioCard>, - ), - ).toMatchSnapshot(); - - expect( - shallow( - <RadioCard - recommended="Recommended for you" - title="Radio Card Vertical" - titleInfo="info" - vertical - > - <div>content</div> - </RadioCard>, - ), - ).toMatchSnapshot(); -}); - -it('should be actionable', () => { - const onClick = jest.fn(); - const wrapper = shallow( - <RadioCard onClick={onClick} title="Radio Card"> - <div>content</div> - </RadioCard>, - ); - - expect(wrapper).toMatchSnapshot(); - click(wrapper); - wrapper.setProps({ selected: false, titleInfo: 'info' }); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ReloadButton-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ReloadButton-test.tsx deleted file mode 100644 index 8bb927a29d2..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ReloadButton-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import ReloadButton from '../ReloadButton'; - -it('should render properly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -it('should handle click', () => { - const onClick = jest.fn(); - const wrapper = shallowRender({ onClick }); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find('a')); - expect(onClick).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial<ReloadButton['props']> = {}) { - return shallow<ReloadButton>(<ReloadButton onClick={jest.fn()} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx deleted file mode 100644 index 327a4f88838..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx +++ /dev/null @@ -1,94 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount } from 'enzyme'; -import * as React from 'react'; -import { resizeWindowTo, setNodeRect } from '../../../helpers/testUtils'; -import ScreenPositionFixer from '../ScreenPositionFixer'; - -jest.mock('lodash', () => { - const lodash = jest.requireActual('lodash'); - lodash.throttle = (fn: any) => () => fn(); - return lodash; -}); - -jest.mock('react-dom', () => ({ - findDOMNode: jest.fn(), -})); - -beforeEach(() => { - setNodeRect({ left: 50, top: 50 }); - resizeWindowTo(1000, 1000); -}); - -it('should fix position', () => { - const children = jest.fn(() => <div />); - mountRender({ children }); - - setNodeRect({ left: 50, top: 50 }); - resizeWindowTo(75, 1000); - expect(children).toHaveBeenLastCalledWith({ leftFix: -29, topFix: 0 }); - - resizeWindowTo(1000, 75); - expect(children).toHaveBeenLastCalledWith({ leftFix: 0, topFix: -29 }); - - setNodeRect({ left: -10, top: 50 }); - resizeWindowTo(1000, 1000); - expect(children).toHaveBeenLastCalledWith({ leftFix: 14, topFix: 0 }); - - setNodeRect({ left: 50, top: -10 }); - resizeWindowTo(); - expect(children).toHaveBeenLastCalledWith({ leftFix: 0, topFix: 14 }); -}); - -it('should render two times', () => { - const children = jest.fn(() => <div />); - mountRender({ children }); - expect(children).toHaveBeenCalledTimes(2); - expect(children).toHaveBeenCalledWith({}); - expect(children).toHaveBeenLastCalledWith({ leftFix: 0, topFix: 0 }); -}); - -it('should re-position when `ready` turns to `true`', () => { - const children = jest.fn(() => <div />); - const wrapper = mountRender({ children, ready: false }); - expect(children).toHaveBeenCalledTimes(2); - wrapper.setProps({ ready: true }); - // 2 + 1 (props change) + 1 (new measurement) - expect(children).toHaveBeenCalledTimes(4); -}); - -it('should re-position when window is resized', () => { - const children = jest.fn(() => <div />); - const wrapper = mountRender({ children }); - expect(children).toHaveBeenCalledTimes(2); - - resizeWindowTo(); - // 2 + 1 (new measurement) - expect(children).toHaveBeenCalledTimes(3); - - wrapper.unmount(); - resizeWindowTo(); - expect(children).toHaveBeenCalledTimes(3); -}); - -function mountRender(props: Partial<ScreenPositionFixer['props']>) { - // eslint-disable-next-line react/no-children-prop - return mount(<ScreenPositionFixer children={() => <div />} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/SearchBox-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/SearchBox-test.tsx deleted file mode 100644 index b1d0ce16ee4..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/SearchBox-test.tsx +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import { change, click } from '../../../helpers/testUtils'; -import SearchBox from '../SearchBox'; - -jest.mock('lodash', () => { - const lodash = jest.requireActual('lodash'); - const debounce = (fn: Function) => { - const debounced: any = (...args: any[]) => fn(...args); - debounced.cancel = jest.fn(); - return debounced; - }; - return Object.assign({}, lodash, { debounce }); -}); - -it('renders', () => { - const wrapper = shallow( - <SearchBox - maxLength={150} - minLength={2} - onChange={jest.fn()} - placeholder="placeholder" - value="foo" - />, - ); - expect(wrapper).toMatchSnapshot(); -}); - -it('warns when input is too short', () => { - const wrapper = shallow( - <SearchBox minLength={2} onChange={jest.fn()} placeholder="placeholder" value="f" />, - ); - expect(wrapper.find('.search-box-note').exists()).toBe(true); -}); - -it('shows clear button only when there is a value', () => { - const wrapper = shallow(<SearchBox onChange={jest.fn()} placeholder="placeholder" value="f" />); - expect(wrapper.find('.search-box-clear').exists()).toBe(true); - wrapper.setProps({ value: '' }); - expect(wrapper.find('.search-box-clear').exists()).toBe(false); -}); - -it('attaches ref', () => { - const ref = jest.fn(); - mount(<SearchBox innerRef={ref} onChange={jest.fn()} placeholder="placeholder" value="f" />); - expect(ref).toHaveBeenCalled(); - expect(ref.mock.calls[0][0]).toBeInstanceOf(HTMLInputElement); -}); - -it('resets', () => { - const onChange = jest.fn(); - const wrapper = shallow(<SearchBox onChange={onChange} placeholder="placeholder" value="f" />); - click(wrapper.find('.search-box-clear')); - expect(onChange).toHaveBeenCalledWith(''); -}); - -it('changes', () => { - const onChange = jest.fn(); - const wrapper = shallow(<SearchBox onChange={onChange} placeholder="placeholder" value="f" />); - change(wrapper.find('.search-box-input'), 'foo'); - expect(onChange).toHaveBeenCalledWith('foo'); -}); - -it('does not change when value is too short', () => { - const onChange = jest.fn(); - const wrapper = shallow( - <SearchBox minLength={3} onChange={onChange} placeholder="placeholder" value="" />, - ); - change(wrapper.find('.search-box-input'), 'fo'); - expect(onChange).not.toHaveBeenCalled(); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx deleted file mode 100644 index 65a589e2841..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx +++ /dev/null @@ -1,105 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { - components, - GroupBase, - InputProps, - LoadingIndicatorProps, - MultiValueRemoveProps, - Props as ReactSelectProps, -} from 'react-select'; -import { - mockReactSelectClearIndicatorProps, - mockReactSelectDropdownIndicatorProps, -} from '../../../helpers/mocks/react-select'; -import Select, { - clearIndicator, - CreatableSelect, - dropdownIndicator, - loadingIndicator, - multiValueRemove, - SearchSelect, -} from '../Select'; - -describe('Select', () => { - it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - }); - - it('should render complex select component', () => { - const inputRenderer = (props: InputProps) => ( - <components.Input {...props} className={`little-spacer-top ${props.className}`} /> - ); - - expect( - shallowRender({ - isClearable: true, - isLoading: true, - components: { - Input: inputRenderer, - }, - }), - ).toMatchSnapshot('other props'); - }); - - it('should render clearIndicator correctly', () => { - expect(clearIndicator(mockReactSelectClearIndicatorProps({ value: '' }))).toMatchSnapshot(); - }); - - it('should render dropdownIndicator correctly', () => { - expect( - dropdownIndicator(mockReactSelectDropdownIndicatorProps({ value: '' })), - ).toMatchSnapshot(); - }); - - it('should render loadingIndicator correctly', () => { - expect( - loadingIndicator({ innerProps: { className: 'additional-class' } } as LoadingIndicatorProps< - {}, - false - >), - ).toMatchSnapshot(); - }); - - it('should render multiValueRemove correctly', () => { - expect(multiValueRemove({ innerProps: {} } as MultiValueRemoveProps<{}>)).toMatchSnapshot(); - }); - - function shallowRender< - Option = unknown, - IsMulti extends boolean = boolean, - Group extends GroupBase<Option> = GroupBase<Option>, - >(props: Partial<ReactSelectProps<Option, IsMulti, Group>> = {}) { - return shallow<ReactSelectProps<Option, IsMulti, Group>>(<Select {...props} />); - } -}); - -it.each([ - ['CreatableSelect', CreatableSelect], - ['SearchSelect', SearchSelect], -])('should render %s correctly', (_name, Component) => { - expect( - shallow(<Component />) - .dive() - .dive(), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/SimpleModal-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/SimpleModal-test.tsx deleted file mode 100644 index f1a43dc7579..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/SimpleModal-test.tsx +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click, waitAndUpdate } from '../../../helpers/testUtils'; -import { Button } from '../buttons'; -import SimpleModal, { ChildrenProps } from '../SimpleModal'; - -it('renders', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('closes', () => { - const onClose = jest.fn(); - const children = ({ onCloseClick }: ChildrenProps) => ( - <Button onClick={onCloseClick}>close</Button> - ); - const wrapper = shallowRender({ children, onClose }); - click(wrapper.find('Button')); - expect(onClose).toHaveBeenCalled(); -}); - -it('submits', async () => { - const onSubmit = jest.fn(() => Promise.resolve()); - const children = ({ onSubmitClick, submitting }: ChildrenProps) => ( - <Button disabled={submitting} onClick={onSubmitClick}> - close - </Button> - ); - const wrapper = shallowRender({ children, onSubmit }); - wrapper.instance().mounted = true; - expect(wrapper).toMatchSnapshot(); - - click(wrapper.find('Button')); - expect(onSubmit).toHaveBeenCalled(); - expect(wrapper).toMatchSnapshot(); - - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender({ children = () => <div />, ...props }: Partial<SimpleModal['props']> = {}) { - return shallow<SimpleModal>( - <SimpleModal header="" onClose={jest.fn()} onSubmit={jest.fn()} {...props}> - {children} - </SimpleModal>, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Toggle-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Toggle-test.tsx deleted file mode 100644 index d61388ba170..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/Toggle-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { Button } from '../buttons'; -import Toggle from '../Toggle'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('on'); - expect(shallowRender({ value: false })).toMatchSnapshot('off'); - expect(shallowRender({ disabled: true })).toMatchSnapshot('disabled'); -}); - -it('should call onChange when clicked', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ disabled: false, onChange, value: true }); - click(wrapper.find(Button)); - expect(onChange).toHaveBeenCalledWith(false); -}); - -function shallowRender(props?: Partial<Toggle['props']>) { - return shallow(<Toggle disabled name="toggle-name" onChange={jest.fn()} value {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx deleted file mode 100644 index a98c3d43db0..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import Tooltip, { TooltipInner, TooltipProps } from '../Tooltip'; - -beforeEach(() => { - jest.clearAllMocks(); - jest.useFakeTimers(); -}); - -afterEach(() => { - jest.runOnlyPendingTimers(); - jest.useRealTimers(); -}); - -jest.mock('react-dom', () => { - const actual = jest.requireActual('react-dom'); - return Object.assign({}, actual, { - findDOMNode: jest.fn().mockReturnValue(undefined), - }); -}); - -jest.mock('lodash', () => { - const actual = jest.requireActual('lodash'); - return Object.assign({}, actual, { - uniqueId: jest.fn((prefix) => `${prefix}1`), - }); -}); - -it('should render', () => { - expect(shallowRenderTooltipInner()).toMatchSnapshot(); - expect( - shallow( - <TooltipInner overlay={<span id="overlay" />} visible> - <div id="tooltip" /> - </TooltipInner>, - { disableLifecycleMethods: true }, - ), - ).toMatchSnapshot(); -}); - -it('should open & close', () => { - const onShow = jest.fn(); - const onHide = jest.fn(); - const wrapper = shallowRenderTooltipInner({ onHide, onShow }); - - wrapper.find('#tooltip').simulate('pointerenter'); - jest.runOnlyPendingTimers(); - wrapper.update(); - expect(onShow).toHaveBeenCalled(); - - wrapper.find('#tooltip').simulate('pointerleave'); - jest.runOnlyPendingTimers(); - wrapper.update(); - expect(onHide).toHaveBeenCalled(); - - onShow.mockReset(); - onHide.mockReset(); - - wrapper.find('#tooltip').simulate('focus'); - expect(onShow).toHaveBeenCalled(); - - wrapper.find('#tooltip').simulate('blur'); - expect(onHide).toHaveBeenCalled(); -}); - -it('should not render tooltip without overlay', () => { - const wrapper = shallowRenderTooltip(); - expect(wrapper.type()).toBe('div'); -}); - -it('should not render empty tooltips', () => { - expect(shallowRenderTooltip()).toMatchSnapshot(); - expect(shallowRenderTooltip()).toMatchSnapshot(); -}); - -it('should adjust arrow position', () => { - const wrapper = shallowRenderTooltipInner(); - - expect(wrapper.instance().adjustArrowPosition('left', { leftFix: 10, topFix: 20 })).toEqual({ - marginTop: -20, - }); - expect(wrapper.instance().adjustArrowPosition('right', { leftFix: 10, topFix: 20 })).toEqual({ - marginTop: -20, - }); - expect(wrapper.instance().adjustArrowPosition('top', { leftFix: 10, topFix: 20 })).toEqual({ - marginLeft: -10, - }); - expect(wrapper.instance().adjustArrowPosition('bottom', { leftFix: 10, topFix: 20 })).toEqual({ - marginLeft: -10, - }); -}); - -function shallowRenderTooltip() { - return shallow<TooltipProps>( - <Tooltip overlay={undefined}> - <div id="tooltip" /> - </Tooltip>, - ); -} - -function shallowRenderTooltipInner(props?: Partial<TooltipProps>) { - return shallow<TooltipInner>( - <TooltipInner overlay={<span id="overlay" />} {...props}> - <div id="tooltip" /> - </TooltipInner>, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationForm-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationForm-test.tsx deleted file mode 100644 index 1e752abe3ea..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationForm-test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import ValidationForm from '../ValidationForm'; - -it('should render and submit', async () => { - const render = jest.fn(); - const onSubmit = jest.fn().mockResolvedValue(null); - const setSubmitting = jest.fn(); - const wrapper = shallow( - <ValidationForm initialValues={{ foo: 'bar' }} onSubmit={onSubmit} validate={jest.fn()}> - {render} - </ValidationForm>, - ); - expect(wrapper).toMatchSnapshot(); - wrapper.dive(); - expect(render).toHaveBeenCalledWith( - expect.objectContaining({ dirty: false, errors: {}, values: { foo: 'bar' } }), - ); - - onSubmit.mockResolvedValue(undefined).mockClear(); - setSubmitting.mockClear(); - wrapper.prop<Function>('onSubmit')({ foo: 'bar' }, { setSubmitting }); - await new Promise(setImmediate); - expect(setSubmitting).toHaveBeenCalledWith(false); -}); diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx deleted file mode 100644 index a4758e648ec..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import ValidationInput, { - ValidationInputErrorPlacement, - ValidationInputProps, -} from '../ValidationInput'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ help: 'Help message', isValid: false })).toMatchSnapshot('with help'); - expect( - shallowRender({ - description: <div>My description</div>, - error: 'Field error message', - isInvalid: true, - isValid: false, - required: false, - }), - ).toMatchSnapshot('with error'); - expect( - shallowRender({ - error: 'Field error message', - errorPlacement: ValidationInputErrorPlacement.Bottom, - isInvalid: true, - isValid: false, - }), - ).toMatchSnapshot('error under the input'); - expect(shallowRender({ labelHtmlFor: undefined, label: undefined })).toMatchSnapshot('no label'); -}); - -function shallowRender(props: Partial<ValidationInputProps> = {}) { - return shallow<ValidationInputProps>( - <ValidationInput - description="My description" - error={undefined} - labelHtmlFor="field-id" - isInvalid={false} - isValid - label="Field label" - required - {...props} - > - <div /> - </ValidationInput>, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx deleted file mode 100644 index adda3d7d334..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import ValidationForm from '../ValidationForm'; -import ValidationModal from '../ValidationModal'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find(ValidationForm).dive().dive()).toMatchSnapshot(); -}); - -it('should handle submit', async () => { - const data = { field: 'foo' }; - const onSubmit = jest.fn().mockResolvedValue({}); - const onClose = jest.fn(); - const wrapper = shallowRender({ onClose, onSubmit }); - - wrapper.instance().handleSubmit(data); - expect(onSubmit).toHaveBeenCalledWith(data); - - await waitAndUpdate(wrapper); - expect(onClose).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial<ValidationModal<{ field: string }>['props']> = {}) { - return shallow<ValidationModal<{ field: string }>>( - <ValidationModal<{ field: string }> - confirmButtonText="confirm" - header="title" - initialValues={{ field: 'foo' }} - isDestructive - onClose={jest.fn()} - onSubmit={jest.fn()} - validate={jest.fn()} - {...props} - > - {(props) => ( - <input - name="field" - onBlur={props.handleBlur} - onChange={props.handleChange} - type="text" - value={props.values.field} - /> - )} - </ValidationModal>, - ); -} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap deleted file mode 100644 index fb8eefc5af0..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap +++ /dev/null @@ -1,105 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ActionsDropdown should render correctly 1`] = ` -<Dropdown - className="foo" - onOpen={[MockFunction]} - overlay={ - <ul - className="menu" - > - <span> - Hello world - </span> - </ul> - } - overlayPlacement="bottom" -> - <Button - className="dropdown-toggle bar button-small" - > - <SettingsIcon - size={12} - /> - <DropdownIcon - className="little-spacer-left" - /> - </Button> -</Dropdown> -`; - -exports[`ActionsDropdown should render correctly 2`] = ` -<Dropdown - className="foo" - onOpen={[MockFunction]} - overlay={ - <ul - className="menu" - > - <span> - Hello world - </span> - </ul> - } - overlayPlacement="bottom" -> - <Button - className="dropdown-toggle bar" - > - <SettingsIcon - size={14} - /> - <DropdownIcon - className="little-spacer-left" - /> - </Button> -</Dropdown> -`; - -exports[`ActionsDropdownDivider should render correctly 1`] = ` -<li - className="divider" -/> -`; - -exports[`ActionsDropdownItem should render correctly 1`] = ` -<li> - <ButtonPlain - className="foo" - onClick={[Function]} - preventDefault={true} - > - <span> - Hello world - </span> - </ButtonPlain> -</li> -`; - -exports[`ActionsDropdownItem should render correctly 2`] = ` -<li> - <ForwardRef(Link) - className="foo text-danger" - id="baz" - to="path/name" - > - <span> - Hello world - </span> - </ForwardRef(Link)> -</li> -`; - -exports[`ActionsDropdownItem should render correctly 3`] = ` -<li> - <a - className="foo" - download="foo/bar" - href="path/name" - > - <span> - Hello world - </span> - </a> -</li> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap deleted file mode 100644 index 5d932f59cc1..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should handle click 1`] = ` -<Tooltip - overlay="issues.return_to_list" -> - <a - className="link-no-underline" - href="#" - onClick={[Function]} - > - <svg - aria-label="issues.return_to_list" - height="24" - viewBox="0 0 21 24" - width="21" - > - <path - d="M3.845 12.9992l5.993 5.993.052.056c.049.061.093.122.129.191.082.159.121.339.111.518-.006.102-.028.203-.064.298-.149.39-.537.652-.954.644-.102-.002-.204-.019-.301-.052-.148-.05-.273-.135-.387-.241l-8.407-8.407 8.407-8.407.056-.052c.061-.048.121-.092.19-.128.116-.06.237-.091.366-.108.076-.004.075-.004.153-.003.155.015.3.052.437.129.088.051.169.115.239.19.246.266.33.656.214.999-.051.149-.135.273-.241.387l-5.983 5.984c5.287-.044 10.577-.206 15.859.013.073.009.091.009.163.027.187.047.359.15.49.292.075.081.136.175.18.276.044.101.072.209.081.319.032.391-.175.775-.521.962-.097.052-.202.089-.311.107-.073.012-.091.01-.165.013H3.845z" - fill="#656565" - /> - </svg> - </a> -</Tooltip> -`; - -exports[`should render properly 1`] = ` -<Tooltip - overlay="issues.return_to_list" -> - <a - className="link-no-underline" - href="#" - onClick={[Function]} - > - <svg - aria-label="issues.return_to_list" - height="24" - viewBox="0 0 21 24" - width="21" - > - <path - d="M3.845 12.9992l5.993 5.993.052.056c.049.061.093.122.129.191.082.159.121.339.111.518-.006.102-.028.203-.064.298-.149.39-.537.652-.954.644-.102-.002-.204-.019-.301-.052-.148-.05-.273-.135-.387-.241l-8.407-8.407 8.407-8.407.056-.052c.061-.048.121-.092.19-.128.116-.06.237-.091.366-.108.076-.004.075-.004.153-.003.155.015.3.052.437.129.088.051.169.115.239.19.246.266.33.656.214.999-.051.149-.135.273-.241.387l-5.983 5.984c5.287-.044 10.577-.206 15.859.013.073.009.091.009.163.027.187.047.359.15.49.292.075.081.136.175.18.276.044.101.072.209.081.319.032.391-.175.775-.521.962-.097.052-.202.089-.311.107-.073.012-.091.01-.165.013H3.845z" - fill="#656565" - /> - </svg> - </a> -</Tooltip> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap deleted file mode 100644 index 804db4b4d9b..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap +++ /dev/null @@ -1,1368 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -.emotion-0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; -} - -.emotion-1 { - position: relative; - background-color: white; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - outline: 0; - padding: calc(2 * 8px); -} - -.emotion-1:last-child { - border-right: 1px solid #e6e6e6; -} - -.emotion-2 { - display: block; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -} - -.emotion-3 { - position: relative; - background-color: #f3f3f3; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - cursor: pointer; - outline: 0; - padding: calc(2 * 8px); -} - -.emotion-3:hover { - background-color: #f8f8f8; -} - -.emotion-3:last-child { - border-right: 1px solid #e6e6e6; -} - -.emotion-4 { - display: none; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -} - -<BoxedTabs - className="boxed-tabs" - onSelect={[MockFunction]} - selected="a" - tabs={ - [ - { - "key": "a", - "label": "labela", - }, - { - "key": "b", - "label": "labelb", - }, - { - "key": "c", - "label": <span> - Complex label - <strong> - !!! - </strong> - </span>, - }, - ] - } -> - <Styled(div) - className="boxed-tabs" - role="tablist" - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "o2j9ze", - "next": undefined, - "styles": " - display: flex; - flex-direction: row; -", - "toString": [Function], - } - } - /> - <div - className="boxed-tabs emotion-0" - role="tablist" - > - <Styled(button) - active={true} - aria-controls="tabpanel-a" - aria-selected={true} - id="tab-a" - key="0" - onClick={[Function]} - role="tab" - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "60rv5s", - "next": undefined, - "styles": " - position: relative; - background-color: white; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - - outline: 0; - padding: calc(2 * 8px); - - - - &:last-child { - border-right: 1px solid #e6e6e6; - } -", - "toString": [Function], - } - } - /> - <button - aria-controls="tabpanel-a" - aria-selected={true} - className="emotion-1" - id="tab-a" - onClick={[Function]} - role="tab" - > - <Styled(div) - active={true} - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "ko9asm", - "next": undefined, - "styles": " - display: block; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -", - "toString": [Function], - } - } - /> - <div - className="emotion-2" - /> - </Styled(div)> - labela - </button> - </Styled(button)> - <Styled(button) - active={false} - aria-controls="tabpanel-b" - aria-selected={false} - id="tab-b" - key="1" - onClick={[Function]} - role="tab" - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "1kg7pv0", - "next": undefined, - "styles": " - position: relative; - background-color: #f3f3f3; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - cursor: pointer; - outline: 0; - padding: calc(2 * 8px); - - - &:hover { - background-color: #f8f8f8; - } - - - &:last-child { - border-right: 1px solid #e6e6e6; - } -", - "toString": [Function], - } - } - /> - <button - aria-controls="tabpanel-b" - aria-selected={false} - className="emotion-3" - id="tab-b" - onClick={[Function]} - role="tab" - > - <Styled(div) - active={false} - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "v2seq5", - "next": undefined, - "styles": " - display: none; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -", - "toString": [Function], - } - } - /> - <div - className="emotion-4" - /> - </Styled(div)> - labelb - </button> - </Styled(button)> - <Styled(button) - active={false} - aria-controls="tabpanel-c" - aria-selected={false} - id="tab-c" - key="2" - onClick={[Function]} - role="tab" - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "1kg7pv0", - "next": undefined, - "styles": " - position: relative; - background-color: #f3f3f3; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; - border-right: none; - border-bottom: none; - margin-bottom: -1px; - min-width: 128px; - min-height: 56px; - cursor: pointer; - outline: 0; - padding: calc(2 * 8px); - - - &:hover { - background-color: #f8f8f8; - } - - - &:last-child { - border-right: 1px solid #e6e6e6; - } -", - "toString": [Function], - } - } - /> - <button - aria-controls="tabpanel-c" - aria-selected={false} - className="emotion-3" - id="tab-c" - onClick={[Function]} - role="tab" - > - <Styled(div) - active={false} - > - <Insertion - cache={ - { - "insert": [Function], - "inserted": { - "1kg7pv0": true, - "60rv5s": true, - "ko9asm": true, - "o2j9ze": true, - "v2seq5": true, - }, - "key": "css", - "nonce": undefined, - "registered": {}, - "sheet": StyleSheet { - "_alreadyInsertedOrderInsensitiveRule": true, - "_insertTag": [Function], - "before": null, - "container": <head> - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style> - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style> - </head>, - "ctr": 8, - "insertionPoint": undefined, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "prepend": undefined, - "tags": [ - <style - data-emotion="css" - data-s="" - > - - .emotion-0{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1{position:relative;background-color:white;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-1:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-2{display:block;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3{position:relative;background-color:#f3f3f3;border-top:1px solid #e6e6e6;border-left:1px solid #e6e6e6;border-right:none;border-bottom:none;margin-bottom:-1px;min-width:128px;min-height:56px;cursor:pointer;outline:0;padding:calc(2 * 8px);} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:hover{background-color:#f8f8f8;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-3:last-child{border-right:1px solid #e6e6e6;} - </style>, - <style - data-emotion="css" - data-s="" - > - - .emotion-4{display:none;background-color:#4b9fd5;height:3px;width:100%;position:absolute;left:0;top:-1px;} - </style>, - ], - }, - } - } - isStringTag={true} - serialized={ - { - "map": undefined, - "name": "v2seq5", - "next": undefined, - "styles": " - display: none; - background-color: #4b9fd5; - height: 3px; - width: 100%; - position: absolute; - left: 0; - top: -1px; -", - "toString": [Function], - } - } - /> - <div - className="emotion-4" - /> - </Styled(div)> - <span> - Complex label - <strong> - !!! - </strong> - </span> - </button> - </Styled(button)> - </div> - </Styled(div)> -</BoxedTabs> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap deleted file mode 100644 index 62eac278e7f..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap +++ /dev/null @@ -1,14 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div> - <ClickEventBoundary> - <button - onClick={[Function]} - type="button" - > - Click me - </button> - </ClickEventBoundary> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap deleted file mode 100644 index 655dd56b03a..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateInput-test.tsx.snap +++ /dev/null @@ -1,184 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<FocusOutHandler - onFocusOut={[Function]} -> - <OutsideClickHandler - onClickOutside={[Function]} - > - <EscKeydownHandler - onKeydown={[Function]} - > - <span - className="date-input-control" - > - <injectIntl(Component) - className="date-input-control-input" - innerRef={[Function]} - onFocus={[Function]} - placeholder="placeholder" - readOnly={true} - type="text" - /> - <CalendarIcon - className="date-input-control-icon" - fill="" - /> - </span> - </EscKeydownHandler> - </OutsideClickHandler> -</FocusOutHandler> -`; - -exports[`should render 2`] = ` -<FocusOutHandler - onFocusOut={[Function]} -> - <OutsideClickHandler - onClickOutside={[Function]} - > - <EscKeydownHandler - onKeydown={[Function]} - > - <span - className="date-input-control" - > - <injectIntl(Component) - className="date-input-control-input is-filled" - innerRef={[Function]} - onFocus={[Function]} - placeholder="placeholder" - readOnly={true} - type="text" - value={2018-01-17T00:00:00.000Z} - /> - <CalendarIcon - className="date-input-control-icon" - fill="" - /> - <ClearButton - aria-label="reset_date" - className="button-tiny date-input-control-reset" - iconProps={ - { - "size": 12, - } - } - onClick={[Function]} - /> - </span> - </EscKeydownHandler> - </OutsideClickHandler> -</FocusOutHandler> -`; - -exports[`should render 3`] = ` -<FocusOutHandler - onFocusOut={[Function]} -> - <OutsideClickHandler - onClickOutside={[Function]} - > - <EscKeydownHandler - onKeydown={[Function]} - > - <span - className="date-input-control" - > - <injectIntl(Component) - className="date-input-control-input is-filled" - innerRef={[Function]} - onFocus={[Function]} - placeholder="placeholder" - readOnly={true} - type="text" - value={2018-01-17T00:00:00.000Z} - /> - <CalendarIcon - className="date-input-control-icon" - fill="" - /> - <ClearButton - aria-label="reset_date" - className="button-tiny date-input-control-reset" - iconProps={ - { - "size": 12, - } - } - onClick={[Function]} - /> - <div - className="date-input-calendar" - > - <DayPicker - captionLayout="dropdown-buttons" - disabled={ - { - "after": 2018-02-05T00:00:00.000Z, - "before": 2018-01-17T00:00:00.000Z, - } - } - formatters={ - { - "formatWeekdayName": [Function], - } - } - fromYear={2018} - mode="default" - modifiers={ - { - "highlighted": false, - } - } - modifiersClassNames={ - { - "highlighted": "highlighted", - } - } - month={2018-01-17T00:00:00.000Z} - onDayClick={[Function]} - onDayMouseEnter={[Function]} - onMonthChange={[Function]} - selected={2018-01-17T00:00:00.000Z} - toYear={2018} - weekStartsOn={1} - /> - </div> - </span> - </EscKeydownHandler> - </OutsideClickHandler> -</FocusOutHandler> -`; - -exports[`should select a day 1`] = ` -<FocusOutHandler - onFocusOut={[Function]} -> - <OutsideClickHandler - onClickOutside={[Function]} - > - <EscKeydownHandler - onKeydown={[Function]} - > - <span - className="date-input-control" - > - <injectIntl(Component) - className="date-input-control-input" - innerRef={[Function]} - onFocus={[Function]} - placeholder="placeholder" - readOnly={true} - type="text" - /> - <CalendarIcon - className="date-input-control-icon" - fill="" - /> - </span> - </EscKeydownHandler> - </OutsideClickHandler> -</FocusOutHandler> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap deleted file mode 100644 index 19e4e6ab487..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/DateRangeInput-test.tsx.snap +++ /dev/null @@ -1,155 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<div - className="display-flex-end" -> - <div - className="display-flex-column" - > - <label - className="text-bold little-spacer-bottom" - htmlFor="date-from" - > - start_date - </label> - <DateInput - currentMonth={2018-02-05T00:00:00.000Z} - data-test="from" - highlightTo={2018-02-05T00:00:00.000Z} - id="date-from" - maxDate={2018-02-05T00:00:00.000Z} - onChange={[Function]} - placeholder="start_date" - value={2018-01-17T00:00:00.000Z} - /> - </div> - <span - className="note little-spacer-left little-spacer-right little-spacer-bottom" - > - to_ - </span> - <div - className="display-flex-column" - > - <label - className="text-bold little-spacer-bottom" - htmlFor="date-to" - > - end_date - </label> - <DateInput - currentMonth={2018-01-17T00:00:00.000Z} - data-test="to" - highlightFrom={2018-01-17T00:00:00.000Z} - id="date-to" - minDate={2018-01-17T00:00:00.000Z} - onChange={[Function]} - placeholder="end_date" - value={2018-02-05T00:00:00.000Z} - /> - </div> -</div> -`; - -exports[`should render: with min/max 1`] = ` -<div - className="display-flex-end" -> - <div - className="display-flex-column" - > - <label - className="text-bold little-spacer-bottom" - htmlFor="date-from" - > - start_date - </label> - <DateInput - data-test="from" - id="date-from" - maxDate={2018-02-05T00:00:00.000Z} - minDate={2018-01-17T00:00:00.000Z} - onChange={[Function]} - placeholder="start_date" - /> - </div> - <span - className="note little-spacer-left little-spacer-right little-spacer-bottom" - > - to_ - </span> - <div - className="display-flex-column" - > - <label - className="text-bold little-spacer-bottom" - htmlFor="date-to" - > - end_date - </label> - <DateInput - data-test="to" - id="date-to" - maxDate={2018-02-05T00:00:00.000Z} - minDate={2018-01-17T00:00:00.000Z} - onChange={[Function]} - placeholder="end_date" - /> - </div> -</div> -`; - -exports[`should render: with min/max and value 1`] = ` -<div - className="display-flex-end" -> - <div - className="display-flex-column" - > - <label - className="text-bold little-spacer-bottom" - htmlFor="date-from" - > - start_date - </label> - <DateInput - currentMonth={2018-02-05T00:00:00.000Z} - data-test="from" - highlightTo={2018-02-05T00:00:00.000Z} - id="date-from" - maxDate={2018-02-05T00:00:00.000Z} - minDate={2018-01-17T00:00:00.000Z} - onChange={[Function]} - placeholder="start_date" - value={2018-01-17T00:00:00.000Z} - /> - </div> - <span - className="note little-spacer-left little-spacer-right little-spacer-bottom" - > - to_ - </span> - <div - className="display-flex-column" - > - <label - className="text-bold little-spacer-bottom" - htmlFor="date-to" - > - end_date - </label> - <DateInput - currentMonth={2018-01-17T00:00:00.000Z} - data-test="to" - highlightFrom={2018-01-17T00:00:00.000Z} - id="date-to" - maxDate={2018-02-05T00:00:00.000Z} - minDate={2018-01-17T00:00:00.000Z} - onChange={[Function]} - placeholder="end_date" - value={2018-02-05T00:00:00.000Z} - /> - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap deleted file mode 100644 index f57bb80bd3a..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render dark helptooltip properly: dark 1`] = ` -<HelpTooltip - overlay={ - <div - className="my-overlay" - /> - } -> - <HelpIcon - fill="rgba(0, 0, 0, 0.25)" - fillInner="#FFFFFF" - size={14} - /> -</HelpTooltip> -`; - -exports[`should render properly: default 1`] = ` -<div - className="help-tooltip" -> - <Tooltip - mouseLeaveDelay={0.25} - overlay={ - <div - className="my-overlay" - /> - } - > - <span - className="display-inline-flex-center" - data-testid="help-tooltip-activator" - > - <HelpIcon - aria-label="help" - description={ - <div - className="my-overlay" - /> - } - fill="#888" - role="img" - size={12} - /> - </span> - </Tooltip> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap deleted file mode 100644 index c6a28b370f1..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<a - className="identity-provider-link" - href="/url/foo/bar" - style={ - { - "backgroundColor": "#000", - } - } -> - <img - alt="Foo" - height={20} - src="/some/path" - width={20} - /> - Link text -</a> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap deleted file mode 100644 index 16f3e1c2dfa..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<ModalValidationField - description="Field description" - dirty={true} - error="Bad formatting" - label="Foo field" - touched={true} -> - <Component /> -</ModalValidationField> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap deleted file mode 100644 index cc15270b4b8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap +++ /dev/null @@ -1,71 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display the field as valid 1`] = ` -<div - className="modal-validation-field" -> - <label> - Foo - </label> - <input - className="is-valid" - type="text" - /> - <AlertSuccessIcon - className="little-spacer-top" - /> -</div> -`; - -exports[`should display the field with an error 1`] = ` -<div - className="modal-validation-field" -> - <label> - Foo - </label> - <input - className="is-invalid" - type="text" - /> - <AlertErrorIcon - className="little-spacer-top" - /> - <p - className="text-danger" - > - Is required - </p> -</div> -`; - -exports[`should display the field without any error/validation 1`] = ` -<div - className="modal-validation-field" -> - <label> - Foo - </label> - <input - type="text" - /> - <div - className="modal-field-description" - > - Describe Foo. - </div> -</div> -`; - -exports[`should display the field without any error/validation 2`] = ` -<div - className="modal-validation-field" -> - <label> - Foo - </label> - <input - type="text" - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap deleted file mode 100644 index 8649fba79b8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap +++ /dev/null @@ -1,29 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render properly: checked 1`] = ` -<a - aria-checked={true} - className="display-inline-flex-center link-radio" - href="#" - onClick={[Function]} - role="radio" -> - <i - className="icon-radio spacer-right is-checked" - /> -</a> -`; - -exports[`should render properly: not checked 1`] = ` -<a - aria-checked={false} - className="display-inline-flex-center link-radio" - href="#" - onClick={[Function]} - role="radio" -> - <i - className="icon-radio spacer-right" - /> -</a> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap deleted file mode 100644 index eedf38615d1..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap +++ /dev/null @@ -1,173 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should be actionable 1`] = ` -<div - className="radio-card radio-card-actionable" - onClick={[MockFunction]} - role="radio" - tabIndex={0} -> - <h2 - className="radio-card-header big-spacer-bottom" - > - <span - className="display-flex-center link-radio" - > - <i - className="icon-radio spacer-right" - /> - Radio Card - </span> - </h2> - <div - className="radio-card-body" - > - <div> - content - </div> - </div> -</div> -`; - -exports[`should be actionable 2`] = ` -<div - aria-checked={false} - className="radio-card radio-card-actionable" - onClick={ - [MockFunction] { - "calls": [ - [ - { - "currentTarget": { - "blur": [Function], - }, - "preventDefault": [Function], - "stopImmediatePropagation": [Function], - "stopPropagation": [Function], - "target": { - "blur": [Function], - }, - }, - ], - ], - "results": [ - { - "type": "return", - "value": undefined, - }, - ], - } - } - role="radio" - tabIndex={0} -> - <h2 - className="radio-card-header big-spacer-bottom" - > - <span - className="display-flex-center link-radio" - > - <i - className="icon-radio spacer-right" - /> - Radio Card - </span> - info - </h2> - <div - className="radio-card-body" - > - <div> - content - </div> - </div> -</div> -`; - -exports[`should render correctly 1`] = ` -<div - className="radio-card" - role="radio" - tabIndex={0} -> - <h2 - className="radio-card-header big-spacer-bottom" - > - <span - className="display-flex-center link-radio" - > - Radio Card - </span> - info - </h2> - <div - className="radio-card-body" - > - <div> - content - </div> - </div> - <div - className="radio-card-recommended" - > - <RecommendedIcon - className="spacer-right" - /> - <FormattedMessage - defaultMessage="Recommended for you" - id="Recommended for you" - values={ - { - "recommended": <strong> - recommended - </strong>, - } - } - /> - </div> -</div> -`; - -exports[`should render correctly 2`] = ` -<div - className="radio-card radio-card-vertical" - role="radio" - tabIndex={0} -> - <h2 - className="radio-card-header big-spacer-bottom" - > - <span - className="display-flex-center link-radio" - > - Radio Card Vertical - </span> - info - </h2> - <div - className="radio-card-body" - > - <div> - content - </div> - </div> - <div - className="radio-card-recommended" - > - <RecommendedIcon - className="spacer-right" - /> - <FormattedMessage - defaultMessage="Recommended for you" - id="Recommended for you" - values={ - { - "recommended": <strong> - recommended - </strong>, - } - } - /> - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap deleted file mode 100644 index f94c6cfc6f2..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap +++ /dev/null @@ -1,47 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should handle click 1`] = ` -<Tooltip - overlay="reload" -> - <a - className="link-no-underline" - href="#" - onClick={[Function]} - > - <svg - height="24" - viewBox="0 0 18 24" - width="18" - > - <path - d="M16.6454 8.1084c-.3-.5-.9-.7-1.4-.4-.5.3-.7.9-.4 1.4.9 1.6 1.1 3.4.6 5.1-.5 1.7-1.7 3.2-3.2 4-3.3 1.8-7.4.6-9.1-2.7-1.8-3.1-.8-6.9 2.1-8.8v3.3h2v-7h-7v2h3.9c-3.7 2.5-5 7.5-2.8 11.4 1.6 3 4.6 4.6 7.7 4.6 1.4 0 2.8-.3 4.2-1.1 2-1.1 3.5-3 4.2-5.2.6-2.2.3-4.6-.8-6.6z" - fill="#656565" - /> - </svg> - </a> -</Tooltip> -`; - -exports[`should render properly 1`] = ` -<Tooltip - overlay="reload" -> - <a - className="link-no-underline" - href="#" - onClick={[Function]} - > - <svg - height="24" - viewBox="0 0 18 24" - width="18" - > - <path - d="M16.6454 8.1084c-.3-.5-.9-.7-1.4-.4-.5.3-.7.9-.4 1.4.9 1.6 1.1 3.4.6 5.1-.5 1.7-1.7 3.2-3.2 4-3.3 1.8-7.4.6-9.1-2.7-1.8-3.1-.8-6.9 2.1-8.8v3.3h2v-7h-7v2h3.9c-3.7 2.5-5 7.5-2.8 11.4 1.6 3 4.6 4.6 7.7 4.6 1.4 0 2.8-.3 4.2-1.1 2-1.1 3.5-3 4.2-5.2.6-2.2.3-4.6-.8-6.6z" - fill="#656565" - /> - </svg> - </a> -</Tooltip> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap deleted file mode 100644 index ce284960f01..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` -<div - className="search-box" - title="" -> - <input - aria-label="placeholder" - autoComplete="off" - className="search-box-input" - maxLength={150} - onChange={[Function]} - onKeyDown={[Function]} - placeholder="placeholder" - type="search" - value="foo" - /> - <Spinner - loading={false} - > - <SearchIcon - className="search-box-magnifier" - /> - </Spinner> - <ClearButton - aria-label="clear" - className="button-tiny search-box-clear" - iconProps={ - { - "size": 12, - } - } - onClick={[Function]} - /> - <span - aria-live="polite" - className="search-box-note" - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap deleted file mode 100644 index 0136a28365e..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Select-test.tsx.snap +++ /dev/null @@ -1,2325 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Select should render clearIndicator correctly 1`] = ` -<div - className="spacer-left spacer-right" -> - <ClearButton - className="button-tiny" - iconProps={ - { - "size": 12, - } - } - tabIndex={-1} - /> -</div> -`; - -exports[`Select should render complex select component: other props 1`] = ` -<ForwardRef - className="react-select" - classNamePrefix="react-select" - components={ - { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "Input": [Function], - "MultiValueRemove": [Function], - } - } - isClearable={true} - isLoading={true} - styles={ - { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - } - } -/> -`; - -exports[`Select should render correctly: default 1`] = ` -<ForwardRef - className="react-select" - classNamePrefix="react-select" - components={ - { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "MultiValueRemove": [Function], - } - } - styles={ - { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - } - } -/> -`; - -exports[`Select should render dropdownIndicator correctly 1`] = `<Styled(span) />`; - -exports[`Select should render loadingIndicator correctly 1`] = ` -<i - className="spinner spacer-left spacer-right additional-class" -/> -`; - -exports[`Select should render multiValueRemove correctly 1`] = ` -<MultiValueRemove - innerProps={{}} -> - × -</MultiValueRemove> -`; - -exports[`should render CreatableSelect correctly 1`] = ` -<SelectContainer - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "id": undefined, - "onKeyDown": [Function], - } - } - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } -> - <LiveRegion - ariaSelection={null} - clearValue={[Function]} - cx={[Function]} - focusableOptions={[]} - focusedOption={null} - focusedValue={null} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - id="react-select-2-live-region" - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - selectValue={[]} - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - /> - <Control - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "onMouseDown": [Function], - "onTouchEnd": [Function], - } - } - innerRef={[Function]} - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - menuIsOpen={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - <ValueContainer - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - isDisabled={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - <Placeholder - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "id": "react-select-2-placeholder", - } - } - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - key="placeholder" - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - Select... - </Placeholder> - <Input - aria-autocomplete="list" - aria-describedby="react-select-2-placeholder" - aria-expanded={false} - aria-haspopup={true} - autoCapitalize="none" - autoComplete="off" - autoCorrect="off" - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - id="react-select-2-input" - innerRef={[Function]} - isDisabled={false} - isHidden={false} - isMulti={false} - isRtl={false} - onBlur={[Function]} - onChange={[Function]} - onFocus={[Function]} - options={[]} - role="combobox" - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - spellCheck="false" - tabIndex={0} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - type="text" - value="" - /> - </ValueContainer> - <IndicatorsContainer - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - isDisabled={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - <IndicatorSeparator - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - /> - <dropdownIndicator - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "aria-hidden": "true", - "onMouseDown": [Function], - "onTouchEnd": [Function], - } - } - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - /> - </IndicatorsContainer> - </Control> -</SelectContainer> -`; - -exports[`should render SearchSelect correctly 1`] = ` -<SelectContainer - className="react-select" - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "id": undefined, - "onKeyDown": [Function], - } - } - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } -> - <LiveRegion - ariaSelection={null} - clearValue={[Function]} - cx={[Function]} - focusableOptions={[]} - focusedOption={null} - focusedValue={null} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - id="react-select-3-live-region" - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - selectValue={[]} - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - /> - <Control - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "onMouseDown": [Function], - "onTouchEnd": [Function], - } - } - innerRef={[Function]} - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - menuIsOpen={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - <ValueContainer - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - isDisabled={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - <Placeholder - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "id": "react-select-3-placeholder", - } - } - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - key="placeholder" - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - Select... - </Placeholder> - <Input - aria-autocomplete="list" - aria-describedby="react-select-3-placeholder" - aria-expanded={false} - aria-haspopup={true} - autoCapitalize="none" - autoComplete="off" - autoCorrect="off" - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - id="react-select-3-input" - innerRef={[Function]} - isDisabled={false} - isHidden={false} - isMulti={false} - isRtl={false} - onBlur={[Function]} - onChange={[Function]} - onFocus={[Function]} - options={[]} - role="combobox" - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - spellCheck="false" - tabIndex={0} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - type="text" - value="" - /> - </ValueContainer> - <IndicatorsContainer - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - isDisabled={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - > - <IndicatorSeparator - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - /> - <dropdownIndicator - clearValue={[Function]} - cx={[Function]} - getClassNames={[Function]} - getStyles={[Function]} - getValue={[Function]} - hasValue={false} - innerProps={ - { - "aria-hidden": "true", - "onMouseDown": [Function], - "onTouchEnd": [Function], - } - } - isDisabled={false} - isFocused={false} - isMulti={false} - isRtl={false} - options={[]} - selectOption={[Function]} - selectProps={ - { - "aria-live": "polite", - "backspaceRemovesValue": true, - "blurInputOnSelect": true, - "captureMenuScroll": false, - "className": "react-select", - "classNamePrefix": "react-select", - "classNames": {}, - "closeMenuOnScroll": false, - "closeMenuOnSelect": true, - "components": { - "ClearIndicator": [Function], - "DropdownIndicator": [Function], - "LoadingIndicator": [Function], - "MultiValueRemove": [Function], - }, - "controlShouldRenderValue": true, - "escapeClearsValue": false, - "filterOption": null, - "formatGroupLabel": [Function], - "getOptionLabel": [Function], - "getOptionValue": [Function], - "inputValue": "", - "isDisabled": false, - "isLoading": false, - "isMulti": false, - "isOptionDisabled": [Function], - "isRtl": false, - "isSearchable": true, - "loadingMessage": [Function], - "maxMenuHeight": 300, - "menuIsOpen": false, - "menuPlacement": "bottom", - "menuPosition": "absolute", - "menuShouldBlockScroll": false, - "menuShouldScrollIntoView": true, - "minMenuHeight": 140, - "noOptionsMessage": [Function], - "onChange": [Function], - "onInputChange": [Function], - "onMenuClose": [Function], - "onMenuOpen": [Function], - "openMenuOnClick": true, - "openMenuOnFocus": false, - "options": [], - "pageSize": 5, - "placeholder": "Select...", - "screenReaderStatus": [Function], - "styles": { - "container": [Function], - "control": [Function], - "indicatorSeparator": [Function], - "indicatorsContainer": [Function], - "input": [Function], - "loadingIndicator": [Function], - "menu": [Function], - "menuList": [Function], - "menuPortal": [Function], - "multiValue": [Function], - "multiValueLabel": [Function], - "multiValueRemove": [Function], - "noOptionsMessage": [Function], - "option": [Function], - "placeholder": [Function], - "singleValue": [Function], - "valueContainer": [Function], - }, - "tabIndex": 0, - "tabSelectsValue": true, - "unstyled": false, - "value": null, - } - } - setValue={[Function]} - theme={ - { - "borderRadius": 4, - "colors": { - "danger": "#DE350B", - "dangerLight": "#FFBDAD", - "neutral0": "hsl(0, 0%, 100%)", - "neutral10": "hsl(0, 0%, 90%)", - "neutral20": "hsl(0, 0%, 80%)", - "neutral30": "hsl(0, 0%, 70%)", - "neutral40": "hsl(0, 0%, 60%)", - "neutral5": "hsl(0, 0%, 95%)", - "neutral50": "hsl(0, 0%, 50%)", - "neutral60": "hsl(0, 0%, 40%)", - "neutral70": "hsl(0, 0%, 30%)", - "neutral80": "hsl(0, 0%, 20%)", - "neutral90": "hsl(0, 0%, 10%)", - "primary": "#2684FF", - "primary25": "#DEEBFF", - "primary50": "#B2D4FF", - "primary75": "#4C9AFF", - }, - "spacing": { - "baseUnit": 4, - "controlHeight": 38, - "menuGutter": 8, - }, - } - } - /> - </IndicatorsContainer> - </Control> -</SelectContainer> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap deleted file mode 100644 index 49b14a9e20f..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap +++ /dev/null @@ -1,52 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders 1`] = ` -<Modal - contentLabel="" - onRequestClose={[MockFunction]} -> - <div /> -</Modal> -`; - -exports[`submits 1`] = ` -<Modal - contentLabel="" - onRequestClose={[MockFunction]} -> - <Button - disabled={false} - onClick={[Function]} - > - close - </Button> -</Modal> -`; - -exports[`submits 2`] = ` -<Modal - contentLabel="" - onRequestClose={[MockFunction]} -> - <Button - disabled={true} - onClick={[Function]} - > - close - </Button> -</Modal> -`; - -exports[`submits 3`] = ` -<Modal - contentLabel="" - onRequestClose={[MockFunction]} -> - <Button - disabled={false} - onClick={[Function]} - > - close - </Button> -</Modal> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap deleted file mode 100644 index ac7aa845377..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap +++ /dev/null @@ -1,58 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: disabled 1`] = ` -<Button - aria-checked={true} - className="boolean-toggle boolean-toggle-on" - disabled={true} - name="toggle-name" - onClick={[Function]} - role="switch" -> - <div - className="boolean-toggle-handle" - > - <CheckIcon - size={12} - /> - </div> -</Button> -`; - -exports[`should render correctly: off 1`] = ` -<Button - aria-checked={false} - className="boolean-toggle" - disabled={true} - name="toggle-name" - onClick={[Function]} - role="switch" -> - <div - className="boolean-toggle-handle" - > - <CheckIcon - size={12} - /> - </div> -</Button> -`; - -exports[`should render correctly: on 1`] = ` -<Button - aria-checked={true} - className="boolean-toggle boolean-toggle-on" - disabled={true} - name="toggle-name" - onClick={[Function]} - role="switch" -> - <div - className="boolean-toggle-handle" - > - <CheckIcon - size={12} - /> - </div> -</Button> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap deleted file mode 100644 index 6cbc3a5b5c8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap +++ /dev/null @@ -1,62 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should not render empty tooltips 1`] = ` -<div - id="tooltip" -/> -`; - -exports[`should not render empty tooltips 2`] = ` -<div - id="tooltip" -/> -`; - -exports[`should render 1`] = ` -<Fragment> - <div - aria-describedby="tooltip-1" - id="tooltip" - onBlur={[Function]} - onFocus={[Function]} - onPointerEnter={[Function]} - onPointerLeave={[Function]} - /> - <TooltipPortal> - <div - aria-hidden={true} - className="tooltip-inner sw-font-sans hidden" - id="tooltip-1" - role="tooltip" - > - <span - id="overlay" - /> - </div> - </TooltipPortal> -</Fragment> -`; - -exports[`should render 2`] = ` -<Fragment> - <div - aria-describedby="tooltip-1" - id="tooltip" - onBlur={[Function]} - onFocus={[Function]} - onPointerEnter={[Function]} - onPointerLeave={[Function]} - /> - <EscKeydownHandler - onKeydown={[Function]} - > - <TooltipPortal> - <ScreenPositionFixer - ready={false} - > - <Component /> - </ScreenPositionFixer> - </TooltipPortal> - </EscKeydownHandler> -</Fragment> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap deleted file mode 100644 index 2958fbb81f8..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render and submit 1`] = ` -<Formik - initialValues={ - { - "foo": "bar", - } - } - onSubmit={[Function]} - validate={[MockFunction]} - validateOnMount={true} -> - <Component /> -</Formik> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap deleted file mode 100644 index 32dd5f73936..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap +++ /dev/null @@ -1,162 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` -<div> - <label - htmlFor="field-id" - > - <span - className="text-middle" - > - <strong> - Field label - </strong> - <MandatoryFieldMarker /> - </span> - </label> - <div - className="little-spacer-top spacer-bottom" - > - <div /> - <AlertSuccessIcon - className="spacer-left text-middle" - label="valid_input" - /> - </div> - <div - className="note abs-width-400" - > - My description - </div> -</div> -`; - -exports[`should render correctly: error under the input 1`] = ` -<div> - <label - htmlFor="field-id" - > - <span - className="text-middle" - > - <strong> - Field label - </strong> - <MandatoryFieldMarker /> - </span> - </label> - <div - className="little-spacer-top spacer-bottom" - > - <div /> - <div - className="spacer-top" - style={ - { - "display": "flex", - } - } - > - <AlertErrorIcon - className="text-middle" - /> - <span - className="little-spacer-left text-danger text-middle" - > - Field error message - </span> - </div> - </div> - <div - className="note abs-width-400" - > - My description - </div> -</div> -`; - -exports[`should render correctly: no label 1`] = ` -<div> - <div - className="little-spacer-top spacer-bottom" - > - <div /> - <AlertSuccessIcon - className="spacer-left text-middle" - label="valid_input" - /> - </div> - <div - className="note abs-width-400" - > - My description - </div> -</div> -`; - -exports[`should render correctly: with error 1`] = ` -<div> - <label - htmlFor="field-id" - > - <span - className="text-middle" - > - <strong> - Field label - </strong> - </span> - </label> - <div - className="little-spacer-top spacer-bottom" - > - <div /> - <AlertErrorIcon - className="spacer-left text-middle" - /> - <span - className="little-spacer-left text-danger text-middle" - > - Field error message - </span> - </div> - <div - className="note abs-width-400" - > - <div> - My description - </div> - </div> -</div> -`; - -exports[`should render correctly: with help 1`] = ` -<div> - <label - htmlFor="field-id" - > - <span - className="text-middle" - > - <strong> - Field label - </strong> - <MandatoryFieldMarker /> - </span> - <HelpTooltip - className="spacer-left" - overlay="Help message" - /> - </label> - <div - className="little-spacer-top spacer-bottom" - > - <div /> - </div> - <div - className="note abs-width-400" - > - My description - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap deleted file mode 100644 index ee17dc8e5ce..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap +++ /dev/null @@ -1,114 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<Modal - contentLabel="title" - onRequestClose={[MockFunction]} -> - <ValidationForm - initialValues={ - { - "field": "foo", - } - } - onSubmit={[Function]} - validate={[MockFunction]} - > - <Component /> - </ValidationForm> -</Modal> -`; - -exports[`should render correctly 2`] = ` -<ContextProvider - value={ - { - "dirty": false, - "errors": {}, - "getFieldHelpers": [Function], - "getFieldMeta": [Function], - "getFieldProps": [Function], - "handleBlur": [Function], - "handleChange": [Function], - "handleReset": [Function], - "handleSubmit": [Function], - "initialErrors": {}, - "initialStatus": undefined, - "initialTouched": {}, - "initialValues": { - "field": "foo", - }, - "isSubmitting": false, - "isValid": true, - "isValidating": false, - "registerField": [Function], - "resetForm": [Function], - "setErrors": [Function], - "setFieldError": [Function], - "setFieldTouched": [Function], - "setFieldValue": [Function], - "setFormikState": [Function], - "setStatus": [Function], - "setSubmitting": [Function], - "setTouched": [Function], - "setValues": [Function], - "status": undefined, - "submitCount": 0, - "submitForm": [Function], - "touched": {}, - "unregisterField": [Function], - "validateField": [Function], - "validateForm": [Function], - "validateOnBlur": true, - "validateOnChange": true, - "validateOnMount": true, - "values": { - "field": "foo", - }, - } - } -> - <form - onSubmit={[Function]} - > - <header - className="modal-head" - > - <h2> - title - </h2> - </header> - <div - className="modal-body" - > - <input - name="field" - onBlur={[Function]} - onChange={[Function]} - type="text" - value="foo" - /> - </div> - <footer - className="modal-foot" - > - <Spinner - className="spacer-right" - loading={false} - /> - <SubmitButton - className="button-red" - disabled={true} - > - confirm - </SubmitButton> - <ResetButtonLink - disabled={false} - onClick={[MockFunction]} - > - cancel - </ResetButtonLink> - </footer> - </form> -</ContextProvider> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap deleted file mode 100644 index ba0ff5c2f59..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap +++ /dev/null @@ -1,31 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Button should render correctly 1`] = ` -<button - className="button" - onClick={[Function]} - type="button" -> - My button -</button> -`; - -exports[`ButtonIcon should render correctly 1`] = ` -<Tooltip - mouseEnterDelay={0.4} - overlay="my tooltip" - visible={true} -> - <Button - className="button-icon" - stopPropagation={true} - style={ - { - "color": "#236a97", - } - } - > - <i /> - </Button> -</Tooltip> -`; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx deleted file mode 100644 index f42c2055934..00000000000 --- a/server/sonar-web/src/main/js/components/controls/__tests__/buttons-test.tsx +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click, mockEvent } from '../../../helpers/testUtils'; -import { Button, ButtonIcon, ButtonIconProps } from '../buttons'; - -describe('Button', () => { - it('should render correctly', () => { - const onClick = jest.fn(); - const preventDefault = jest.fn(); - const stopPropagation = jest.fn(); - const wrapper = shallowRender({ onClick }); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find('button'), mockEvent({ preventDefault, stopPropagation })); - expect(onClick).toHaveBeenCalled(); - expect(preventDefault).toHaveBeenCalled(); - expect(stopPropagation).not.toHaveBeenCalled(); - }); - - it('should not stop propagation, but prevent default of the click event', () => { - const preventDefault = jest.fn(); - const stopPropagation = jest.fn(); - const wrapper = shallowRender({ preventDefault: false, stopPropagation: true }); - click(wrapper.find('button'), mockEvent({ preventDefault, stopPropagation })); - expect(preventDefault).not.toHaveBeenCalled(); - expect(stopPropagation).toHaveBeenCalled(); - }); - - it('should disable buttons with a class', () => { - const preventDefault = jest.fn(); - const onClick = jest.fn(); - const button = shallowRender({ disabled: true, onClick, preventDefault: false }).find('button'); - expect(button.props().disabled).toBe(true); - expect(button.props().className).toContain('disabled'); - expect(button.props()['aria-disabled']).toBe(true); - click(button, mockEvent({ preventDefault })); - expect(onClick).not.toHaveBeenCalled(); - expect(preventDefault).toHaveBeenCalled(); - }); - - function shallowRender(props: Partial<Button['props']> = {}) { - return shallow<Button>(<Button {...props}>My button</Button>); - } -}); - -describe('ButtonIcon', () => { - it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - }); - - function shallowRender(props: Partial<ButtonIconProps> = {}) { - return shallow( - <ButtonIcon tooltip="my tooltip" tooltipProps={{ visible: true }} {...props}> - <i /> - </ButtonIcon>, - ); - } -}); diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx deleted file mode 100644 index 6a40051be8e..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx +++ /dev/null @@ -1,221 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import ListStyleFacet, { Props } from '../ListStyleFacet'; - -it('should render', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should select items', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange }); - const instance = wrapper.instance() as ListStyleFacet<string>; - - // select one item - instance.handleItemClick('b', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); - wrapper.setProps({ values: ['b'] }); - - // select another item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['a'] }); - wrapper.setProps({ values: ['a'] }); - - // unselect item - instance.handleItemClick('a', false); - expect(onChange).toHaveBeenLastCalledWith({ foo: [] }); - wrapper.setProps({ values: [] }); - - // select multiple items - wrapper.setProps({ values: ['b'] }); - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b', 'c'] }); - wrapper.setProps({ values: ['b', 'c'] }); - - // unselect item - instance.handleItemClick('c', true); - expect(onChange).toHaveBeenLastCalledWith({ foo: ['b'] }); -}); - -it('should toggle', () => { - const onToggle = jest.fn(); - const wrapper = shallowRender({ onToggle }); - wrapper.find('FacetHeader').prop<Function>('onClick')(); - expect(onToggle).toHaveBeenCalled(); -}); - -it('should clear', () => { - const onChange = jest.fn(); - const wrapper = shallowRender({ onChange, values: ['a'] }); - wrapper.find('FacetHeader').prop<Function>('onClear')(); - expect(onChange).toHaveBeenCalledWith({ foo: [] }); -}); - -it('should search', async () => { - const onSearch = jest.fn().mockResolvedValue({ - results: ['d', 'e'], - paging: { pageIndex: 1, pageSize: 2, total: 3 }, - }); - const loadSearchResultCount = jest.fn().mockResolvedValue({ d: 7, e: 3 }); - const wrapper = shallowRender({ loadSearchResultCount, onSearch }); - - // search - wrapper.find('SearchBox').prop<Function>('onChange')('query'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query'); - expect(loadSearchResultCount).toHaveBeenLastCalledWith(['d', 'e']); - - // load more results - onSearch.mockResolvedValue({ - results: ['f'], - paging: { pageIndex: 2, pageSize: 2, total: 3 }, - }); - loadSearchResultCount.mockResolvedValue({ f: 5 }); - wrapper.find('ListFooter').prop<Function>('loadMore')(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('query', 2); - - // clear search - onSearch.mockClear(); - loadSearchResultCount.mockClear(); - wrapper.find('SearchBox').prop<Function>('onChange')(''); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).not.toHaveBeenCalled(); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search for no results - onSearch.mockResolvedValue({ results: [], paging: { pageIndex: 1, pageSize: 2, total: 0 } }); - wrapper.find('SearchBox').prop<Function>('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); - - // search fails - onSearch.mockRejectedValue(undefined); - wrapper.find('SearchBox').prop<Function>('onChange')('blabla'); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); // should render previous results - expect(onSearch).toHaveBeenLastCalledWith('blabla'); - expect(loadSearchResultCount).not.toHaveBeenCalled(); -}); - -it('should limit the number of items', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 5 }); - expect(wrapper.find('FacetItem').length).toBe(2); - - wrapper.find('ListStyleFacetFooter').prop<Function>('showMore')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(3); - - wrapper.find('ListStyleFacetFooter').prop<Function>('showLess')(); - wrapper.update(); - expect(wrapper.find('FacetItem').length).toBe(2); -}); - -it('should show warning that there might be more results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.find('ListStyleFacetFooter').prop<Function>('showMore')(); - wrapper.update(); - expect(wrapper.find('Alert').exists()).toBe(true); -}); - -it('should reset state when closes', () => { - const wrapper = shallowRender(); - wrapper.setState({ - query: 'foobar', - searchResults: ['foo', 'bar'], - searching: true, - showFullList: true, - }); - - wrapper.setProps({ open: false }); - checkInitialState(wrapper); -}); - -it('should reset search when query changes', () => { - const wrapper = shallowRender({ query: { a: ['foo'] } }); - wrapper.setState({ query: 'foo', searchResults: ['foo'], searchResultsCounts: { foo: 3 } }); - wrapper.setProps({ query: { a: ['foo'], b: ['bar'] } }); - checkInitialState(wrapper); -}); - -it('should collapse list when new stats have few results', () => { - const wrapper = shallowRender({ maxInitialItems: 2, maxItems: 3 }); - wrapper.setState({ showFullList: true }); - - wrapper.setProps({ stats: { d: 1 } }); - expect(wrapper.state('showFullList')).toBe(false); -}); - -it('should display all selected items', () => { - const wrapper = shallowRender({ - maxInitialItems: 2, - stats: { a: 10, b: 5, c: 3 }, - values: ['a', 'b', 'c'], - }); - expect(wrapper).toMatchSnapshot(); -}); - -it('should be disabled', () => { - const wrapper = shallowRender({ disabled: true, disabledHelper: 'Disabled helper description' }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<Props<string>> = {}) { - return shallow( - <ListStyleFacet - facetHeader="facet header" - fetching={false} - getFacetItemText={identity} - getSearchResultKey={identity} - getSearchResultText={identity} - onChange={jest.fn()} - onSearch={jest.fn()} - onToggle={jest.fn()} - open - property="foo" - renderFacetItem={identity} - renderSearchResult={identity} - searchPlaceholder="search for foo..." - stats={{ a: 10, b: 8, c: 1 }} - values={[]} - {...props} - />, - ); -} - -function identity(str: string) { - return str; -} - -function checkInitialState(wrapper: ShallowWrapper) { - expect(wrapper.state('query')).toBe(''); - expect(wrapper.state('searchResults')).toBeUndefined(); - expect(wrapper.state('searching')).toBe(false); - expect(wrapper.state('searchResultsCounts')).toEqual({}); - expect(wrapper.state('showFullList')).toBe(false); -} diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx deleted file mode 100644 index e69cb0ef2ec..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacetFooter-test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { ButtonLink } from '../../controls/buttons'; -import ListStyleFacetFooter from '../ListStyleFacetFooter'; - -it('should not render "show more"', () => { - expect( - shallow(<ListStyleFacetFooter count={3} showLess={undefined} showMore={jest.fn()} total={3} />), - ).toMatchSnapshot(); -}); - -it('should show more', () => { - const showMore = jest.fn(); - const wrapper = shallow( - <ListStyleFacetFooter count={3} showLess={undefined} showMore={showMore} total={15} />, - ); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find(ButtonLink)); - expect(showMore).toHaveBeenCalled(); -}); - -it('should show less', () => { - const showLess = jest.fn(); - const wrapper = shallow( - <ListStyleFacetFooter count={15} showLess={showLess} showMore={jest.fn()} total={15} />, - ); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find(ButtonLink)); - expect(showLess).toHaveBeenCalled(); -}); - -it('should not render "show less"', () => { - const wrapper = shallow( - <ListStyleFacetFooter count={15} showLess={undefined} showMore={jest.fn()} total={15} />, - ); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx deleted file mode 100644 index 326d54d2a28..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import MultipleSelectionHint from '../MultipleSelectionHint'; - -it('should render for mac', () => { - Object.defineProperty(navigator, 'userAgent', { - configurable: true, - value: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4)', - }); - expect(shallow(<MultipleSelectionHint options={3} values={1} />)).toMatchSnapshot(); -}); - -it('should render for windows', () => { - Object.defineProperty(navigator, 'userAgent', { - configurable: true, - value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)', - }); - expect(shallow(<MultipleSelectionHint options={3} values={1} />)).toMatchSnapshot(); -}); - -it('should not render when there is not selection', () => { - expect(shallow(<MultipleSelectionHint options={3} values={0} />).type()).toBeNull(); -}); - -it('should not render when there are not enough options', () => { - expect(shallow(<MultipleSelectionHint options={1} values={1} />).type()).toBeNull(); -}); diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap b/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap deleted file mode 100644 index 9d47ddf8963..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacet-test.tsx.snap +++ /dev/null @@ -1,436 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should be disabled 1`] = ` -<FacetBox - className="search-navigator-facet-box-forbidden" - property="foo" -> - <FacetHeader - disabled={true} - disabledHelper="Disabled helper description" - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - open={false} - values={[]} - /> -</FacetBox> -`; - -exports[`should display all selected items 1`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={ - [ - "a", - "b", - "c", - ] - } - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={true} - halfWidth={false} - key="a" - name="a" - onClick={[Function]} - stat="10" - tooltip="a" - value="a" - /> - <FacetItem - active={true} - halfWidth={false} - key="b" - name="b" - onClick={[Function]} - stat="5" - tooltip="b" - value="b" - /> - </FacetItemsList> - <div - className="note spacer-bottom text-center" - > - ⋯ - </div> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={true} - halfWidth={false} - key="c" - name="c" - onClick={[Function]} - stat="3" - tooltip="c" - value="c" - /> - </FacetItemsList> - <ListStyleFacetFooter - count={3} - showMore={[Function]} - total={3} - /> - <MultipleSelectionHint - options={3} - values={3} - /> -</FacetBox> -`; - -exports[`should render 1`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={[]} - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - halfWidth={false} - key="a" - name="a" - onClick={[Function]} - stat="10" - tooltip="a" - value="a" - /> - <FacetItem - active={false} - halfWidth={false} - key="b" - name="b" - onClick={[Function]} - stat="8" - tooltip="b" - value="b" - /> - <FacetItem - active={false} - halfWidth={false} - key="c" - name="c" - onClick={[Function]} - stat="1" - tooltip="c" - value="c" - /> - </FacetItemsList> - <ListStyleFacetFooter - count={3} - showMore={[Function]} - total={3} - /> - <MultipleSelectionHint - options={3} - values={0} - /> -</FacetBox> -`; - -exports[`should search 1`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={[]} - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="query" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - halfWidth={false} - key="d" - name="d" - onClick={[Function]} - stat="7" - tooltip="d" - value="d" - /> - <FacetItem - active={false} - halfWidth={false} - key="e" - name="e" - onClick={[Function]} - stat="3" - tooltip="e" - value="e" - /> - </FacetItemsList> - <ListFooter - className="spacer-bottom" - count={2} - loadMore={[Function]} - ready={true} - total={3} - /> - <MultipleSelectionHint - options={3} - values={0} - /> -</FacetBox> -`; - -exports[`should search 2`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={[]} - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="query" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - halfWidth={false} - key="d" - name="d" - onClick={[Function]} - stat="7" - tooltip="d" - value="d" - /> - <FacetItem - active={false} - halfWidth={false} - key="e" - name="e" - onClick={[Function]} - stat="3" - tooltip="e" - value="e" - /> - <FacetItem - active={false} - halfWidth={false} - key="f" - name="f" - onClick={[Function]} - stat="5" - tooltip="f" - value="f" - /> - </FacetItemsList> - <ListFooter - className="spacer-bottom" - count={3} - loadMore={[Function]} - ready={true} - total={3} - /> - <MultipleSelectionHint - options={3} - values={0} - /> -</FacetBox> -`; - -exports[`should search 3`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={[]} - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="" - /> - <FacetItemsList - labelledby="facet_foo" - > - <FacetItem - active={false} - halfWidth={false} - key="a" - name="a" - onClick={[Function]} - stat="10" - tooltip="a" - value="a" - /> - <FacetItem - active={false} - halfWidth={false} - key="b" - name="b" - onClick={[Function]} - stat="8" - tooltip="b" - value="b" - /> - <FacetItem - active={false} - halfWidth={false} - key="c" - name="c" - onClick={[Function]} - stat="1" - tooltip="c" - value="c" - /> - </FacetItemsList> - <ListStyleFacetFooter - count={3} - showMore={[Function]} - total={3} - /> - <MultipleSelectionHint - options={3} - values={0} - /> -</FacetBox> -`; - -exports[`should search 4`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={[]} - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="blabla" - /> - <div - className="note spacer-bottom" - > - no_results - </div> - <MultipleSelectionHint - options={3} - values={0} - /> -</FacetBox> -`; - -exports[`should search 5`] = ` -<FacetBox - property="foo" -> - <FacetHeader - fetching={false} - id="facet_foo" - name="facet header" - onClear={[Function]} - onClick={[Function]} - open={true} - values={[]} - /> - <SearchBox - autoFocus={false} - className="little-spacer-top spacer-bottom" - loading={false} - minLength={2} - onChange={[Function]} - placeholder="search for foo..." - value="blabla" - /> - <div - className="note spacer-bottom" - > - no_results - </div> - <MultipleSelectionHint - options={3} - values={0} - /> -</FacetBox> -`; diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap b/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap deleted file mode 100644 index c699c8c828d..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/ListStyleFacetFooter-test.tsx.snap +++ /dev/null @@ -1,45 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should not render "show less" 1`] = ` -<div - className="note spacer-top spacer-bottom text-center" -> - x_show.15 -</div> -`; - -exports[`should not render "show more" 1`] = ` -<div - className="note spacer-top spacer-bottom text-center" -> - x_show.3 -</div> -`; - -exports[`should show less 1`] = ` -<div - className="note spacer-top spacer-bottom text-center" -> - x_show.15 - <ButtonLink - className="spacer-left" - onClick={[Function]} - > - show_less - </ButtonLink> -</div> -`; - -exports[`should show more 1`] = ` -<div - className="note spacer-top spacer-bottom text-center" -> - x_show.3 - <ButtonLink - className="spacer-left" - onClick={[Function]} - > - show_more - </ButtonLink> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap b/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap deleted file mode 100644 index 247cc9d51e4..00000000000 --- a/server/sonar-web/src/main/js/components/facet/__tests__/__snapshots__/MultipleSelectionHint-test.tsx.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render for mac 1`] = ` -<div - className="multiple-selection-hint" -> - <div - className="multiple-selection-hint-inner" - > - shortcuts.section.global.facets.multiselection.mac - </div> -</div> -`; - -exports[`should render for windows 1`] = ` -<div - className="multiple-selection-hint" -> - <div - className="multiple-selection-hint-inner" - > - shortcuts.section.global.facets.multiselection - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap b/server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap deleted file mode 100644 index 5da7720f265..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/__snapshots__/withNotifications-test.tsx.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should fetch notifications and render 1`] = ` -<X - addNotification={[Function]} - channels={ - [ - "channel1", - "channel2", - ] - } - globalTypes={ - [ - "type-global", - "type-common", - ] - } - loading={false} - notifications={ - [ - { - "channel": "channel1", - "project": "foo", - "projectName": "Foo", - "type": "type-global", - }, - { - "channel": "channel1", - "project": "bar", - "projectName": "Bar", - "type": "type-common", - }, - { - "channel": "channel2", - "project": "qux", - "projectName": "Qux", - "type": "type-common", - }, - ] - } - perProjectTypes={ - [ - "type-common", - ] - } - removeNotification={[Function]} -/> -`; diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx deleted file mode 100644 index d5abb40e2b0..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow, ShallowWrapper } from 'enzyme'; -import * as React from 'react'; -import { CurrentUserContext } from '../../../app/components/current-user/CurrentUserContext'; -import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication'; -import { whenLoggedIn } from '../whenLoggedIn'; - -jest.mock('../../../helpers/handleRequiredAuthentication', () => jest.fn()); - -class X extends React.Component { - render() { - return <div />; - } -} - -const UnderTest = whenLoggedIn(X); - -it('should render for logged in user', () => { - expect(getRenderedType(shallowRender())).toBe(X); -}); - -it('should not render for anonymous user', () => { - const wrapper = shallowRender(false); - expect(getRenderedType(wrapper)).toBeNull(); - expect(handleRequiredAuthentication).toHaveBeenCalled(); -}); - -function getRenderedType(wrapper: ShallowWrapper) { - return wrapper.dive().dive().dive().type(); -} - -function shallowRender(isLoggedIn = true) { - return shallow( - <CurrentUserContext.Provider - value={{ - currentUser: { isLoggedIn, dismissedNotices: {} }, - updateCurrentUserHomepage: () => {}, - updateDismissedNotices: () => {}, - }} - > - <UnderTest /> - </CurrentUserContext.Provider>, - ); -} diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx deleted file mode 100644 index bffb4b7ee3a..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { withCLanguageFeature } from '../withCLanguageFeature'; - -jest.mock('../../../app/components/languages/LanguagesContext', () => { - return { - LanguagesContext: { - Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => { - return children({ c: { key: 'c', name: 'c' } }); - }, - }, - }; -}); - -class X extends React.Component<{ hasCLanguageFeature: boolean }> { - render() { - return <div />; - } -} - -const UnderTest = withCLanguageFeature(X); - -it('should pass if C Language feature is available', () => { - const wrapper = shallow(<UnderTest />); - expect(wrapper.dive().type()).toBe(X); - expect(wrapper.dive<X>().props().hasCLanguageFeature).toBe(true); -}); diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx deleted file mode 100644 index 8937df1a5b7..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount } from 'enzyme'; -import * as React from 'react'; -import { IndexationContext } from '../../../app/components/indexation/IndexationContext'; -import { IndexationContextInterface } from '../../../types/indexation'; -import withIndexationContext, { WithIndexationContextProps } from '../withIndexationContext'; - -it('should render correctly', () => { - const indexationContext: IndexationContextInterface = { - status: { hasFailures: false, isCompleted: true }, - }; - - const wrapper = mountRender(indexationContext); - - expect(wrapper.find(TestComponent).props().indexationContext).toEqual(indexationContext); -}); - -function mountRender(indexationContext?: Partial<IndexationContextInterface>) { - return mount( - <IndexationContext.Provider - value={{ - status: { completedCount: 23, hasFailures: false, isCompleted: false, total: 42 }, - ...indexationContext, - }} - > - <TestComponentWithIndexationContext /> - </IndexationContext.Provider>, - ); -} - -function TestComponent(_props: WithIndexationContextProps) { - return <h1>TestComponent</h1>; -} - -const TestComponentWithIndexationContext = withIndexationContext(TestComponent); diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx deleted file mode 100644 index 9de538471da..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx +++ /dev/null @@ -1,159 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import { KeyboardKeys } from '../../../helpers/keycodes'; -import { mockComponent } from '../../../helpers/mocks/component'; -import { keydown } from '../../../helpers/testUtils'; -import { ComponentMeasure } from '../../../types/types'; -import withKeyboardNavigation, { WithKeyboardNavigationProps } from '../withKeyboardNavigation'; - -class X extends React.Component<{ - components?: ComponentMeasure[]; - selected?: ComponentMeasure; -}> { - render() { - return <div />; - } -} - -const WrappedComponent = withKeyboardNavigation(X); - -const COMPONENTS = [ - mockComponent({ key: 'file-1' }), - mockComponent({ key: 'file-2' }), - mockComponent({ key: 'file-3' }), -]; - -it('should wrap component correctly', () => { - const wrapper = shallow(applyProps()); - expect(wrapper.find('X').exists()).toBe(true); -}); - -it('should correctly bind key events for component navigation', () => { - const onGoToParent = jest.fn(); - const onHighlight = jest.fn((selected) => { - wrapper.setProps({ selected }); - }); - const onSelect = jest.fn(); - - const wrapper = mount( - applyProps({ - cycle: true, - onGoToParent, - onHighlight, - onSelect, - selected: COMPONENTS[1], - }), - ); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[2]); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[2]); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); - - keydown({ key: KeyboardKeys.RightArrow, metaKey: true }); - expect(onSelect).not.toHaveBeenCalled(); - keydown({ key: KeyboardKeys.RightArrow }); - expect(onSelect).toHaveBeenCalledWith(COMPONENTS[0]); - - keydown({ key: KeyboardKeys.Enter }); - expect(onSelect).toHaveBeenCalledWith(COMPONENTS[0]); - - keydown({ key: KeyboardKeys.LeftArrow, metaKey: true }); - expect(onGoToParent).not.toHaveBeenCalled(); - keydown({ key: KeyboardKeys.LeftArrow }); - expect(onGoToParent).toHaveBeenCalled(); -}); - -it('should support not cycling through elements, and triggering a callback on reaching the last element', () => { - const onEndOfList = jest.fn(); - const onHighlight = jest.fn((selected) => { - wrapper.setProps({ selected }); - }); - - const wrapper = mount( - applyProps({ - onEndOfList, - onHighlight, - }), - ); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); - keydown({ key: KeyboardKeys.DownArrow }); - keydown({ key: KeyboardKeys.DownArrow }); - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[2]); - expect(onEndOfList).toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).toHaveBeenCalledWith(COMPONENTS[0]); -}); - -it('should correctly bind key events for codeview navigation', () => { - const onGoToParent = jest.fn(); - const onHighlight = jest.fn(); - const onSelect = jest.fn(); - - mount( - applyProps({ - isFile: true, - onGoToParent, - onHighlight, - onSelect, - selected: COMPONENTS[1], - }), - ); - - expect(onHighlight).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.DownArrow }); - expect(onHighlight).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.UpArrow }); - expect(onHighlight).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.RightArrow }); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.Enter }); - expect(onSelect).not.toHaveBeenCalled(); - - keydown({ key: KeyboardKeys.LeftArrow }); - expect(onGoToParent).toHaveBeenCalled(); -}); - -function applyProps(props: Partial<WithKeyboardNavigationProps> = {}) { - return <WrappedComponent components={COMPONENTS} {...props} />; -} diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx deleted file mode 100644 index 1259e1cf8fe..00000000000 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { addNotification, getNotifications, removeNotification } from '../../../api/notifications'; -import { waitAndUpdate } from '../../../helpers/testUtils'; -import { withNotifications, WithNotificationsProps } from '../withNotifications'; - -jest.mock('../../../api/notifications', () => ({ - addNotification: jest.fn().mockResolvedValue({}), - getNotifications: jest.fn(() => - Promise.resolve({ - channels: ['channel1', 'channel2'], - globalTypes: ['type-global', 'type-common'], - notifications: [ - { - channel: 'channel1', - type: 'type-global', - project: 'foo', - projectName: 'Foo', - }, - { - channel: 'channel1', - type: 'type-common', - project: 'bar', - projectName: 'Bar', - }, - { - channel: 'channel2', - type: 'type-common', - project: 'qux', - projectName: 'Qux', - }, - ], - perProjectTypes: ['type-common'], - }), - ), - removeNotification: jest.fn().mockResolvedValue({}), -})); - -class X extends React.Component<WithNotificationsProps> { - render() { - return <div />; - } -} - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should fetch notifications and render', async () => { - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - expect(getNotifications).toHaveBeenCalled(); -}); - -it('should add and remove a notification', () => { - const wrapper = shallowRender(); - const notification = { - channel: 'EmailNotificationChannel', - project: 'foo', - type: 'SQ-MyNewIssues', - }; - - wrapper.prop('addNotification')(notification); - expect(addNotification).toHaveBeenCalledWith(notification); - - wrapper.prop('removeNotification')(notification); - expect(removeNotification).toHaveBeenCalledWith(notification); -}); - -function shallowRender() { - const UnderTest = withNotifications<{}>(X); - return shallow(<UnderTest />); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx deleted file mode 100644 index ed08b83b29d..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/IssueIcon-test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { IssueType } from '../../../types/types'; -import IssueIcon from '../IssueIcon'; - -it('should render correctly', () => { - expect(shallowRender('BUG')).toMatchSnapshot(); - expect(shallowRender('VULNERABILITY')).toMatchSnapshot(); - expect(shallowRender('CODE_SMELL')).toMatchSnapshot(); - expect(shallowRender('SECURITY_HOTSPOT')).toMatchSnapshot(); -}); - -function shallowRender(type: IssueType) { - return shallow(<IssueIcon type={type} />); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx deleted file mode 100644 index bb836d3f8af..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/IssueTypeIcon-test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import IssueTypeIcon, { Props } from '../IssueTypeIcon'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ className: 'my-class', query: 'security_hotspots' })).toMatchSnapshot(); - expect(shallowRender({ query: 'new_code_smells' })).toMatchSnapshot(); - expect(shallowRender({ query: 'vulnerability' })).toMatchSnapshot(); - expect(shallowRender({ query: 'unknown' }).type()).toBeNull(); -}); - -function shallowRender(props: Partial<Props> = {}) { - return shallow(<IssueTypeIcon query="bugs" {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx deleted file mode 100644 index 1d364726db8..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/TestStatusIcon-test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import TestStatusIcon from '../TestStatusIcon'; - -it('should render correctly', () => { - expect(shallowRender('OK')).toMatchSnapshot(); - expect(shallowRender('failure')).toMatchSnapshot(); - expect(shallowRender('skipped')).toMatchSnapshot(); - expect(shallowRender('Error')).toMatchSnapshot(); -}); - -function shallowRender(status: string) { - return shallow(<TestStatusIcon status={status} />); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap deleted file mode 100644 index f3f5fcf1a7a..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueIcon-test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = `<BugIcon />`; - -exports[`should render correctly 2`] = `<VulnerabilityIcon />`; - -exports[`should render correctly 3`] = `<CodeSmellIcon />`; - -exports[`should render correctly 4`] = `<SecurityHotspotIcon />`; diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap deleted file mode 100644 index 4373bb03f4c..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/IssueTypeIcon-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<IssueIcon - type="BUG" -/> -`; - -exports[`should render correctly 2`] = ` -<IssueIcon - className="my-class" - type="SECURITY_HOTSPOT" -/> -`; - -exports[`should render correctly 3`] = ` -<IssueIcon - type="CODE_SMELL" -/> -`; - -exports[`should render correctly 4`] = ` -<IssueIcon - type="VULNERABILITY" -/> -`; diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap deleted file mode 100644 index 12b493c10ed..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/TestStatusIcon-test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = `<OkTestStatusIcon />`; - -exports[`should render correctly 2`] = `<FailureTestStatusIcon />`; - -exports[`should render correctly 3`] = `<SkippedTestStatusIcon />`; - -exports[`should render correctly 4`] = `<ErrorTestStatusIcon />`; diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx b/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx deleted file mode 100644 index fe2e5edc863..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockFlowLocation } from '../../../helpers/testMocks'; -import { click } from '../../../helpers/testUtils'; -import { FlowLocation } from '../../../types/types'; -import CrossFileLocationsNavigator from '../CrossFileLocationNavigator'; - -const location1: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }, -}; - -const location2: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }, -}; - -const location3: FlowLocation = { - component: 'bar', - componentName: 'src/bar.js', - msg: 'Do not use bar', - textRange: { startLine: 15, endLine: 16, startOffset: 4, endOffset: 6 }, -}; - -const location4: FlowLocation = { - component: 'bar', - componentName: 'src/bar.js', - msg: 'Do not use bar', - textRange: { startLine: 17, endLine: 18, startOffset: 7, endOffset: 9 }, -}; - -it('should render with no locations', () => { - expect(shallowRender({ locations: [] })).toMatchSnapshot(); -}); - -it('should render locations with no component name', () => { - expect(shallowRender({ locations: [mockFlowLocation({ componentName: '' })] })).toMatchSnapshot(); -}); - -it('should render', () => { - const wrapper = shallowRender(); - - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(2); - - click(wrapper.find('.location-file-more')); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(4); -}); - -it('should render all locations', () => { - const wrapper = shallowRender({ locations: [location1, location2, location3] }); - - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(3); -}); - -it('should expand all locations', () => { - const wrapper = shallowRender(); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(2); - - wrapper.setProps({ selectedLocationIndex: 1 }); - expect(wrapper.find('SingleFileLocationNavigator').length).toBe(4); -}); - -function shallowRender(props: Partial<CrossFileLocationsNavigator['props']> = {}) { - return shallow<CrossFileLocationsNavigator>( - <CrossFileLocationsNavigator - locations={[location1, location2, location3, location4]} - onLocationSelect={jest.fn()} - selectedLocationIndex={undefined} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx b/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx deleted file mode 100644 index 683c94949ba..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockIssue } from '../../../helpers/testMocks'; -import { FlowLocation } from '../../../types/types'; -import LocationsList from '../LocationsList'; - -const location1: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }, -}; - -const location2: FlowLocation = { - component: 'foo', - componentName: 'src/foo.js', - msg: 'Do not use foo', - textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }, -}; - -it('should render locations in the same file', () => { - const locations = [location1, location2]; - expect(shallowRender({ locations })).toMatchSnapshot(); -}); - -it('should not render locations', () => { - const wrapper = shallowRender({ locations: [] }); - expect(wrapper.type()).toBeNull(); -}); - -function shallowRender(overrides: Partial<LocationsList['props']> = {}) { - return shallow<LocationsList>( - <LocationsList - locations={mockIssue().secondaryLocations} - componentKey="foo" - onLocationSelect={jest.fn()} - selectedLocationIndex={undefined} - {...overrides} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap b/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap deleted file mode 100644 index 581e8c21603..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/CrossFileLocationsNavigator-test.tsx.snap +++ /dev/null @@ -1,109 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<div - className="spacer-top" -> - <div - className="locations-navigator-file" - key="0" - > - <div - className="location-file" - > - <i - className="location-file-circle little-spacer-right" - /> - src/foo.js - </div> - <div - className="location-file-locations" - > - <SingleFileLocationNavigator - index={0} - key="0" - message="Do not use foo" - onClick={[MockFunction]} - selected={false} - /> - </div> - </div> - <div - className="locations-navigator-file" - > - <div - className="location-file" - > - <i - className="location-file-circle-multiple little-spacer-right" - /> - <a - className="location-file-more" - href="#" - onClick={[Function]} - > - issues.x_more_locations.2 - </a> - </div> - </div> - <div - className="locations-navigator-file" - key="1" - > - <div - className="location-file" - > - <i - className="location-file-circle little-spacer-right" - /> - src/bar.js - </div> - <div - className="location-file-locations" - > - <SingleFileLocationNavigator - index={3} - key="3" - message="Do not use bar" - onClick={[MockFunction]} - selected={false} - /> - </div> - </div> -</div> -`; - -exports[`should render locations with no component name 1`] = ` -<div - className="spacer-top" -> - <div - className="locations-navigator-file" - key="0" - > - <div - className="location-file" - > - <i - className="location-file-circle little-spacer-right" - /> - </div> - <div - className="location-file-locations" - > - <SingleFileLocationNavigator - index={0} - key="0" - onClick={[MockFunction]} - selected={false} - /> - </div> - </div> -</div> -`; - -exports[`should render with no locations 1`] = ` -<div - className="spacer-top" -/> -`; diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap b/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap deleted file mode 100644 index 8421b5c343e..00000000000 --- a/server/sonar-web/src/main/js/components/locations/__tests__/__snapshots__/LocationsList-test.tsx.snap +++ /dev/null @@ -1,30 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render locations in the same file 1`] = ` -<ul - className="spacer-top" -> - <li - className="display-flex-column" - key="0" - > - <SingleFileLocationNavigator - index={0} - message="Do not use foo" - onClick={[MockFunction]} - selected={false} - /> - </li> - <li - className="display-flex-column" - key="1" - > - <SingleFileLocationNavigator - index={1} - message="Do not use foo" - onClick={[MockFunction]} - selected={false} - /> - </li> -</ul> -`; diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx b/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx deleted file mode 100644 index c47d4ed9c21..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/Measure-test.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { MetricKey, MetricType } from '../../../types/metrics'; -import Measure from '../Measure'; - -it('renders trivial measure', () => { - expect( - shallow( - <Measure metricKey={MetricKey.coverage} metricType={MetricType.Percent} value="73.0" />, - ), - ).toMatchSnapshot(); -}); - -it('renders leak measure', () => { - expect( - shallow( - <Measure metricKey={MetricKey.new_coverage} metricType={MetricType.Percent} value="36.0" />, - ), - ).toMatchSnapshot(); -}); - -it('renders LEVEL', () => { - expect( - shallow( - <Measure metricKey="quality_gate_status" metricType={MetricType.Level} value="ERROR" />, - ), - ).toMatchSnapshot(); -}); - -it('renders RATING', () => { - expect( - shallow( - <Measure metricKey={MetricKey.sqale_rating} metricType={MetricType.Rating} value="3" />, - ), - ).toMatchSnapshot(); -}); - -it('renders undefined measure', () => { - expect( - shallow(<Measure metricKey="foo" metricType={MetricType.Percent} value={undefined} />), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx b/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx deleted file mode 100644 index 53a0c30caea..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockAppState } from '../../../helpers/testMocks'; -import { GlobalSettingKeys } from '../../../types/settings'; -import { MetricKey } from '../../../types/metrics'; -import { RatingTooltipContent, RatingTooltipContentProps } from '../RatingTooltipContent'; - -it('should render maintainability correctly', () => { - expect(shallowRender()).toMatchSnapshot('sqale rating'); - expect(shallowRender({ value: 1 })).toMatchSnapshot('sqale rating A'); - expect(shallowRender({ appState: mockAppState({ settings: {} }) })).toMatchSnapshot( - 'sqale rating default grid', - ); - expect( - shallowRender({ - appState: mockAppState({ settings: { [GlobalSettingKeys.RatingGrid]: '0,0.1' } }), - }), - ).toMatchSnapshot('sqale rating wrong grid'); -}); - -it('should render other ratings correctly', () => { - expect(shallowRender({ metricKey: MetricKey.security_rating })).toMatchSnapshot( - 'security rating', - ); - expect(shallowRender({ metricKey: MetricKey.new_security_rating })).toMatchSnapshot( - 'new security rating', - ); -}); - -it('should ignore non-rating metrics', () => { - expect(shallowRender({ metricKey: MetricKey.code_smells }).type()).toBeNull(); -}); - -function shallowRender(overrides: Partial<RatingTooltipContentProps> = {}) { - return shallow( - <RatingTooltipContent - appState={mockAppState({ settings: { [GlobalSettingKeys.RatingGrid]: '0.05,0.1,0.2,0.4' } })} - metricKey={MetricKey.sqale_rating} - value={2} - {...overrides} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap b/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap deleted file mode 100644 index 3a30c9bed84..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/Measure-test.tsx.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders LEVEL 1`] = ` -<Level - level="ERROR" -/> -`; - -exports[`renders RATING 1`] = ` -<Tooltip - overlay={ - <withAppStateContext(RatingTooltipContent) - metricKey="sqale_rating" - value="3" - /> - } -> - <span> - <Rating - value="3" - /> - </span> -</Tooltip> -`; - -exports[`renders leak measure 1`] = ` -<span> - 36.0% -</span> -`; - -exports[`renders trivial measure 1`] = ` -<span> - 73.0% -</span> -`; - -exports[`renders undefined measure 1`] = ` -<span> - — -</span> -`; diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap b/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap deleted file mode 100644 index 2ce6e0cef37..00000000000 --- a/server/sonar-web/src/main/js/components/measure/__tests__/__snapshots__/RatingTooltipContent-test.tsx.snap +++ /dev/null @@ -1,37 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render maintainability correctly: sqale rating 1`] = ` -<Fragment> - metric.sqale_rating.tooltip.B.5.0% -</Fragment> -`; - -exports[`should render maintainability correctly: sqale rating A 1`] = ` -<Fragment> - metric.sqale_rating.tooltip.A.5.0% -</Fragment> -`; - -exports[`should render maintainability correctly: sqale rating default grid 1`] = ` -<Fragment> - metric.sqale_rating.tooltip.B.0.0% -</Fragment> -`; - -exports[`should render maintainability correctly: sqale rating wrong grid 1`] = ` -<Fragment> - metric.sqale_rating.tooltip.B.0.0% -</Fragment> -`; - -exports[`should render other ratings correctly: new security rating 1`] = ` -<Fragment> - metric.security_rating.tooltip.B -</Fragment> -`; - -exports[`should render other ratings correctly: security rating 1`] = ` -<Fragment> - metric.security_rating.tooltip.B -</Fragment> -`; diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx b/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx deleted file mode 100644 index 4347ad4fc7e..00000000000 --- a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import DrilldownLink from '../DrilldownLink'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); -it('should render issuesLink correctly', () => { - const wrapper = shallowRender({ metric: 'new_violations' }); - expect(wrapper).toMatchSnapshot(); -}); - -const shallowRender = (props: Partial<DrilldownLink['props']> = {}, label = 'label') => { - return shallow<DrilldownLink>( - <DrilldownLink component="project123" metric="other" {...props}> - {label} - </DrilldownLink>, - ); -}; diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap b/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap deleted file mode 100644 index d6babd44056..00000000000 --- a/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<ForwardRef(Link) - to={ - { - "pathname": "/component_measures", - "search": "?id=project123&metric=other&view=list", - } - } -> - label -</ForwardRef(Link)> -`; - -exports[`should render issuesLink correctly 1`] = ` -<ForwardRef(Link) - to={ - { - "hash": "", - "pathname": "/project/issues", - "search": "?resolved=false&id=project123", - } - } -> - label -</ForwardRef(Link)> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx deleted file mode 100644 index 55c991ab96c..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { Alert, AlertProps } from '../Alert'; - -it('should render properly', () => { - expect(shallowRender({ variant: 'error' })).toMatchSnapshot(); -}); - -it('verification of all variants of alert', () => { - const variants: AlertProps['variant'][] = ['error', 'warning', 'success', 'info', 'loading']; - variants.forEach((variant) => { - const wrapper = shallowRender({ variant }); - expect(wrapper.prop('variantInfo')).toMatchSnapshot(); - }); -}); - -it('should render inline alert', () => { - expect(shallowRender({ display: 'inline' }).find('Styled(div)[isInline=true]').exists()).toBe( - true, - ); -}); - -it('should render banner alert', () => { - expect(shallowRender({ display: 'banner' }).find('Styled(div)[isBanner=true]').exists()).toBe( - true, - ); -}); - -it('should render banner alert with correct css', () => { - expect(shallowRender({ display: 'banner' }).render()).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<AlertProps>) { - return shallow( - <Alert className="alert-test" id="error-message" variant="error" {...props}> - This is an error! - </Alert>, - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx deleted file mode 100644 index c636e036ce2..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/AutoEllipsis-test.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { mount, shallow } from 'enzyme'; -import * as React from 'react'; -import AutoEllipsis, { defaultShouldEllipsis } from '../AutoEllipsis'; - -it('should render', () => { - const wrapper = shallow( - <AutoEllipsis maxWidth={5} useParent={false}> - <span className="medium">my test text</span> - </AutoEllipsis>, - ); - - expect(wrapper).toMatchSnapshot(); -}); - -it('should render with text-ellipsis class', () => { - const wrapper = mount( - <AutoEllipsis customShouldEllipsis={() => true} maxWidth={5} useParent={false}> - <span className="medium">my test text</span> - </AutoEllipsis>, - ); - - expect(wrapper.find('span').hasClass('medium')).toBe(true); - expect(wrapper.find('span').hasClass('text-ellipsis')).toBe(true); -}); - -const node5 = { clientWidth: 5, clientHeight: 5 } as any; -const node10 = { clientWidth: 10, clientHeight: 10 } as any; -const nodeParentSmaller = { ...node10, parentElement: node5 }; -const nodeParentBigger = { ...node5, parentElement: node10 }; - -it('should correctly compute the auto-ellipsis', () => { - expect(defaultShouldEllipsis(node10, { maxWidth: 5, useParent: false })).toBe(true); - expect(defaultShouldEllipsis(node10, { maxHeight: 5, useParent: false })).toBe(true); - expect(defaultShouldEllipsis(node10, { maxWidth: 5, maxHeight: 5, useParent: false })).toBe(true); - expect(defaultShouldEllipsis(node10, { maxWidth: 5, maxHeight: 10, useParent: false })).toBe( - true, - ); - expect(defaultShouldEllipsis(node10, { maxWidth: 10, maxHeight: 5, useParent: false })).toBe( - true, - ); - expect(defaultShouldEllipsis(node10, { maxWidth: 10, useParent: false })).toBe(false); - expect(defaultShouldEllipsis(node10, { maxHeight: 10, useParent: false })).toBe(false); - - expect(defaultShouldEllipsis(nodeParentSmaller, { maxWidth: 10, useParent: false })).toBe(false); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxHeight: 10, useParent: false })).toBe(false); -}); - -it('should correctly compute the auto-ellipsis with a parent node', () => { - expect(defaultShouldEllipsis(nodeParentSmaller, {})).toBe(true); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxWidth: 10 })).toBe(true); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxHeight: 10 })).toBe(true); - expect(defaultShouldEllipsis(nodeParentSmaller, { maxWidth: 10, maxHeight: 10 })).toBe(false); - expect(defaultShouldEllipsis(nodeParentBigger, {})).toBe(false); - expect(defaultShouldEllipsis(nodeParentBigger, { maxWidth: 2 })).toBe(true); - expect(defaultShouldEllipsis(nodeParentBigger, { maxHeight: 2 })).toBe(true); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx deleted file mode 100644 index 15b929b6f68..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import CoverageRating, { CoverageRatingProps } from '../CoverageRating'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should render with muted style', () => { - expect(shallowRender({ muted: true }).find('DonutChart').prop('data')).toEqual([ - { fill: '#b4b4b4', value: 25 }, - { fill: 'transparent', value: 75 }, - ]); -}); - -it('should render with small size', () => { - expect(shallowRender({ size: 'small' }).find('DonutChart').props()).toMatchObject({ - height: 20, - padAngle: 0.1, - thickness: 3, - width: 20, - }); -}); - -it('should correctly handle padAngle for 0% and 100% coverage', () => { - const wrapper = shallowRender({ value: 0 }); - expect(wrapper.find('DonutChart').prop('padAngle')).toBe(0); - - wrapper.setProps({ value: 25 }); - expect(wrapper.find('DonutChart').prop('padAngle')).toBe(0.1); - - wrapper.setProps({ value: 100 }); - expect(wrapper.find('DonutChart').prop('padAngle')).toBe(0); -}); - -function shallowRender(props: Partial<CoverageRatingProps> = {}) { - return shallow(<CoverageRating value={25} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx deleted file mode 100644 index ba56087943f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import React from 'react'; -import { ButtonIcon } from '../../../components/controls/buttons'; -import { save } from '../../../helpers/storage'; -import { click } from '../../../helpers/testUtils'; -import DismissableAlert, { - DismissableAlertProps, - DISMISSED_ALERT_STORAGE_KEY, -} from '../DismissableAlert'; - -jest.mock('../../../helpers/storage', () => ({ - get: jest.fn((_: string, suffix: string) => (suffix === 'bar' ? 'true' : undefined)), - save: jest.fn(), -})); - -jest.mock('react', () => { - return { - ...jest.requireActual('react'), - useEffect: jest.fn(), - }; -}); - -beforeEach(() => { - jest.clearAllMocks(); - (React.useEffect as jest.Mock).mockImplementationOnce((f) => f()); -}); - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should render correctly with a non-default display', () => { - expect(shallowRender({ display: 'block' })).toMatchSnapshot(); -}); - -it('should not render if it was dismissed', () => { - expect(shallowRender({ alertKey: 'bar' }).type()).toBeNull(); -}); - -it('should correctly allow dismissing', () => { - const wrapper = shallowRender(); - click(wrapper.dive().find(ButtonIcon)); - expect(save).toHaveBeenCalledWith(DISMISSED_ALERT_STORAGE_KEY, 'true', 'foo'); -}); - -function shallowRender(props: Partial<DismissableAlertProps> = {}) { - return shallow<DismissableAlertProps>( - <DismissableAlert alertKey="foo" variant="info" {...props}> - <div>My content</div> - </DismissableAlert>, - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx deleted file mode 100644 index d6b6fe2bd07..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/GenericAvatar-test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import GenericAvatar from '../GenericAvatar'; - -it('should render properly', () => { - expect(shallow(<GenericAvatar name="foo" size={40} />)).toMatchSnapshot(); - expect(shallow(<GenericAvatar name="foo" size={40} round />)).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx deleted file mode 100644 index 9c386ad5d6d..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/LegacyAvatar-test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockAppState } from '../../../helpers/testMocks'; -import { GlobalSettingKeys } from '../../../types/settings'; -import { LegacyAvatar } from '../LegacyAvatar'; - -const gravatarServerUrl = 'http://example.com/{EMAIL_MD5}.jpg?s={SIZE}'; - -it('should be able to render with hash only', () => { - const avatar = shallow( - <LegacyAvatar - appState={mockAppState({ - settings: { - [GlobalSettingKeys.EnableGravatar]: 'true', - [GlobalSettingKeys.GravatarServerUrl]: gravatarServerUrl, - }, - })} - hash="7daf6c79d4802916d83f6266e24850af" - name="Foo" - size={30} - />, - ); - expect(avatar).toMatchSnapshot(); -}); - -it('falls back to dummy avatar', () => { - const avatar = shallow( - <LegacyAvatar appState={mockAppState({ settings: {} })} name="Foo Bar" size={30} />, - ); - expect(avatar).toMatchSnapshot(); -}); - -it('do not fail when name is missing', () => { - const avatar = shallow( - <LegacyAvatar appState={mockAppState({ settings: {} })} name={undefined} size={30} />, - ); - expect(avatar.getElement()).toBeNull(); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx deleted file mode 100644 index 7cfa7d63aef..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/Level-test.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import Level, { LevelProps } from '../Level'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default ok'); - expect(shallowRender({ level: 'ERROR' })).toMatchSnapshot('default error'); - expect(shallowRender({ muted: true, small: true })).toMatchSnapshot('muted and small'); - expect(shallowRender({ 'aria-label': 'ARIA Label' })).toMatchSnapshot('with aria-label'); - expect(shallowRender({ 'aria-labelledby': 'element-id' })).toMatchSnapshot( - 'with aria-labelledby', - ); -}); - -function shallowRender(props: Partial<LevelProps> = {}) { - return shallow(<Level className="foo" level="OK" {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx deleted file mode 100644 index cd9f0fa3176..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldMarker-test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import MandatoryFieldMarker, { MandatoryFieldMarkerProps } from '../MandatoryFieldMarker'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({ className: 'foo-bar' })).toMatchSnapshot('with className'); -}); - -function shallowRender(props: Partial<MandatoryFieldMarkerProps> = {}) { - return shallow<MandatoryFieldMarkerProps>(<MandatoryFieldMarker {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx deleted file mode 100644 index e0af00cf22f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/NavBar-test.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import NavBar, { NavBarProps } from '../NavBar'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -it('should render correctly with notif and not limited', () => { - const wrapper = shallowRender({ limited: false, notif: <div className="my-notifs" /> }); - expect(wrapper).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<NavBarProps> = {}) { - return shallow( - <NavBar height={42} {...props}> - <div className="my-navbar-content" /> - </NavBar>, - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx deleted file mode 100644 index c8c9772618d..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/NewsBox-test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import NewsBox, { Props } from '../NewsBox'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should call onClose', () => { - const onClose = jest.fn(); - const wrapper = shallowRender({ onClose }); - - click(wrapper.find('ClearButton')); - expect(onClose).toHaveBeenCalled(); -}); - -function shallowRender(props: Partial<Props> = {}) { - return shallow( - <NewsBox onClose={jest.fn()} title="title" {...props}> - <div>description</div> - </NewsBox>, - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx deleted file mode 100644 index 0873c3d6233..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/Rating-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import Rating from '../Rating'; - -it('renders numeric value', () => { - expect(shallow(<Rating value={2} />)).toMatchSnapshot(); -}); - -it('renders string value', () => { - expect(shallow(<Rating value="2.0" muted />)).toMatchSnapshot(); -}); - -it('renders undefined value', () => { - expect(shallow(<Rating value={undefined} muted />)).toMatchSnapshot(); -}); - -it('renders with a custom aria-label', () => { - expect(shallow(<Rating aria-label="custom" aria-hidden={false} value="2.0" />)).toMatchSnapshot(); - expect( - shallow(<Rating aria-label="custom" aria-hidden={false} value={undefined} />), - ).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx deleted file mode 100644 index 5c21419223f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/SizeRating-test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import SizeRating, { Props } from '../SizeRating'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ muted: true, value: 1000 })).toMatchSnapshot(); - expect(shallowRender({ value: 10000 })).toMatchSnapshot(); - expect(shallowRender({ value: 100000 })).toMatchSnapshot(); - expect(shallowRender({ value: 500000 })).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<Props> = {}) { - return shallow(<SizeRating value={100} {...props} />); -} diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap deleted file mode 100644 index ed55cd5b070..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Alert-test.tsx.snap +++ /dev/null @@ -1,152 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render banner alert with correct css 1`] = ` -.emotion-0 { - border: 1px solid; - border-radius: 2px; - margin-bottom: 8px; - border-color: #f4b1b0; - background-color: #f2dede; - color: #862422; - display: block; -} - -.emotion-0:empty { - display: none; -} - -.emotion-0 a, -.emotion-0 .button-link { - border-color: rgba(35, 107, 151, 0.40); -} - -.emotion-0 a:hover, -.emotion-0 .button-link:hover { - border-color: #236a97; -} - -.emotion-0 .alert-inner { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: stretch; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - min-width: 1080px; - max-width: 1320px; - margin-left: auto; - margin-right: auto; - padding-left: 20px; - padding-right: 20px; - box-sizing: border-box; -} - -.emotion-0 .alert-icon { - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - 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; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - width: calc(2 * 8px); - border-right: none; - border-color: #f4b1b0; -} - -.emotion-0 .alert-content { - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - overflow: auto; - text-align: left; - padding: 8px calc(2 * 8px); -} - -<div - class="alert alert-test emotion-0" - color="#862422" - id="error-message" -> - <div - class="alert-inner" - > - <div - class="alert-icon" - > - <svg - height="16" - space="preserve" - style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421" - version="1.1" - viewBox="0 0 16 16" - width="16" - xlink="http://www.w3.org/1999/xlink" - > - <title> - alert.tooltip.error - </title> - <path - d="M11.402 10.018q0-0.232-0.17-0.402l-1.616-1.616 1.616-1.616q0.17-0.17 0.17-0.402 0-0.241-0.17-0.411l-0.804-0.804q-0.17-0.17-0.411-0.17-0.232 0-0.402 0.17l-1.616 1.616-1.616-1.616q-0.17-0.17-0.402-0.17-0.241 0-0.411 0.17l-0.804 0.804q-0.17 0.17-0.17 0.411 0 0.232 0.17 0.402l1.616 1.616-1.616 1.616q-0.17 0.17-0.17 0.402 0 0.241 0.17 0.411l0.804 0.804q0.17 0.17 0.411 0.17 0.232 0 0.402-0.17l1.616-1.616 1.616 1.616q0.17 0.17 0.402 0.17 0.241 0 0.411-0.17l0.804-0.804q0.17-0.17 0.17-0.411zM14.857 8q0 1.866-0.92 3.442t-2.496 2.496-3.442 0.92-3.442-0.92-2.496-2.496-0.92-3.442 0.92-3.442 2.496-2.496 3.442-0.92 3.442 0.92 2.496 2.496 0.92 3.442z" - style="fill:#a4030f" - /> - </svg> - </div> - <div - class="alert-content" - > - This is an error! - </div> - </div> -</div> -`; - -exports[`should render properly 1`] = ` -<Styled(div) - backGroundColor="#f2dede" - borderColor="#f4b1b0" - className="alert alert-test" - color="#862422" - id="error-message" - isBanner={false} - isInline={false} -> - <div - className="alert-inner" - > - <div - className="alert-icon" - > - <AlertErrorIcon - fill="#a4030f" - label="alert.tooltip.error" - /> - </div> - <div - className="alert-content" - > - This is an error! - </div> - </div> -</Styled(div)> -`; - -exports[`verification of all variants of alert 1`] = `undefined`; - -exports[`verification of all variants of alert 2`] = `undefined`; - -exports[`verification of all variants of alert 3`] = `undefined`; - -exports[`verification of all variants of alert 4`] = `undefined`; - -exports[`verification of all variants of alert 5`] = `undefined`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap deleted file mode 100644 index 84212d45e27..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/AutoEllipsis-test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<span - className="medium" -> - my test text -</span> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap deleted file mode 100644 index db41604b673..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/CoverageRating-test.tsx.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<DonutChart - data={ - [ - { - "fill": "#008223", - "value": 25, - }, - { - "fill": "#D02F3A", - "value": 75, - }, - ] - } - height={24} - padAngle={0.1} - thickness={3} - width={24} -/> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap deleted file mode 100644 index 315d3fdd028..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/DismissableAlert-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<DismissableAlertComponent - alertKey="foo" - onDismiss={[Function]} - variant="info" -> - <div> - My content - </div> -</DismissableAlertComponent> -`; - -exports[`should render correctly with a non-default display 1`] = ` -<DismissableAlertComponent - alertKey="foo" - display="block" - onDismiss={[Function]} - variant="info" -> - <div> - My content - </div> -</DismissableAlertComponent> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap deleted file mode 100644 index 1843c62c51e..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/GenericAvatar-test.tsx.snap +++ /dev/null @@ -1,47 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render properly 1`] = ` -<div - className="rounded" - style={ - { - "backgroundColor": "#c68c01", - "borderRadius": undefined, - "color": "#fff", - "display": "inline-block", - "fontSize": 14, - "fontWeight": "normal", - "height": 40, - "lineHeight": "40px", - "textAlign": "center", - "verticalAlign": "top", - "width": 40, - } - } -> - F -</div> -`; - -exports[`should render properly 2`] = ` -<div - className="rounded" - style={ - { - "backgroundColor": "#c68c01", - "borderRadius": "50%", - "color": "#fff", - "display": "inline-block", - "fontSize": 14, - "fontWeight": "normal", - "height": 40, - "lineHeight": "40px", - "textAlign": "center", - "verticalAlign": "top", - "width": 40, - } - } -> - F -</div> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap deleted file mode 100644 index 0083612ce2f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/LegacyAvatar-test.tsx.snap +++ /dev/null @@ -1,18 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`falls back to dummy avatar 1`] = ` -<GenericAvatar - name="Foo Bar" - size={30} -/> -`; - -exports[`should be able to render with hash only 1`] = ` -<img - alt="Foo" - className="rounded" - height={30} - src="http://example.com/7daf6c79d4802916d83f6266e24850af.jpg?s=60" - width={30} -/> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap deleted file mode 100644 index 089171fcc17..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Level-test.tsx.snap +++ /dev/null @@ -1,43 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default error 1`] = ` -<span - className="foo level level-ERROR" -> - ERROR -</span> -`; - -exports[`should render correctly: default ok 1`] = ` -<span - className="foo level level-OK" -> - OK -</span> -`; - -exports[`should render correctly: muted and small 1`] = ` -<span - className="foo level level-OK level-small level-muted" -> - OK -</span> -`; - -exports[`should render correctly: with aria-label 1`] = ` -<span - aria-label="ARIA Label" - className="foo level level-OK" -> - OK -</span> -`; - -exports[`should render correctly: with aria-labelledby 1`] = ` -<span - aria-labelledby="element-id" - className="foo level level-OK" -> - OK -</span> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap deleted file mode 100644 index 1adb77718dd..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/MandatoryFieldMarker-test.tsx.snap +++ /dev/null @@ -1,19 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly: default 1`] = ` -<em - aria-label="field_required" - className="mandatory little-spacer-left" -> - * -</em> -`; - -exports[`should render correctly: with className 1`] = ` -<em - aria-label="field_required" - className="mandatory little-spacer-left foo-bar" -> - * -</em> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap deleted file mode 100644 index 835861f3c9d..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NavBar-test.tsx.snap +++ /dev/null @@ -1,64 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<nav - className="navbar" - style={ - { - "height": 42, - "top": undefined, - } - } -> - <div - className="navbar-inner" - style={ - { - "height": 42, - "left": 0, - } - } - > - <div - className="clearfix navbar-limited" - > - <div - className="my-navbar-content" - /> - </div> - </div> -</nav> -`; - -exports[`should render correctly with notif and not limited 1`] = ` -<nav - className="navbar" - style={ - { - "height": 42, - "top": undefined, - } - } -> - <div - className="navbar-inner navbar-inner-with-notif" - style={ - { - "height": 42, - "left": 0, - } - } - > - <div - className="clearfix" - > - <div - className="my-navbar-content" - /> - </div> - <div - className="my-notifs" - /> - </div> -</nav> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap deleted file mode 100644 index dac3a79b149..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/NewsBox-test.tsx.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div - className="news-box" - role="alert" -> - <div - className="news-box-header" - > - <div - className="display-flex-center" - > - <span - className="badge badge-info spacer-right" - > - new - </span> - <strong> - title - </strong> - </div> - <ClearButton - className="button-tiny" - iconProps={ - { - "size": 12, - "thin": true, - } - } - onClick={[MockFunction]} - /> - </div> - <div - className="big-spacer-top note" - > - <div> - description - </div> - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap deleted file mode 100644 index ae144aba8fc..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/Rating-test.tsx.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders numeric value 1`] = ` -<span - aria-label="metric.has_rating_X.B" - className="rating rating-B" -> - B -</span> -`; - -exports[`renders string value 1`] = ` -<span - aria-label="metric.has_rating_X.B" - className="rating rating-B rating-muted" -> - B -</span> -`; - -exports[`renders undefined value 1`] = ` -<span - aria-label="metric.no_rating" - className="no-rating rating-muted" -> - – -</span> -`; - -exports[`renders with a custom aria-label 1`] = ` -<span - aria-hidden={false} - aria-label="custom" - className="rating rating-B" -> - B -</span> -`; - -exports[`renders with a custom aria-label 2`] = ` -<span - aria-hidden={false} - aria-label="custom" - className="no-rating" -> - – -</span> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap deleted file mode 100644 index cbbdbe32d2c..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/SizeRating-test.tsx.snap +++ /dev/null @@ -1,46 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div - aria-hidden="true" - className="size-rating" -> - XS -</div> -`; - -exports[`should render correctly 2`] = ` -<div - aria-hidden="true" - className="size-rating size-rating-muted" -> - S -</div> -`; - -exports[`should render correctly 3`] = ` -<div - aria-hidden="true" - className="size-rating" -> - M -</div> -`; - -exports[`should render correctly 4`] = ` -<div - aria-hidden="true" - className="size-rating" -> - L -</div> -`; - -exports[`should render correctly 5`] = ` -<div - aria-hidden="true" - className="size-rating" -> - XL -</div> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap deleted file mode 100644 index 48509a51d6f..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/popups-test.tsx.snap +++ /dev/null @@ -1,79 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Popup should render Popup 1`] = ` -<ClickEventBoundary> - <div - className="popup is-left-top foo" - style={ - { - "left": -5, - } - } - > - <PopupArrow - style={ - { - "top": -5, - } - } - /> - </div> -</ClickEventBoundary> -`; - -exports[`Popup should render PopupArrow 1`] = ` -<div - className="popup-arrow" - style={ - { - "left": -5, - } - } -/> -`; - -exports[`PortalPopup should render correctly with overlay 1`] = ` -<Fragment> - <div - id="popup-trigger" - /> - <PortalWrapper> - <ScreenPositionFixer - ready={true} - > - <Component /> - </ScreenPositionFixer> - </PortalWrapper> -</Fragment> -`; - -exports[`PortalPopup should render correctly with overlay 2`] = ` -<Popup - arrowStyle={ - { - "marginLeft": 0, - } - } - placement="bottom" - style={ - { - "height": 10, - "left": 0, - "top": 0, - "width": 10, - } - } -> - <span - id="overlay" - /> -</Popup> -`; - -exports[`PortalPopup should render correctly without overlay 1`] = ` -<Fragment> - <div - id="popup-trigger" - /> -</Fragment> -`; diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx deleted file mode 100644 index 969b4eef1e1..00000000000 --- a/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { findDOMNode } from 'react-dom'; -import ScreenPositionFixer from '../../controls/ScreenPositionFixer'; -import { Popup, PopupArrow, PopupPlacement, PortalPopup } from '../popups'; - -jest.mock('react-dom', () => ({ - ...jest.requireActual('react-dom'), - findDOMNode: jest.fn().mockReturnValue(undefined), -})); - -describe('Popup', () => { - it('should render Popup', () => { - expect( - shallow( - <Popup - arrowStyle={{ top: -5 }} - className="foo" - placement={PopupPlacement.LeftTop} - style={{ left: -5 }} - />, - ), - ).toMatchSnapshot(); - }); - - it('should render PopupArrow', () => { - expect(shallow(<PopupArrow style={{ left: -5 }} />)).toMatchSnapshot(); - }); -}); - -describe('PortalPopup', () => { - it('should render correctly without overlay', () => { - expect(shallowRender({ overlay: undefined })).toMatchSnapshot(); - }); - - it('should render correctly with overlay', () => { - const wrapper = shallowRender(); - wrapper.setState({ left: 0, top: 0, width: 10, height: 10 }); - expect(wrapper).toMatchSnapshot(); - expect(wrapper.find(ScreenPositionFixer).dive()).toMatchSnapshot(); - }); - - it('should correctly compute the popup positioning', () => { - const fakeDomNode = document.createElement('div'); - fakeDomNode.getBoundingClientRect = jest - .fn() - .mockReturnValue({ left: 10, top: 10, width: 10, height: 10 }); - (findDOMNode as jest.Mock).mockReturnValue(fakeDomNode); - const wrapper = shallowRender(); - const getPlacementSpy = jest.spyOn(wrapper.instance(), 'getPlacement'); - - wrapper.instance().popupNode = { - current: { - getBoundingClientRect: jest.fn().mockReturnValue({ width: 8, height: 8 }), - } as any, - }; - - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 11, top: 20 })); - - getPlacementSpy.mockReturnValue(PopupPlacement.BottomLeft); - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 10, top: 20 })); - - getPlacementSpy.mockReturnValue(PopupPlacement.BottomRight); - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 12, top: 20 })); - - getPlacementSpy.mockReturnValue(PopupPlacement.LeftTop); - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 2, top: 10 })); - - getPlacementSpy.mockReturnValue(PopupPlacement.RightBottom); - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 20, top: 12 })); - - getPlacementSpy.mockReturnValue(PopupPlacement.RightTop); - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 20, top: 10 })); - - getPlacementSpy.mockReturnValue(PopupPlacement.TopLeft); - wrapper.instance().positionPopup(); - expect(wrapper.state()).toEqual(expect.objectContaining({ left: 10, top: 2 })); - }); - - it('should correctly compute the popup arrow positioning', () => { - const wrapper = shallowRender({ arrowOffset: -2 }); - - expect( - wrapper - .instance() - .adjustArrowPosition(PopupPlacement.BottomLeft, { leftFix: 10, topFix: 10 }), - ).toEqual({ marginLeft: -12 }); - - expect( - wrapper - .instance() - .adjustArrowPosition(PopupPlacement.RightBottom, { leftFix: 10, topFix: 10 }), - ).toEqual({ marginTop: -12 }); - }); - - function shallowRender(props: Partial<PortalPopup['props']> = {}) { - return shallow<PortalPopup>( - <PortalPopup overlay={<span id="overlay" />} {...props}> - <div id="popup-trigger" /> - </PortalPopup>, - ); - } -}); diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx deleted file mode 100644 index a92ad1aa9ba..00000000000 --- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { HttpStatus } from '../../../../helpers/request'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import MetaData from '../MetaData'; -import { mockMetaDataInformation } from '../mocks/update-center-metadata'; -import { MetaDataInformation } from '../update-center-metadata'; - -beforeAll(() => { - window.fetch = jest.fn(); -}); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -it('should render correctly', async () => { - const metaDataInfo = mockMetaDataInformation(); - mockFetchReturnValue(metaDataInfo); - - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); - -it('should render correctly with organization', async () => { - const metaDataInfo = mockMetaDataInformation({ - organization: { name: 'test-org', url: 'test-org-url' }, - }); - mockFetchReturnValue(metaDataInfo); - - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); - -it('should not render anything if call for metadata fails', async () => { - const metaDataInfo = mockMetaDataInformation(); - mockFetchReturnValue(metaDataInfo, HttpStatus.NotFound); - - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - expect(wrapper.type()).toBeNull(); -}); - -it('should fetch metadata again if the update center key if modified', async () => { - const metaDataInfo = mockMetaDataInformation(); - mockFetchReturnValue(metaDataInfo); - - const wrapper = shallowRender(); - await waitAndUpdate(wrapper); - - expect(window.fetch).toHaveBeenCalledTimes(1); - - mockFetchReturnValue(metaDataInfo); - wrapper.setProps({ updateCenterKey: 'abap' }); - - expect(window.fetch).toHaveBeenCalledTimes(2); -}); - -function shallowRender(props?: Partial<MetaData['props']>) { - return shallow<MetaData>(<MetaData updateCenterKey="apex" {...props} />); -} - -function mockFetchReturnValue(metaDataInfo: MetaDataInformation, status = HttpStatus.Ok) { - (window.fetch as jest.Mock).mockResolvedValueOnce({ status, json: () => metaDataInfo }); -} diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx deleted file mode 100644 index c126cd5c33c..00000000000 --- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import MetaDataVersion, { MetaDataVersionProps } from '../MetaDataVersion'; -import { mockMetaDataVersionInformation } from '../mocks/update-center-metadata'; - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect( - shallowRender({ - versionInformation: mockMetaDataVersionInformation({ - downloadURL: [{ label: 'macos 64 bits', url: '' }], - }), - }), - ).toMatchSnapshot('with advanced downloadUrl'); - expect( - shallowRender({ - versionInformation: { version: '2.0' }, - }), - ).toMatchSnapshot('with very few info'); -}); - -function shallowRender(props?: Partial<MetaDataVersionProps>) { - return shallow( - <MetaDataVersion versionInformation={mockMetaDataVersionInformation()} {...props} />, - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx deleted file mode 100644 index ad7b4d683c5..00000000000 --- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../../helpers/testUtils'; -import MetaDataVersion from '../MetaDataVersion'; -import MetaDataVersions from '../MetaDataVersions'; -import { mockMetaDataVersionInformation } from '../mocks/update-center-metadata'; - -it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); -}); - -it('should properly handle show more / show less', () => { - const wrapper = shallowRender(); - expect(wrapper.find(MetaDataVersion).length).toBe(1); - - click(wrapper.find('.update-center-meta-data-versions-show-more')); - expect(wrapper.find(MetaDataVersion).length).toBe(3); -}); - -function shallowRender(props?: Partial<MetaDataVersions['props']>) { - return shallow<MetaDataVersions>( - <MetaDataVersions - versions={[ - mockMetaDataVersionInformation({ version: '3.0' }), - mockMetaDataVersionInformation({ version: '2.0', archived: true }), - mockMetaDataVersionInformation({ version: '1.0', archived: true }), - ]} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaData-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaData-test.tsx.snap deleted file mode 100644 index cf1c23cd2ab..00000000000 --- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaData-test.tsx.snap +++ /dev/null @@ -1,133 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div - className="update-center-meta-data" -> - <div - className="update-center-meta-data-header" - > - <span - className="update-center-meta-data-vendor" - > - By - <a - href="http://www.sonarsource.com/" - rel="noopener noreferrer" - target="_blank" - > - SonarSource - </a> - </span> - <span - className="update-center-meta-data-license" - > - SonarSource - </span> - <span - className="update-center-meta-data-issue-tracker" - > - <a - href="https://jira.sonarsource.com/browse/SONARJAVA" - rel="noopener noreferrer" - target="_blank" - > - Issue Tracker - </a> - </span> - <span - className="update-center-meta-data-supported" - > - Supported by SonarSource - </span> - </div> - <MetaDataVersions - versions={ - [ - { - "archived": false, - "changeLogUrl": "https://example.com/sonar-java-plugin/release", - "compatibility": "6.7", - "date": "2019-05-31", - "downloadURL": "https://example.com/sonar-java-plugin-5.13.0.18197.jar", - "version": "2.0", - }, - { - "archived": true, - "changeLogUrl": "https://example.com/sonar-java-plugin/release", - "compatibility": "6.7", - "date": "2019-05-31", - "downloadURL": "https://example.com/sonar-java-plugin-5.13.0.18197.jar", - "version": "1.0", - }, - ] - } - /> -</div> -`; - -exports[`should render correctly with organization 1`] = ` -<div - className="update-center-meta-data" -> - <div - className="update-center-meta-data-header" - > - <span - className="update-center-meta-data-vendor" - > - By - <a - href="test-org-url" - rel="noopener noreferrer" - target="_blank" - > - test-org - </a> - </span> - <span - className="update-center-meta-data-license" - > - SonarSource - </span> - <span - className="update-center-meta-data-issue-tracker" - > - <a - href="https://jira.sonarsource.com/browse/SONARJAVA" - rel="noopener noreferrer" - target="_blank" - > - Issue Tracker - </a> - </span> - <span - className="update-center-meta-data-supported" - > - Supported by SonarSource - </span> - </div> - <MetaDataVersions - versions={ - [ - { - "archived": false, - "changeLogUrl": "https://example.com/sonar-java-plugin/release", - "compatibility": "6.7", - "date": "2019-05-31", - "downloadURL": "https://example.com/sonar-java-plugin-5.13.0.18197.jar", - "version": "2.0", - }, - { - "archived": true, - "changeLogUrl": "https://example.com/sonar-java-plugin/release", - "compatibility": "6.7", - "date": "2019-05-31", - "downloadURL": "https://example.com/sonar-java-plugin-5.13.0.18197.jar", - "version": "1.0", - }, - ] - } - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersion-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersion-test.tsx.snap deleted file mode 100644 index 7fd964fe2ab..00000000000 --- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersion-test.tsx.snap +++ /dev/null @@ -1,113 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div - className="update-center-meta-data-version" -> - <div - className="update-center-meta-data-version-version" - > - 5.13 - </div> - <div - className="update-center-meta-data-version-release-info" - > - <time - className="update-center-meta-data-version-release-date" - > - 2019-05-31 - </time> - <span - className="update-center-meta-data-version-compatibility" - > - 6.7 - </span> - </div> - <div - className="update-center-meta-data-version-release-links" - > - <span - className="update-center-meta-data-version-download" - key="0" - > - <a - href="https://example.com/sonar-java-plugin-5.13.0.18197.jar" - rel="noopener noreferrer" - target="_blank" - > - Download - </a> - </span> - <span - className="update-center-meta-data-version-release-notes" - > - <a - href="https://example.com/sonar-java-plugin/release" - rel="noopener noreferrer" - target="_blank" - > - Release notes - </a> - </span> - </div> -</div> -`; - -exports[`should render correctly: with advanced downloadUrl 1`] = ` -<div - className="update-center-meta-data-version" -> - <div - className="update-center-meta-data-version-version" - > - 5.13 - </div> - <div - className="update-center-meta-data-version-release-info" - > - <time - className="update-center-meta-data-version-release-date" - > - 2019-05-31 - </time> - <span - className="update-center-meta-data-version-compatibility" - > - 6.7 - </span> - </div> - <div - className="update-center-meta-data-version-release-links" - > - <span - className="update-center-meta-data-version-release-notes" - > - <a - href="https://example.com/sonar-java-plugin/release" - rel="noopener noreferrer" - target="_blank" - > - Release notes - </a> - </span> - </div> -</div> -`; - -exports[`should render correctly: with very few info 1`] = ` -<div - className="update-center-meta-data-version" -> - <div - className="update-center-meta-data-version-version" - > - 2.0 - </div> - <div - className="update-center-meta-data-version-release-info" - /> - <div - className="update-center-meta-data-version-release-links" - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersions-test.tsx.snap b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersions-test.tsx.snap deleted file mode 100644 index 15161bad9ba..00000000000 --- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/__snapshots__/MetaDataVersions-test.tsx.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -<div - className="update-center-meta-data-versions" -> - <button - className="update-center-meta-data-versions-show-more" - onClick={[Function]} - type="button" - > - Show more versions - </button> - <MetaDataVersion - key="3.0" - versionInformation={ - { - "archived": false, - "changeLogUrl": "https://example.com/sonar-java-plugin/release", - "compatibility": "6.7", - "date": "2019-05-31", - "downloadURL": "https://example.com/sonar-java-plugin-5.13.0.18197.jar", - "version": "3.0", - } - } - /> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx index a2fe996bc49..33314e95690 100644 --- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx @@ -22,7 +22,6 @@ import * as React from 'react'; import withAppStateContext from '../../app/components/app-state/withAppStateContext'; import { translate } from '../../helpers/l10n'; import { AppState } from '../../types/appstate'; -import { EditionKey } from '../../types/editions'; import { SystemUpgrade } from '../../types/system'; import Link from '../common/Link'; import Modal from '../controls/Modal'; @@ -93,9 +92,7 @@ export function SystemUpgradeForm(props: Readonly<Props>) { )} {systemUpgradesWithPatch.map((upgrades) => ( <SystemUpgradeItem - edition={ - appState.edition as EditionKey /* TODO: Fix once AppState is no longer ambiant. */ - } + edition={appState.edition} key={upgrades[upgrades.length - 1].version} systemUpgrades={upgrades} isPatch={upgrades === patches} diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx new file mode 100644 index 00000000000..ded6a2667fe --- /dev/null +++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx @@ -0,0 +1,88 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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 userEvent from '@testing-library/user-event'; +import React from 'react'; +import { mockAppState } from '../../../helpers/testMocks'; +import { renderComponent } from '../../../helpers/testReactTestingUtils'; +import { byRole, byText } from '../../../helpers/testSelector'; +import SystemUpgradeButton from '../SystemUpgradeButton'; +import { UpdateUseCase } from '../utils'; + +const ui = { + toggleButton: byRole('button', { name: 'learn_more' }), + + header: byRole('heading', { name: 'system.system_upgrade' }), + downloadLink: byRole('link', { name: /system.see_sonarqube_downloads/ }), + + ltsVersionHeader: byRole('heading', { name: /system.lts_version/ }), + + newPatchWarning: byText(/admin_notification.update/), +}; + +it('should render properly', async () => { + const user = userEvent.setup(); + + renderSystemUpgradeButton(); + + await user.click(ui.toggleButton.get()); + + expect(ui.header.get()).toBeInTheDocument(); + expect(ui.ltsVersionHeader.get()).toBeInTheDocument(); + expect(ui.downloadLink.get()).toBeInTheDocument(); +}); + +it('should render properly for new patch', async () => { + const user = userEvent.setup(); + + renderSystemUpgradeButton( + { + updateUseCase: UpdateUseCase.NewPatch, + latestLTS: '9.9', + systemUpgrades: [{ downloadUrl: '', version: '9.9.1' }], + }, + '9.9', + ); + + await user.click(ui.toggleButton.get()); + + expect(ui.header.get()).toBeInTheDocument(); + expect(ui.newPatchWarning.get()).toBeInTheDocument(); + expect(ui.ltsVersionHeader.get()).toBeInTheDocument(); + expect(ui.downloadLink.get()).toBeInTheDocument(); +}); + +function renderSystemUpgradeButton( + props: Partial<SystemUpgradeButton['props']> = {}, + version = '9.7', +) { + renderComponent( + <SystemUpgradeButton + latestLTS="9.9" + systemUpgrades={[ + { downloadUrl: 'eight', version: '9.8' }, + { downloadUrl: 'lts', version: '9.9' }, + { downloadUrl: 'patch', version: '9.9.1' }, + ]} + {...props} + />, + '', + { appState: mockAppState({ version }) }, + ); +} diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx deleted file mode 100644 index 07b6ece20cb..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeButton-test.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import { Button } from '../../controls/buttons'; -import SystemUpgradeButton from '../SystemUpgradeButton'; -import SystemUpgradeForm from '../SystemUpgradeForm'; - -it('should open modal correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find(Button)); - expect(wrapper.find(SystemUpgradeForm)).toBeDefined(); -}); - -function shallowRender(props: Partial<SystemUpgradeButton['props']> = {}) { - return shallow<SystemUpgradeButton['props']>( - <SystemUpgradeButton systemUpgrades={[]} latestLTS="9.2" {...props} />, - ); -} diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx deleted file mode 100644 index 638514c4086..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx +++ /dev/null @@ -1,89 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { mockAppState } from '../../../helpers/testMocks'; -import { EditionKey } from '../../../types/editions'; -import { SystemUpgradeForm } from '../SystemUpgradeForm'; -import { UpdateUseCase } from '../utils'; - -const UPGRADES = [ - [ - { - version: '6.4', - description: 'Version 6.4 description', - releaseDate: '2017-06-02', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, - { - version: '6.3', - description: 'Version 6.3 description', - releaseDate: '2017-05-02', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, - ], - [ - { - version: '5.6.7', - description: 'Version 5.6.7 description', - releaseDate: '2017-03-01', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, - { - version: '5.6.6', - description: 'Version 5.6.6 description', - releaseDate: '2017-04-02', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, - { - version: '5.6.5', - description: 'Version 5.6.5 description', - releaseDate: '2017-03-01', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, - ], -]; - -it.each([...Object.values(UpdateUseCase), undefined])( - 'should display correctly for %s', - (updateUseCase) => { - expect( - shallow( - <SystemUpgradeForm - appState={mockAppState({ edition: EditionKey.community, version: '5.6.3' })} - onClose={jest.fn()} - systemUpgrades={UPGRADES} - latestLTS="9.1" - updateUseCase={updateUseCase} - />, - ), - ).toMatchSnapshot(); - }, -); diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx deleted file mode 100644 index f2e8843b3c1..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { click } from '../../../helpers/testUtils'; -import SystemUpgradeIntermediate from '../SystemUpgradeIntermediate'; - -const UPGRADES = [ - { - version: '5.6.6', - description: 'Version 5.6.6 description', - releaseDate: '2017-04-02', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, - { - version: '5.6.5', - description: 'Version 5.6.5 description', - releaseDate: '2017-03-01', - changeLogUrl: 'changelogurl', - downloadUrl: 'downloadurl', - plugins: {}, - }, -]; - -it('should display correctly', () => { - const wrapper = shallow(<SystemUpgradeIntermediate upgrades={UPGRADES} />); - expect(wrapper).toMatchSnapshot(); - wrapper.setState({ showMore: true }); - expect(wrapper).toMatchSnapshot(); -}); - -it('should allow to show and hide intermediates', () => { - const wrapper = shallow(<SystemUpgradeIntermediate upgrades={UPGRADES} />); - expect(wrapper.find('.system-upgrade-intermediate').exists()).toBe(false); - click(wrapper.find('ButtonLink')); - expect(wrapper.find('.system-upgrade-intermediate').exists()).toBe(true); - click(wrapper.find('ButtonLink')); - expect(wrapper.find('.system-upgrade-intermediate').exists()).toBe(false); -}); diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx deleted file mode 100644 index b0d00f2df13..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 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 { shallow } from 'enzyme'; -import * as React from 'react'; -import { EditionKey } from '../../../types/editions'; -import SystemUpgradeItem, { SystemUpgradeItemProps } from '../SystemUpgradeItem'; - -it('should display correctly', () => { - expect(shallowRender()).toMatchSnapshot(); - expect(shallowRender({ isLTSVersion: true })).toMatchSnapshot(); - expect(shallowRender({ isPatch: true })).toMatchSnapshot(); - expect(shallowRender({ edition: EditionKey.developer })).toMatchSnapshot(); - expect(shallowRender({ edition: EditionKey.enterprise })).toMatchSnapshot(); - expect(shallowRender({ edition: EditionKey.datacenter })).toMatchSnapshot(); - // Fallback to Community. - expect( - shallowRender({ - systemUpgrades: [ - { - version: '5.6.7', - description: 'Version 5.6.7 description', - releaseDate: '2017-03-01', - changeLogUrl: 'http://changelog.url/', - downloadUrl: 'http://download.url/community', - }, - ], - }), - ).toMatchSnapshot(); -}); - -function shallowRender(props: Partial<SystemUpgradeItemProps> = {}) { - return shallow<SystemUpgradeItemProps>( - <SystemUpgradeItem - edition={EditionKey.community} - systemUpgrades={[ - { - version: '5.6.7', - description: 'Version 5.6.7 description', - releaseDate: '2017-03-01', - changeLogUrl: 'http://changelog.url/', - downloadUrl: 'http://download.url/community', - downloadDeveloperUrl: 'http://download.url/developer', - downloadEnterpriseUrl: 'http://download.url/enterprise', - downloadDatacenterUrl: 'http://download.url/datacenter', - }, - { - version: '5.6.6', - description: 'Version 5.6.6 description', - releaseDate: '2017-04-02', - changeLogUrl: 'http://changelog.url/', - downloadUrl: 'http://download.url/community', - downloadDeveloperUrl: 'http://download.url/developer', - }, - { - version: '5.6.5', - description: 'Version 5.6.5 description', - releaseDate: '2017-03-01', - changeLogUrl: 'http://changelog.url/', - downloadUrl: 'http://download.url/community', - downloadDeveloperUrl: 'http://download.url/developer', - }, - ]} - isPatch={false} - isLTSVersion={false} - {...props} - />, - ); -} diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeButton-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeButton-test.tsx.snap deleted file mode 100644 index 037b14bb219..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeButton-test.tsx.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should open modal correctly 1`] = ` -<Fragment> - <Button - className="spacer-left" - onClick={[Function]} - > - learn_more - </Button> -</Fragment> -`; diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap deleted file mode 100644 index 67963a58a32..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap +++ /dev/null @@ -1,494 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display correctly for new_minor_version 1`] = ` -<Modal - contentLabel="system.system_upgrade" - onRequestClose={[MockFunction]} -> - <div - className="modal-head" - > - <h2> - system.system_upgrade - </h2> - </div> - <div - className="modal-body" - > - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="6.3" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 6.4 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-06-02", - "version": "6.4", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 6.3 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-05-02", - "version": "6.3", - }, - ] - } - /> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="5.6.5" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.7 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.7", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.6 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.5 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - </div> - <div - className="modal-foot" - > - <ForwardRef(Link) - className="pull-left link-no-underline display-flex-center" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/downloads/?referrer=sonarqube" - > - system.see_sonarqube_downloads - </ForwardRef(Link)> - <ResetButtonLink - onClick={[MockFunction]} - > - cancel - </ResetButtonLink> - </div> -</Modal> -`; - -exports[`should display correctly for new_patch 1`] = ` -<Modal - contentLabel="system.system_upgrade" - onRequestClose={[MockFunction]} -> - <div - className="modal-head" - > - <h2> - system.system_upgrade - </h2> - </div> - <div - className="modal-body" - > - <Alert - className="it__upgrade-alert-new_patch" - variant="warning" - > - admin_notification.update.new_patch - </Alert> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="6.3" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 6.4 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-06-02", - "version": "6.4", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 6.3 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-05-02", - "version": "6.3", - }, - ] - } - /> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={true} - key="5.6.5" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.7 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.7", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.6 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.5 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - </div> - <div - className="modal-foot" - > - <ForwardRef(Link) - className="pull-left link-no-underline display-flex-center" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/downloads/?referrer=sonarqube" - > - system.see_sonarqube_downloads - </ForwardRef(Link)> - <ResetButtonLink - onClick={[MockFunction]} - > - cancel - </ResetButtonLink> - </div> -</Modal> -`; - -exports[`should display correctly for pre_lts 1`] = ` -<Modal - contentLabel="system.system_upgrade" - onRequestClose={[MockFunction]} -> - <div - className="modal-head" - > - <h2> - system.system_upgrade - </h2> - </div> - <div - className="modal-body" - > - <Alert - className="it__upgrade-alert-pre_lts" - variant="warning" - > - admin_notification.update.pre_lts - </Alert> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="6.3" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 6.4 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-06-02", - "version": "6.4", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 6.3 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-05-02", - "version": "6.3", - }, - ] - } - /> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="5.6.5" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.7 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.7", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.6 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.5 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - </div> - <div - className="modal-foot" - > - <ForwardRef(Link) - className="pull-left link-no-underline display-flex-center" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/downloads/?referrer=sonarqube" - > - system.see_sonarqube_downloads - </ForwardRef(Link)> - <ResetButtonLink - onClick={[MockFunction]} - > - cancel - </ResetButtonLink> - </div> -</Modal> -`; - -exports[`should display correctly for previous_lts 1`] = ` -<Modal - contentLabel="system.system_upgrade" - onRequestClose={[MockFunction]} -> - <div - className="modal-head" - > - <h2> - system.system_upgrade - </h2> - </div> - <div - className="modal-body" - > - <Alert - className="it__upgrade-alert-previous_lts" - variant="error" - > - admin_notification.update.previous_lts - </Alert> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="6.3" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 6.4 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-06-02", - "version": "6.4", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 6.3 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-05-02", - "version": "6.3", - }, - ] - } - /> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="5.6.5" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.7 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.7", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.6 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.5 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - </div> - <div - className="modal-foot" - > - <ForwardRef(Link) - className="pull-left link-no-underline display-flex-center" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/downloads/?referrer=sonarqube" - > - system.see_sonarqube_downloads - </ForwardRef(Link)> - <ResetButtonLink - onClick={[MockFunction]} - > - cancel - </ResetButtonLink> - </div> -</Modal> -`; - -exports[`should display correctly for undefined 1`] = ` -<Modal - contentLabel="system.system_upgrade" - onRequestClose={[MockFunction]} -> - <div - className="modal-head" - > - <h2> - system.system_upgrade - </h2> - </div> - <div - className="modal-body" - > - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="6.3" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 6.4 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-06-02", - "version": "6.4", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 6.3 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-05-02", - "version": "6.3", - }, - ] - } - /> - <SystemUpgradeItem - edition="community" - isLTSVersion={false} - isPatch={false} - key="5.6.5" - systemUpgrades={ - [ - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.7 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.7", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.6 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "changelogurl", - "description": "Version 5.6.5 description", - "downloadUrl": "downloadurl", - "plugins": {}, - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - </div> - <div - className="modal-foot" - > - <ForwardRef(Link) - className="pull-left link-no-underline display-flex-center" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/downloads/?referrer=sonarqube" - > - system.see_sonarqube_downloads - </ForwardRef(Link)> - <ResetButtonLink - onClick={[MockFunction]} - > - cancel - </ResetButtonLink> - </div> -</Modal> -`; diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap deleted file mode 100644 index 763ab35301a..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeIntermediate-test.tsx.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display correctly 1`] = ` -<div> - <ButtonLink - className="little-spacer-bottom" - onClick={[Function]} - > - system.show_intermediate_versions - <DropdownIcon - className="little-spacer-left" - turned={false} - /> - </ButtonLink> -</div> -`; - -exports[`should display correctly 2`] = ` -<div> - <ButtonLink - className="little-spacer-bottom" - onClick={[Function]} - > - system.hide_intermediate_versions - <DropdownIcon - className="little-spacer-left" - turned={true} - /> - </ButtonLink> - <div - className="note system-upgrade-intermediate" - key="5.6.6" - > - <DateFormatter - date="2017-04-02" - long={true} - > - <Component /> - </DateFormatter> - <p - className="little-spacer-top" - > - Version 5.6.6 description - </p> - </div> - <div - className="note system-upgrade-intermediate" - key="5.6.5" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <p - className="little-spacer-top" - > - Version 5.6.5 description - </p> - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap deleted file mode 100644 index e241e74a664..00000000000 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap +++ /dev/null @@ -1,668 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display correctly 1`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.latest_version - </strong> - <ForwardRef(Link) - className="spacer-left medium" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube" - > - system.see_whats_new - </ForwardRef(Link)> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={ - [ - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.6 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.5 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/community" - href="http://download.url/community" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; - -exports[`should display correctly 2`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.lts_version - </strong> - <ForwardRef(Link) - className="spacer-left medium" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube" - > - system.see_whats_new - </ForwardRef(Link)> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={ - [ - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.6 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.5 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/community" - href="http://download.url/community" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; - -exports[`should display correctly 3`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.latest_patch - </strong> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={ - [ - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.6 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.5 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/community" - href="http://download.url/community" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; - -exports[`should display correctly 4`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.latest_version - </strong> - <ForwardRef(Link) - className="spacer-left medium" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube" - > - system.see_whats_new - </ForwardRef(Link)> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={ - [ - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.6 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.5 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/developer" - href="http://download.url/developer" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; - -exports[`should display correctly 5`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.latest_version - </strong> - <ForwardRef(Link) - className="spacer-left medium" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube" - > - system.see_whats_new - </ForwardRef(Link)> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={ - [ - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.6 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.5 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/enterprise" - href="http://download.url/enterprise" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; - -exports[`should display correctly 6`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.latest_version - </strong> - <ForwardRef(Link) - className="spacer-left medium" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube" - > - system.see_whats_new - </ForwardRef(Link)> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={ - [ - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.6 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-04-02", - "version": "5.6.6", - }, - { - "changeLogUrl": "http://changelog.url/", - "description": "Version 5.6.5 description", - "downloadDeveloperUrl": "http://download.url/developer", - "downloadUrl": "http://download.url/community", - "releaseDate": "2017-03-01", - "version": "5.6.5", - }, - ] - } - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/datacenter" - href="http://download.url/datacenter" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; - -exports[`should display correctly 7`] = ` -<div - className="system-upgrade-version it__upgrade-list-item" -> - <h3 - className="h1 spacer-bottom" - > - <strong> - system.latest_version - </strong> - <ForwardRef(Link) - className="spacer-left medium" - target="_blank" - to="https://www.sonarsource.com/products/sonarqube/whats-new/?referrer=sonarqube" - > - system.see_whats_new - </ForwardRef(Link)> - </h3> - <p> - <FormattedMessage - defaultMessage="system.version_is_availble" - id="system.version_is_availble" - values={ - { - "version": <b> - SonarQube - 5.6.7 - </b>, - } - } - /> - </p> - <p - className="spacer-top" - > - Version 5.6.7 description - </p> - <div - className="big-spacer-top" - > - <DateFormatter - date="2017-03-01" - long={true} - > - <Component /> - </DateFormatter> - <ForwardRef(Link) - className="spacer-left" - target="_blank" - to="http://changelog.url/" - > - system.release_notes - </ForwardRef(Link)> - </div> - <SystemUpgradeIntermediate - className="spacer-top" - upgrades={[]} - /> - <div - className="big-spacer-top" - > - <a - className="button" - download="http://download.url/community" - href="http://download.url/community" - rel="noopener noreferrer" - target="_blank" - > - system.download_x.5.6.7 - </a> - <DocLink - className="spacer-left" - to="/setup-and-upgrade/upgrade-the-server/upgrade-guide/" - > - system.how_to_upgrade - </DocLink> - </div> -</div> -`; diff --git a/server/sonar-web/src/main/js/helpers/testUtils.ts b/server/sonar-web/src/main/js/helpers/testUtils.ts index 3c4cf33479f..8f8cc26489f 100644 --- a/server/sonar-web/src/main/js/helpers/testUtils.ts +++ b/server/sonar-web/src/main/js/helpers/testUtils.ts @@ -17,148 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { ReactWrapper, ShallowWrapper } from 'enzyme'; import { ComponentClass, FunctionComponent } from 'react'; -import { setImmediate } from 'timers'; -import { KeyboardKeys } from './keycodes'; export type ComponentPropsType<T extends ComponentClass | FunctionComponent<any>> = T extends ComponentClass<infer P> ? P : T extends FunctionComponent<infer P> ? P : never; -export function mockEvent(overrides = {}) { - return { - target: { - blur() { - /* noop */ - }, - }, - currentTarget: { - blur() { - /* noop */ - }, - }, - preventDefault() { - /* noop */ - }, - stopPropagation() { - /* noop */ - }, - stopImmediatePropagation() { - /* noop */ - }, - ...overrides, - } as any; -} - -export function click(element: ShallowWrapper | ReactWrapper, event = {}): void { - // `type()` returns a component constructor for a composite element and string for DOM nodes - if (typeof element.type() === 'function') { - element.prop<Function>('onClick')(); - // TODO find out if `root` is a public api - // https://github.com/airbnb/enzyme/blob/master/packages/enzyme/src/ReactWrapper.js#L109 - (element as any).root().update(); - } else { - element.simulate('click', mockEvent(event)); - } -} - -export function clickOutside(event = {}): void { - const dispatchedEvent = new MouseEvent('click', event); - window.dispatchEvent(dispatchedEvent); -} - -export function submit(element: ShallowWrapper | ReactWrapper): void { - element.simulate('submit', { - preventDefault() {}, - }); -} - -export function change( - element: ShallowWrapper | ReactWrapper, - value: string | object, - event = {}, -): void { - // `type()` returns a component constructor for a composite element and string for DOM nodes - if (typeof element.type() === 'function') { - element.prop<Function>('onChange')(value); - // TODO find out if `root` is a public api - // https://github.com/airbnb/enzyme/blob/master/packages/enzyme/src/ReactWrapper.js#L109 - (element as any).root().update(); - } else { - element.simulate('change', { - target: { value }, - currentTarget: { value }, - ...event, - }); - } -} - -export const KEYCODE_MAP: { [code in KeyboardKeys]?: string } = { - [KeyboardKeys.Enter]: 'enter', - [KeyboardKeys.LeftArrow]: 'left', - [KeyboardKeys.UpArrow]: 'up', - [KeyboardKeys.RightArrow]: 'right', - [KeyboardKeys.DownArrow]: 'down', -}; - -export function keydown(args: { key?: KeyboardKeys; metaKey?: boolean; ctrlKey?: boolean }): void { - const event = new KeyboardEvent('keydown', args as KeyboardEventInit); - document.dispatchEvent(event); -} - -export function resizeWindowTo(width?: number, height?: number) { - // `document.documentElement.clientHeight/clientWidth` are getters by default, - // so we need to redefine them. Pass `configurable: true` to allow to redefine - // the properties multiple times. - if (width) { - Object.defineProperty(document.documentElement, 'clientWidth', { - configurable: true, - value: width, - }); - } - if (height) { - Object.defineProperty(document.documentElement, 'clientHeight', { - configurable: true, - value: height, - }); - } - - const resizeEvent = new Event('resize'); - window.dispatchEvent(resizeEvent); -} - -export function scrollTo({ left = 0, top = 0 }) { - Object.defineProperty(window, 'pageYOffset', { value: top }); - Object.defineProperty(window, 'pageXOffset', { value: left }); - const resizeEvent = new Event('scroll'); - window.dispatchEvent(resizeEvent); -} - -export function setNodeRect({ width = 50, height = 50, left = 0, top = 0 }) { - const { findDOMNode } = require('react-dom'); - const element = document.createElement('div'); - Object.defineProperty(element, 'getBoundingClientRect', { - value: () => ({ width, height, left, top }), - }); - findDOMNode.mockReturnValue(element); -} - -export function doAsync(fn?: Function): Promise<void> { - return new Promise((resolve) => { - setImmediate(() => { - if (fn) { - fn(); - } - resolve(); - }); - }); -} - -export async function waitAndUpdate(wrapper: ShallowWrapper<any, any> | ReactWrapper<any, any>) { - await new Promise(setImmediate); - wrapper.update(); -} - export function mockIntersectionObserver(): Function { let callback: Function; diff --git a/server/sonar-web/yarn.lock b/server/sonar-web/yarn.lock index 34e9cb0041c..c4a23833b5d 100644 --- a/server/sonar-web/yarn.lock +++ b/server/sonar-web/yarn.lock @@ -4311,15 +4311,6 @@ __metadata: languageName: node linkType: hard -"@types/cheerio@npm:*": - version: 0.22.12 - resolution: "@types/cheerio@npm:0.22.12" - dependencies: - "@types/node": "*" - checksum: c49a535d8b62cadcdb86e30b656a7544da897272c11dce68c93ec560cb93f2e638570a37aeb1a9475e5617868c3997b6e0ca616848c37b4fc7441afce1c0d0ba - languageName: node - linkType: hard - "@types/cheerio@npm:0.22.31": version: 0.22.31 resolution: "@types/cheerio@npm:0.22.31" @@ -4329,15 +4320,6 @@ __metadata: languageName: node linkType: hard -"@types/cheerio@npm:^0.22.22": - version: 0.22.30 - resolution: "@types/cheerio@npm:0.22.30" - dependencies: - "@types/node": "*" - checksum: 2aba93f57c0c88964bd83c3403b1f9ad98c377d00e0d638417a943ab483f0a638925c9a4f2e25d923db2a293ffb59f833cd49fa76c6299684494633becea54de - languageName: node - linkType: hard - "@types/classnames@npm:2.3.1": version: 2.3.1 resolution: "@types/classnames@npm:2.3.1" @@ -4449,16 +4431,6 @@ __metadata: languageName: node linkType: hard -"@types/enzyme@npm:3.10.13": - version: 3.10.13 - resolution: "@types/enzyme@npm:3.10.13" - dependencies: - "@types/cheerio": "*" - "@types/react": ^16 - checksum: a7983c56a9991bb9446a9468fbf0d5905d46574122ab76d87dab690685321bbe1875ce152f731481700a15e646b22560187ceb0b9591f5c6940a01be60e1f961 - languageName: node - linkType: hard - "@types/estree@npm:^1.0.0": version: 1.0.0 resolution: "@types/estree@npm:1.0.0" @@ -5173,38 +5145,6 @@ __metadata: languageName: node linkType: hard -"@wojtekmaj/enzyme-adapter-react-17@npm:0.8.0": - version: 0.8.0 - resolution: "@wojtekmaj/enzyme-adapter-react-17@npm:0.8.0" - dependencies: - "@wojtekmaj/enzyme-adapter-utils": ^0.2.0 - enzyme-shallow-equal: ^1.0.0 - has: ^1.0.0 - prop-types: ^15.7.0 - react-is: ^17.0.0 - react-test-renderer: ^17.0.0 - peerDependencies: - enzyme: ^3.0.0 - react: ^17.0.0-0 - react-dom: ^17.0.0-0 - checksum: aa9674f06f6db269b72168ebf46c4513938993479eb60bac30cb6183b5aca6108ade3d08af4f56c142cb219415480d0c4b454ba9452b85c32f711c806b39cd8c - languageName: node - linkType: hard - -"@wojtekmaj/enzyme-adapter-utils@npm:^0.2.0": - version: 0.2.0 - resolution: "@wojtekmaj/enzyme-adapter-utils@npm:0.2.0" - dependencies: - function.prototype.name: ^1.1.0 - has: ^1.0.0 - object.fromentries: ^2.0.0 - prop-types: ^15.7.0 - peerDependencies: - react: ^17.0.0-0 - checksum: 837741f1382acdb02ce304745eccfdcff03f1cae2a4fb833056a7a753308cd1182b0b32a10a04be6bfedaaab8f4acd5b458bfe0b9ebaa6119c4aaaba74a14ae4 - languageName: node - linkType: hard - "SonarQube@workspace:.": version: 0.0.0-use.local resolution: "SonarQube@workspace:." @@ -5231,7 +5171,6 @@ __metadata: "@types/d3-shape": 3.1.2 "@types/diff": 5.0.3 "@types/dompurify": 3.0.2 - "@types/enzyme": 3.10.13 "@types/jest": 29.5.4 "@types/jest-axe": 3.5.5 "@types/lodash": 4.14.197 @@ -5245,7 +5184,6 @@ __metadata: "@types/valid-url": 1.0.4 "@typescript-eslint/eslint-plugin": 5.59.11 "@typescript-eslint/parser": 5.59.11 - "@wojtekmaj/enzyme-adapter-react-17": 0.8.0 autoprefixer: 10.4.15 axios: 1.5.0 chalk: 4.1.2 @@ -5263,8 +5201,6 @@ __metadata: design-system: 1.0.0 diff: 5.1.0 dompurify: 3.0.5 - enzyme: 3.11.0 - enzyme-to-json: 3.6.2 esbuild: 0.19.2 eslint: 8.48.0 eslint-config-sonarqube: 2.1.3 @@ -5572,13 +5508,6 @@ __metadata: languageName: node linkType: hard -"array-filter@npm:^1.0.0": - version: 1.0.0 - resolution: "array-filter@npm:1.0.0" - checksum: 467054291f522d7f633b1f5e79aac9008ade50a7354e0178d9ec8f0091ec03bc19a41d4eb22985daf2279a5c27be6d7cf410733539e7fccb0742145b89aca438 - languageName: node - linkType: hard - "array-includes@npm:^3.1.2": version: 3.1.2 resolution: "array-includes@npm:3.1.2" @@ -5638,16 +5567,6 @@ __metadata: languageName: node linkType: hard -"array.prototype.flat@npm:^1.2.3": - version: 1.2.3 - resolution: "array.prototype.flat@npm:1.2.3" - dependencies: - define-properties: ^1.1.3 - es-abstract: ^1.17.0-next.1 - checksum: ba4cf6e53871902a09fa7f56ff097e836f18d59de0219fe271e3d1a895a7ea98a62fa946cbdae95e73b774991206a32a26822227d081bd2cc5c771b95f851753 - languageName: node - linkType: hard - "array.prototype.flat@npm:^1.3.1": version: 1.3.1 resolution: "array.prototype.flat@npm:1.3.1" @@ -5925,13 +5844,6 @@ __metadata: languageName: node linkType: hard -"boolbase@npm:~1.0.0": - version: 1.0.0 - resolution: "boolbase@npm:1.0.0" - checksum: 3e25c80ef626c3a3487c73dbfc70ac322ec830666c9ad915d11b701142fab25ec1e63eff2c450c74347acfd2de854ccde865cd79ef4db1683f7c7b046ea43bb0 - languageName: node - linkType: hard - "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -6152,20 +6064,6 @@ __metadata: languageName: node linkType: hard -"cheerio@npm:^1.0.0-rc.3": - version: 1.0.0-rc.3 - resolution: "cheerio@npm:1.0.0-rc.3" - dependencies: - css-select: ~1.2.0 - dom-serializer: ~0.1.1 - entities: ~1.1.1 - htmlparser2: ^3.9.1 - lodash: ^4.15.0 - parse5: ^3.0.1 - checksum: 90163e8f360d3a9ac27d7ee83edd891236cad63df75e4fde5efcc27269996716a3f8c8dfcefaa2e77ddd6a21c8e54ed6169138096c869913e571abe2264f36fe - languageName: node - linkType: hard - "chokidar@npm:3.5.3, chokidar@npm:^3.5.3": version: 3.5.3 resolution: "chokidar@npm:3.5.3" @@ -6325,13 +6223,6 @@ __metadata: languageName: node linkType: hard -"commander@npm:^2.19.0": - version: 2.20.0 - resolution: "commander@npm:2.20.0" - checksum: 7f7ad57277e7a42e6931c0016e57ee1c14c3d2cf88aeff53c0c4d995a1a90ba33aa8bbff1cde1f92578b495e85c23aac7964c8f06322b9667b8b6e9ff9ceeca8 - languageName: node - linkType: hard - "commander@npm:^4.0.0": version: 4.1.1 resolution: "commander@npm:4.1.1" @@ -6432,25 +6323,6 @@ __metadata: languageName: node linkType: hard -"css-select@npm:~1.2.0": - version: 1.2.0 - resolution: "css-select@npm:1.2.0" - dependencies: - boolbase: ~1.0.0 - css-what: 2.1 - domutils: 1.5.1 - nth-check: ~1.0.1 - checksum: 607cca60d2f5c56701fe5f800bbe668b114395c503d4e4808edbbbe70b8be3c96a6407428dc0227fcbdf335b20468e6a9e7fd689185edfb57d402e1e4837c9b7 - languageName: node - linkType: hard - -"css-what@npm:2.1": - version: 2.1.3 - resolution: "css-what@npm:2.1.3" - checksum: a52d56c591a7e1c37506d0d8c4fdef72537fb8eb4cb68711485997a88d76b5a3342b73a7c79176268f95b428596c447ad7fa3488224a6b8b532e2f1f2ee8545c - languageName: node - linkType: hard - "css.escape@npm:^1.5.1": version: 1.5.1 resolution: "css.escape@npm:1.5.1" @@ -6847,7 +6719,7 @@ __metadata: languageName: node linkType: hard -"define-properties@npm:^1.1.2, define-properties@npm:^1.1.3": +"define-properties@npm:^1.1.3": version: 1.1.3 resolution: "define-properties@npm:1.1.3" dependencies: @@ -7034,13 +6906,6 @@ __metadata: languageName: node linkType: hard -"discontinuous-range@npm:1.0.0": - version: 1.0.0 - resolution: "discontinuous-range@npm:1.0.0" - checksum: 8ee88d7082445b6eadc7c03bebe6dc978f96760c45e9f65d16ca66174d9e086a9e3855ee16acf65625e1a07a846a17de674f02a5964a6aebe5963662baf8b5c8 - languageName: node - linkType: hard - "dlv@npm:^1.1.3": version: 1.1.3 resolution: "dlv@npm:1.1.3" @@ -7083,23 +6948,6 @@ __metadata: languageName: node linkType: hard -"dom-serializer@npm:0, dom-serializer@npm:~0.1.1": - version: 0.1.1 - resolution: "dom-serializer@npm:0.1.1" - dependencies: - domelementtype: ^1.3.0 - entities: ^1.1.1 - checksum: 4f6a3eff802273741931cfd3c800fab4e683236eed10628d6605f52538a6bc0ce4770f3ca2ad68a27412c103ae9b6cdaed3c0a8e20d2704192bde497bc875215 - languageName: node - linkType: hard - -"domelementtype@npm:1, domelementtype@npm:^1.3.0, domelementtype@npm:^1.3.1": - version: 1.3.1 - resolution: "domelementtype@npm:1.3.1" - checksum: 7893da40218ae2106ec6ffc146b17f203487a52f5228b032ea7aa470e41dfe03e1bd762d0ee0139e792195efda765434b04b43cddcf63207b098f6ae44b36ad6 - languageName: node - linkType: hard - "domexception@npm:^4.0.0": version: 4.0.0 resolution: "domexception@npm:4.0.0" @@ -7109,15 +6957,6 @@ __metadata: languageName: node linkType: hard -"domhandler@npm:^2.3.0": - version: 2.4.2 - resolution: "domhandler@npm:2.4.2" - dependencies: - domelementtype: 1 - checksum: 49bd70c9c784f845cd047e1dfb3611bd10891c05719acfc93f01fc726a419ed09fbe0b69f9064392d556a63fffc5a02010856cedae9368f4817146d95a97011f - languageName: node - linkType: hard - "dompurify@npm:3.0.5": version: 3.0.5 resolution: "dompurify@npm:3.0.5" @@ -7125,26 +6964,6 @@ __metadata: languageName: node linkType: hard -"domutils@npm:1.5.1": - version: 1.5.1 - resolution: "domutils@npm:1.5.1" - dependencies: - dom-serializer: 0 - domelementtype: 1 - checksum: 800d1f9d1c2e637267dae078ff6e24461e6be1baeb52fa70f2e7e7520816c032a925997cd15d822de53ef9896abb1f35e5c439d301500a9cd6b46a395f6f6ca0 - languageName: node - linkType: hard - -"domutils@npm:^1.5.1": - version: 1.7.0 - resolution: "domutils@npm:1.7.0" - dependencies: - dom-serializer: 0 - domelementtype: 1 - checksum: f60a725b1f73c1ae82f4894b691601ecc6ecb68320d87923ac3633137627c7865725af813ae5d188ad3954283853bcf46779eb50304ec5d5354044569fcefd2b - languageName: node - linkType: hard - "electron-to-chromium@npm:^1.4.17": version: 1.4.64 resolution: "electron-to-chromium@npm:1.4.64" @@ -7196,13 +7015,6 @@ __metadata: languageName: node linkType: hard -"entities@npm:^1.1.1, entities@npm:~1.1.1": - version: 1.1.2 - resolution: "entities@npm:1.1.2" - checksum: d537b02799bdd4784ffd714d000597ed168727bddf4885da887c5a491d735739029a00794f1998abbf35f3f6aeda32ef5c15010dca1817d401903a501b6d3e05 - languageName: node - linkType: hard - "entities@npm:^4.4.0": version: 4.4.0 resolution: "entities@npm:4.4.0" @@ -7217,69 +7029,6 @@ __metadata: languageName: node linkType: hard -"enzyme-shallow-equal@npm:^1.0.0": - version: 1.0.5 - resolution: "enzyme-shallow-equal@npm:1.0.5" - dependencies: - has: ^1.0.3 - object-is: ^1.1.5 - checksum: e18a728225b3ef501a223608955e2c8e915adf24dfe4d778bdbc89e4ecd80384723e9d44780176be1529f6b642e7837211f502bff89f62833d8f9cae027997e0 - languageName: node - linkType: hard - -"enzyme-shallow-equal@npm:^1.0.1": - version: 1.0.1 - resolution: "enzyme-shallow-equal@npm:1.0.1" - dependencies: - has: ^1.0.3 - object-is: ^1.0.2 - checksum: bd2f0c4db54e6c3a5bfbecccf96b4f7836c77f7fc1ce5ea1f219973097a50a6a77e0d75c331b8db290ce6cd5fcae4f7c3d4f02948456e5d6ce8c906de8686452 - languageName: node - linkType: hard - -"enzyme-to-json@npm:3.6.2": - version: 3.6.2 - resolution: "enzyme-to-json@npm:3.6.2" - dependencies: - "@types/cheerio": ^0.22.22 - lodash: ^4.17.21 - react-is: ^16.12.0 - peerDependencies: - enzyme: ^3.4.0 - checksum: e81f3dc05b5c440da416544a3cbc41fb9e79de0777453e48fe55de822f7d6f56ee08e5173d46a7624cf2781198396509c470bdd616a1ea441e6fa9ddf4396477 - languageName: node - linkType: hard - -"enzyme@npm:3.11.0": - version: 3.11.0 - resolution: "enzyme@npm:3.11.0" - dependencies: - array.prototype.flat: ^1.2.3 - cheerio: ^1.0.0-rc.3 - enzyme-shallow-equal: ^1.0.1 - function.prototype.name: ^1.1.2 - has: ^1.0.3 - html-element-map: ^1.2.0 - is-boolean-object: ^1.0.1 - is-callable: ^1.1.5 - is-number-object: ^1.0.4 - is-regex: ^1.0.5 - is-string: ^1.0.5 - is-subset: ^0.1.1 - lodash.escape: ^4.0.1 - lodash.isequal: ^4.5.0 - object-inspect: ^1.7.0 - object-is: ^1.0.2 - object.assign: ^4.1.0 - object.entries: ^1.1.1 - object.values: ^1.1.1 - raf: ^3.4.1 - rst-selector-parser: ^2.2.3 - string.prototype.trim: ^1.2.1 - checksum: 69ae80049c3f405122b8e619f1cf8b04f32b3cc2b6134c29ed8c0f05e87a0b15080f1121096ec211954a710f4787300af9157078c863012de87eee16e98e64ea - languageName: node - linkType: hard - "err-code@npm:^2.0.2": version: 2.0.3 resolution: "err-code@npm:2.0.3" @@ -7296,25 +7045,6 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.17.0-next.1": - version: 1.17.4 - resolution: "es-abstract@npm:1.17.4" - dependencies: - es-to-primitive: ^1.2.1 - function-bind: ^1.1.1 - has: ^1.0.3 - has-symbols: ^1.0.1 - is-callable: ^1.1.5 - is-regex: ^1.0.5 - object-inspect: ^1.7.0 - object-keys: ^1.1.1 - object.assign: ^4.1.0 - string.prototype.trimleft: ^2.1.1 - string.prototype.trimright: ^2.1.1 - checksum: c8b977a9750f35b8406e3f1006d6e07c5154263776200a6082ff21f83aba36ce1407301965fb064f2936eb16212242625a558392ffe684dd6279f61b4778bc78 - languageName: node - linkType: hard - "es-abstract@npm:^1.18.0-next.1": version: 1.18.0-next.1 resolution: "es-abstract@npm:1.18.0-next.1" @@ -8473,7 +8203,7 @@ __metadata: languageName: node linkType: hard -"function.prototype.name@npm:^1.1.0, function.prototype.name@npm:^1.1.5": +"function.prototype.name@npm:^1.1.5": version: 1.1.5 resolution: "function.prototype.name@npm:1.1.5" dependencies: @@ -8485,24 +8215,6 @@ __metadata: languageName: node linkType: hard -"function.prototype.name@npm:^1.1.2": - version: 1.1.2 - resolution: "function.prototype.name@npm:1.1.2" - dependencies: - define-properties: ^1.1.3 - es-abstract: ^1.17.0-next.1 - functions-have-names: ^1.2.0 - checksum: 68b4e1fc4bf3a6a88ac5a69d84f46c33c24dc83db33123b6f11c16330c9aa65ac0e7c6e31654f8429cf5229d2a83eb2673641fc059ad5a98d6c44184589b871d - languageName: node - linkType: hard - -"functions-have-names@npm:^1.2.0": - version: 1.2.1 - resolution: "functions-have-names@npm:1.2.1" - checksum: 34a3f18ce1d6ce54b9e7df3209d25718106206aee3951ae82a639dbda71c7c57112836628734b4ba18aeddf5f6e8d8c92c7b825df8cbe1ef8b6f683afecaf38a - languageName: node - linkType: hard - "functions-have-names@npm:^1.2.2": version: 1.2.2 resolution: "functions-have-names@npm:1.2.2" @@ -8835,7 +8547,7 @@ __metadata: languageName: node linkType: hard -"has@npm:^1.0.0, has@npm:^1.0.3": +"has@npm:^1.0.3": version: 1.0.3 resolution: "has@npm:1.0.3" dependencies: @@ -8909,15 +8621,6 @@ __metadata: languageName: node linkType: hard -"html-element-map@npm:^1.2.0": - version: 1.2.0 - resolution: "html-element-map@npm:1.2.0" - dependencies: - array-filter: ^1.0.0 - checksum: b5e7cad2da46cce47b4b595f60a59eb3e933202030302885e705bef16bd2ac016d4a1bba1ef812c831802d04fc6b0c6d7d918c6fb069da6a61e7b7623f75124e - languageName: node - linkType: hard - "html-encoding-sniffer@npm:^3.0.0": version: 3.0.0 resolution: "html-encoding-sniffer@npm:3.0.0" @@ -8934,20 +8637,6 @@ __metadata: languageName: node linkType: hard -"htmlparser2@npm:^3.9.1": - version: 3.10.1 - resolution: "htmlparser2@npm:3.10.1" - dependencies: - domelementtype: ^1.3.1 - domhandler: ^2.3.0 - domutils: ^1.5.1 - entities: ^1.1.1 - inherits: ^2.0.1 - readable-stream: ^3.1.1 - checksum: 6875f7dd875aa10be17d9b130e3738cd8ed4010b1f2edaf4442c82dfafe9d9336b155870dcc39f38843cbf7fef5e4fcfdf0c4c1fd4db3a1b91a1e0ee8f6c3475 - languageName: node - linkType: hard - "http-cache-semantics@npm:^4.1.0": version: 4.1.0 resolution: "http-cache-semantics@npm:4.1.0" @@ -9100,7 +8789,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:~2.0.3": +"inherits@npm:2, inherits@npm:~2.0.3": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -9241,13 +8930,6 @@ __metadata: languageName: node linkType: hard -"is-boolean-object@npm:^1.0.1": - version: 1.0.1 - resolution: "is-boolean-object@npm:1.0.1" - checksum: a357d1d80f621e720110044e5c23a106b252bc41a4183a63e28cfbb3aae8485225609a3cd4bba28418de699a77967a611a7622478c40285bc7ec29a611a2eb6b - languageName: node - linkType: hard - "is-boolean-object@npm:^1.1.0": version: 1.1.2 resolution: "is-boolean-object@npm:1.1.2" @@ -9272,13 +8954,6 @@ __metadata: languageName: node linkType: hard -"is-callable@npm:^1.1.5": - version: 1.1.5 - resolution: "is-callable@npm:1.1.5" - checksum: 734cf282abf29c3bcfc00a7125a492a3e7e58109199f531d4f6951b433a7a37c57c4d956db1af0e6cd726718210c67e8c7f918c4f582b0d61dcde74525aac3e4 - languageName: node - linkType: hard - "is-callable@npm:^1.2.2": version: 1.2.2 resolution: "is-callable@npm:1.2.2" @@ -9497,15 +9172,6 @@ __metadata: languageName: node linkType: hard -"is-regex@npm:^1.0.5": - version: 1.0.5 - resolution: "is-regex@npm:1.0.5" - dependencies: - has: ^1.0.3 - checksum: 33e70e084a949ee4c57ee12f2c26e9f5e9c09bb988638b116a0381909804b8556e244060ba4b051d2b6228d54447e9eaf6219f3c5a7b6d0afe70a951feec174b - languageName: node - linkType: hard - "is-regex@npm:^1.1.1": version: 1.1.1 resolution: "is-regex@npm:1.1.1" @@ -9571,13 +9237,6 @@ __metadata: languageName: node linkType: hard -"is-subset@npm:^0.1.1": - version: 0.1.1 - resolution: "is-subset@npm:0.1.1" - checksum: 97b8d7852af165269b7495095691a6ce6cf20bdfa1f846f97b4560ee190069686107af4e277fbd93aa0845c4d5db704391460ff6e9014aeb73264ba87893df44 - languageName: node - linkType: hard - "is-symbol@npm:^1.0.2": version: 1.0.2 resolution: "is-symbol@npm:1.0.2" @@ -10722,20 +10381,6 @@ __metadata: languageName: node linkType: hard -"lodash.escape@npm:^4.0.1": - version: 4.0.1 - resolution: "lodash.escape@npm:4.0.1" - checksum: fcb54f457497256964d619d5cccbd80a961916fca60df3fe0fa3e7f052715c2944c0ed5aefb4f9e047d127d44aa2d55555f3350cb42c6549e9e293fb30b41e7f - languageName: node - linkType: hard - -"lodash.flattendeep@npm:^4.4.0": - version: 4.4.0 - resolution: "lodash.flattendeep@npm:4.4.0" - checksum: 8521c919acac3d4bcf0aaf040c1ca9cb35d6c617e2d72e9b4d51c9a58b4366622cd6077441a18be626c3f7b28227502b3bf042903d447b056ee7e0b11d45c722 - languageName: node - linkType: hard - "lodash.get@npm:^4.4.2": version: 4.4.2 resolution: "lodash.get@npm:4.4.2" @@ -10757,7 +10402,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:4.17.21, lodash@npm:^4.15.0, lodash@npm:^4.17.11, lodash@npm:^4.17.13, lodash@npm:^4.17.15, lodash@npm:^4.17.21, lodash@npm:~4.17.15": +"lodash@npm:4.17.21, lodash@npm:^4.17.11, lodash@npm:^4.17.13, lodash@npm:^4.17.15, lodash@npm:^4.17.21, lodash@npm:~4.17.15": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 @@ -11064,13 +10709,6 @@ __metadata: languageName: node linkType: hard -"moo@npm:^0.4.3": - version: 0.4.3 - resolution: "moo@npm:0.4.3" - checksum: f13bfb22ea62fc1e3584029d2efd62add90bf1dcb14de2a1eb9d59552a7f2ac3710739c0270e525049e48e58105effd93f8563520d687cae1ab7d76216ff6c2b - languageName: node - linkType: hard - "ms@npm:2.1.2, ms@npm:^2.1.1": version: 2.1.2 resolution: "ms@npm:2.1.2" @@ -11126,24 +10764,6 @@ __metadata: languageName: node linkType: hard -"nearley@npm:^2.7.10": - version: 2.16.0 - resolution: "nearley@npm:2.16.0" - dependencies: - commander: ^2.19.0 - moo: ^0.4.3 - railroad-diagrams: ^1.0.0 - randexp: 0.4.6 - semver: ^5.4.1 - bin: - nearley-railroad: bin/nearley-railroad.js - nearley-test: bin/nearley-test.js - nearley-unparse: bin/nearley-unparse.js - nearleyc: bin/nearleyc.js - checksum: 7ef261072e5295c9244377212001ace85f28daf6bdb670bb05443ba1f22840ed8e24124aab43d4dfccb7e5f036636ff4e2538097d0c084c8740bca06960f99f1 - languageName: node - linkType: hard - "node-gyp@npm:latest": version: 8.2.0 resolution: "node-gyp@npm:8.2.0" @@ -11238,15 +10858,6 @@ __metadata: languageName: node linkType: hard -"nth-check@npm:~1.0.1": - version: 1.0.2 - resolution: "nth-check@npm:1.0.2" - dependencies: - boolbase: ~1.0.0 - checksum: 59e115fdd75b971d0030f42ada3aac23898d4c03aa13371fa8b3339d23461d1badf3fde5aad251fb956aaa75c0a3b9bfcd07c08a34a83b4f9dadfdce1d19337c - languageName: node - linkType: hard - "number-is-nan@npm:^1.0.0": version: 1.0.1 resolution: "number-is-nan@npm:1.0.1" @@ -11303,13 +10914,6 @@ __metadata: languageName: node linkType: hard -"object-inspect@npm:^1.7.0": - version: 1.7.0 - resolution: "object-inspect@npm:1.7.0" - checksum: 53cc00d1a95025228d09549a6562905171932ae83a50b95f3bda7daaaf8ac7c518577180f1dfe72d262c0824737a81f025d93e4992c0506a268fb3f3bfaef3e9 - languageName: node - linkType: hard - "object-inspect@npm:^1.8.0": version: 1.9.0 resolution: "object-inspect@npm:1.9.0" @@ -11317,13 +10921,6 @@ __metadata: languageName: node linkType: hard -"object-is@npm:^1.0.2": - version: 1.0.2 - resolution: "object-is@npm:1.0.2" - checksum: 736cbe568e7f80f9c4ee7295af47be3a49423b549f5afc8b5c33dfa063b7a0959077109709f473a3c053268593ded108fd5dd7e2011faee3fd3aeaeb0a189ef9 - languageName: node - linkType: hard - "object-is@npm:^1.1.5": version: 1.1.5 resolution: "object-is@npm:1.1.5" @@ -11334,25 +10931,13 @@ __metadata: languageName: node linkType: hard -"object-keys@npm:^1.0.11, object-keys@npm:^1.0.12, object-keys@npm:^1.1.1": +"object-keys@npm:^1.0.12, object-keys@npm:^1.1.1": version: 1.1.1 resolution: "object-keys@npm:1.1.1" checksum: b363c5e7644b1e1b04aa507e88dcb8e3a2f52b6ffd0ea801e4c7a62d5aa559affe21c55a07fd4b1fd55fc03a33c610d73426664b20032405d7b92a1414c34d6a languageName: node linkType: hard -"object.assign@npm:^4.1.0": - version: 4.1.0 - resolution: "object.assign@npm:4.1.0" - dependencies: - define-properties: ^1.1.2 - function-bind: ^1.1.1 - has-symbols: ^1.0.0 - object-keys: ^1.0.11 - checksum: 648a9a463580bf48332d9a49a76fede2660ab1ee7104d9459b8a240562246da790b4151c3c073f28fda31c1fdc555d25a1d871e72be403e997e4468c91f4801f - languageName: node - linkType: hard - "object.assign@npm:^4.1.1, object.assign@npm:^4.1.2": version: 4.1.2 resolution: "object.assign@npm:4.1.2" @@ -11377,18 +10962,6 @@ __metadata: languageName: node linkType: hard -"object.entries@npm:^1.1.1": - version: 1.1.1 - resolution: "object.entries@npm:1.1.1" - dependencies: - define-properties: ^1.1.3 - es-abstract: ^1.17.0-next.1 - function-bind: ^1.1.1 - has: ^1.0.3 - checksum: e3183f0a51beab33fecc0a3eab00ffac95e9f04c328bfc7d52020806a464d906156a04b2a7ceb3bde46957e6d979b75dcd83b957b97aa2b98662f05d40bda76a - languageName: node - linkType: hard - "object.entries@npm:^1.1.6": version: 1.1.6 resolution: "object.entries@npm:1.1.6" @@ -11400,7 +10973,7 @@ __metadata: languageName: node linkType: hard -"object.fromentries@npm:^2.0.0, object.fromentries@npm:^2.0.6": +"object.fromentries@npm:^2.0.6": version: 2.0.6 resolution: "object.fromentries@npm:2.0.6" dependencies: @@ -11433,18 +11006,6 @@ __metadata: languageName: node linkType: hard -"object.values@npm:^1.1.1": - version: 1.1.1 - resolution: "object.values@npm:1.1.1" - dependencies: - define-properties: ^1.1.3 - es-abstract: ^1.17.0-next.1 - function-bind: ^1.1.1 - has: ^1.0.3 - checksum: f1217c09fa3338698bf748514f9d5cd279744fd34e6593920faf2ad0c8eb339b3b783b6ac0b02d9285d6ead53bcf7b1ac0a5aee4717b7e38c451336796ecb8af - languageName: node - linkType: hard - "object.values@npm:^1.1.6": version: 1.1.6 resolution: "object.values@npm:1.1.6" @@ -11582,15 +11143,6 @@ __metadata: languageName: node linkType: hard -"parse5@npm:^3.0.1": - version: 3.0.3 - resolution: "parse5@npm:3.0.3" - dependencies: - "@types/node": "*" - checksum: 6a82d59d60496f4a8bba99daee37eda728adb403197b9c9a163dcc02e369758992bcc67f1618d4f1445f4b12e7651e001c2847e446b8376d4d706e1d571f570d - languageName: node - linkType: hard - "parse5@npm:^7.0.0, parse5@npm:^7.1.1, parse5@npm:^7.1.2": version: 7.1.2 resolution: "parse5@npm:7.1.2" @@ -11642,13 +11194,6 @@ __metadata: languageName: node linkType: hard -"performance-now@npm:^2.1.0": - version: 2.1.0 - resolution: "performance-now@npm:2.1.0" - checksum: 534e641aa8f7cba160f0afec0599b6cecefbb516a2e837b512be0adbe6c1da5550e89c78059c7fabc5c9ffdf6627edabe23eb7c518c4500067a898fa65c2b550 - languageName: node - linkType: hard - "picocolors@npm:^1.0.0": version: 1.0.0 resolution: "picocolors@npm:1.0.0" @@ -11934,7 +11479,7 @@ __metadata: languageName: node linkType: hard -"prop-types@npm:^15.5.8, prop-types@npm:^15.7.0, prop-types@npm:^15.8.1": +"prop-types@npm:^15.5.8, prop-types@npm:^15.8.1": version: 15.8.1 resolution: "prop-types@npm:15.8.1" dependencies: @@ -11998,32 +11543,6 @@ __metadata: languageName: node linkType: hard -"raf@npm:^3.4.1": - version: 3.4.1 - resolution: "raf@npm:3.4.1" - dependencies: - performance-now: ^2.1.0 - checksum: 50ba284e481c8185dbcf45fc4618ba3aec580bb50c9121385d5698cb6012fe516d2015b1df6dd407a7b7c58d44be8086108236affbce1861edd6b44637c8cd52 - languageName: node - linkType: hard - -"railroad-diagrams@npm:^1.0.0": - version: 1.0.0 - resolution: "railroad-diagrams@npm:1.0.0" - checksum: 9e312af352b5ed89c2118edc0c06cef2cc039681817f65266719606e4e91ff6ae5374c707cc9033fe29a82c2703edf3c63471664f97f0167c85daf6f93496319 - languageName: node - linkType: hard - -"randexp@npm:0.4.6": - version: 0.4.6 - resolution: "randexp@npm:0.4.6" - dependencies: - discontinuous-range: 1.0.0 - ret: ~0.1.10 - checksum: 3c0d440a3f89d6d36844aa4dd57b5cdb0cab938a41956a16da743d3a3578ab32538fc41c16cc0984b6938f2ae4cbc0216967e9829e52191f70e32690d8e3445d - languageName: node - linkType: hard - "react-day-picker@npm:8.8.1": version: 8.8.1 resolution: "react-day-picker@npm:8.8.1" @@ -12145,20 +11664,6 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^16.12.0": - version: 16.13.0 - resolution: "react-is@npm:16.13.0" - checksum: 9da7d02ebeb5f2bedb781db5427097dbff9a23d7800b06f0a788bd557a47cd863ebf80de21348207edb66d7667c1adbd65a434e81a3b84c3fdae2597bb697ac5 - languageName: node - linkType: hard - -"react-is@npm:^16.12.0 || ^17.0.0 || ^18.0.0, react-is@npm:^18.0.0": - version: 18.2.0 - resolution: "react-is@npm:18.2.0" - checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e - languageName: node - linkType: hard - "react-is@npm:^16.13.1": version: 16.13.1 resolution: "react-is@npm:16.13.1" @@ -12173,13 +11678,20 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^17.0.0, react-is@npm:^17.0.1, react-is@npm:^17.0.2": +"react-is@npm:^17.0.1": version: 17.0.2 resolution: "react-is@npm:17.0.2" checksum: 9d6d111d8990dc98bc5402c1266a808b0459b5d54830bbea24c12d908b536df7883f268a7868cfaedde3dd9d4e0d574db456f84d2e6df9c4526f99bb4b5344d8 languageName: node linkType: hard +"react-is@npm:^18.0.0": + version: 18.2.0 + resolution: "react-is@npm:18.2.0" + checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e + languageName: node + linkType: hard + "react-joyride@npm:2.5.5": version: 2.5.5 resolution: "react-joyride@npm:2.5.5" @@ -12289,32 +11801,6 @@ __metadata: languageName: node linkType: hard -"react-shallow-renderer@npm:^16.13.1": - version: 16.15.0 - resolution: "react-shallow-renderer@npm:16.15.0" - dependencies: - object-assign: ^4.1.1 - react-is: ^16.12.0 || ^17.0.0 || ^18.0.0 - peerDependencies: - react: ^16.0.0 || ^17.0.0 || ^18.0.0 - checksum: 6052c7e3e9627485120ebd8257f128aad8f56386fe8d42374b7743eac1be457c33506d153c7886b4e32923c0c352d402ab805ef9ca02dbcd8393b2bdeb6e5af8 - languageName: node - linkType: hard - -"react-test-renderer@npm:^17.0.0": - version: 17.0.2 - resolution: "react-test-renderer@npm:17.0.2" - dependencies: - object-assign: ^4.1.1 - react-is: ^17.0.2 - react-shallow-renderer: ^16.13.1 - scheduler: ^0.20.2 - peerDependencies: - react: 17.0.2 - checksum: e6b5c6ed2a0bde2c34f1ab9523ff9bc4c141a271daf730d6b852374e83acc0155d58ab71a318251e953ebfa65b8bebb9c5dce3eba1ccfcbef7cc4e1e8261c401 - languageName: node - linkType: hard - "react-transition-group@npm:^4.3.0": version: 4.4.2 resolution: "react-transition-group@npm:4.4.2" @@ -12381,17 +11867,6 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^3.1.1": - version: 3.4.0 - resolution: "readable-stream@npm:3.4.0" - dependencies: - inherits: ^2.0.3 - string_decoder: ^1.1.1 - util-deprecate: ^1.0.1 - checksum: cb4a55018facb15312e2f91a0389d0cc41b88afef6fd9f533db75533ec60102bafd6fd0185699aa3328a3b2301e2f867ef1903f1b7389f916614edbc53359b94 - languageName: node - linkType: hard - "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -12700,13 +12175,6 @@ __metadata: languageName: node linkType: hard -"ret@npm:~0.1.10": - version: 0.1.15 - resolution: "ret@npm:0.1.15" - checksum: d76a9159eb8c946586567bd934358dfc08a36367b3257f7a3d7255fdd7b56597235af23c6afa0d7f0254159e8051f93c918809962ebd6df24ca2a83dbe4d4151 - languageName: node - linkType: hard - "retry@npm:^0.12.0": version: 0.12.0 resolution: "retry@npm:0.12.0" @@ -12753,16 +12221,6 @@ __metadata: languageName: node linkType: hard -"rst-selector-parser@npm:^2.2.3": - version: 2.2.3 - resolution: "rst-selector-parser@npm:2.2.3" - dependencies: - lodash.flattendeep: ^4.4.0 - nearley: ^2.7.10 - checksum: fbfb2f6a7d4c9b3e013ef555ac06e5dba444e0d37dc959b94c507b6c34093ef10fe98141338d9cac58e5ae0f9453a5ef7f85af3d5e6386b237c1b3552debe4a0 - languageName: node - linkType: hard - "run-parallel@npm:^1.1.9": version: 1.1.10 resolution: "run-parallel@npm:1.1.10" @@ -12847,15 +12305,6 @@ __metadata: languageName: node linkType: hard -"semver@npm:^5.4.1": - version: 5.7.0 - resolution: "semver@npm:5.7.0" - bin: - semver: ./bin/semver - checksum: 25d150834511d12ae0c1a0f012f294cb176b1497534c51c5ebb6209b7e8ab3845c6df4f1c078921487e6bcfcf0abd56ffdcabf38ef26d4e1bd93fdca0762cae4 - languageName: node - linkType: hard - "semver@npm:^6.0.0": version: 6.2.0 resolution: "semver@npm:6.2.0" @@ -13170,17 +12619,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trim@npm:^1.2.1": - version: 1.2.1 - resolution: "string.prototype.trim@npm:1.2.1" - dependencies: - define-properties: ^1.1.3 - es-abstract: ^1.17.0-next.1 - function-bind: ^1.1.1 - checksum: ff77c2b0223b0d6106da52de90e95eea1323bfa729480eb006d0ae311148694a6bf20fa32be33a7b502604428e3c9ac2bb0ea67aeb5d983ab5e7e1d000cbd009 - languageName: node - linkType: hard - "string.prototype.trim@npm:^1.2.7": version: 1.2.7 resolution: "string.prototype.trim@npm:1.2.7" @@ -13234,26 +12672,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimleft@npm:^2.1.1": - version: 2.1.1 - resolution: "string.prototype.trimleft@npm:2.1.1" - dependencies: - define-properties: ^1.1.3 - function-bind: ^1.1.1 - checksum: 2581c73a3714b2ac5166d7ee6d3b36f3e92b6b481d635230ee262227cdc53baa010f30d39fdaf1d448bee97c443e29f00c7fdfdfb07be5b5f94209e5929de110 - languageName: node - linkType: hard - -"string.prototype.trimright@npm:^2.1.1": - version: 2.1.1 - resolution: "string.prototype.trimright@npm:2.1.1" - dependencies: - define-properties: ^1.1.3 - function-bind: ^1.1.1 - checksum: f02a1d15cd4d8c2161eb0f685b49f560fb579fcd747dc40ff0dcd82575a5df75316d0fad9b89da7408b067759c47bd3c2271ab544e9c98a0fc6a315ee8c747e2 - languageName: node - linkType: hard - "string.prototype.trimstart@npm:^1.0.1": version: 1.0.3 resolution: "string.prototype.trimstart@npm:1.0.3" @@ -13296,15 +12714,6 @@ __metadata: languageName: node linkType: hard -"string_decoder@npm:^1.1.1": - version: 1.2.0 - resolution: "string_decoder@npm:1.2.0" - dependencies: - safe-buffer: ~5.1.0 - checksum: 7a36a08f12bab92a25afbe5492bc5c0571582961a05c4e84eac74fdd5af43cf553c457231d9b76622f2b6cd45aa8cebf38bc69819ccdcec0bcd010fd15e15348 - languageName: node - linkType: hard - "string_decoder@npm:~1.1.1": version: 1.1.1 resolution: "string_decoder@npm:1.1.1" @@ -14053,7 +13462,7 @@ __metadata: languageName: node linkType: hard -"util-deprecate@npm:^1.0.1, util-deprecate@npm:^1.0.2, util-deprecate@npm:~1.0.1": +"util-deprecate@npm:^1.0.2, util-deprecate@npm:~1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" checksum: 474acf1146cb2701fe3b074892217553dfcf9a031280919ba1b8d651a068c9b15d863b7303cb15bd00a862b498e6cf4ad7b4a08fb134edd5a6f7641681cb54a2 |