aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ui-common/components/controls/__tests__
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2021-08-17 15:50:55 +0200
committersonartech <sonartech@sonarsource.com>2021-08-20 20:03:08 +0000
commit6ef7ca151ecd602ca8e9cea21743a895a81e89ba (patch)
tree40d7a97a8075b416901a4078638e4cde9ee15942 /server/sonar-ui-common/components/controls/__tests__
parent2454e077b1d77d70508dcce6a5b015d4a69f41fa (diff)
downloadsonarqube-6ef7ca151ecd602ca8e9cea21743a895a81e89ba.tar.gz
sonarqube-6ef7ca151ecd602ca8e9cea21743a895a81e89ba.zip
SONAR-15297 Move sonar-ui-common code to sonar-web
Diffstat (limited to 'server/sonar-ui-common/components/controls/__tests__')
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ActionsDropdown-test.tsx92
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/BackButton-test.tsx48
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/BoxedGroupAccordion-test.tsx52
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/BoxedTabs-test.tsx66
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Checkbox-test.tsx115
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ClickEventBoundary-test.tsx49
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ConfirmButton-test.tsx44
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ConfirmModal-test.tsx60
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Dropdown-test.tsx111
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/EscKeydownHandler-test.tsx46
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/FavoriteButton-test.tsx54
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/GlobalMessages-test.tsx64
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/HelpTooltip-test.tsx52
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/IdentityProviderLink-test.tsx43
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/InputValidationField-test.tsx44
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ListFooter-test.tsx57
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ModalButton-test.tsx38
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ModalValidationField-test.tsx48
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/OutsideClickHandler-test.tsx74
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Radio-test.tsx52
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/RadioCard-test.tsx59
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/RadioToggle-test.tsx94
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ReloadButton-test.tsx48
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ScreenPositionFixer-test.tsx95
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/SearchBox-test.tsx90
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/SearchSelect-test.tsx50
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/SelectList-test.tsx148
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/SelectListListContainer-test.tsx44
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/SelectListListElement-test.tsx47
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/SimpleModal-test.tsx65
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Tabs-test.tsx81
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Toggle-test.tsx43
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Toggler-test.tsx48
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/Tooltip-test.tsx118
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ValidationForm-test.tsx47
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ValidationInput-test.tsx73
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/ValidationModal-test.tsx68
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap143
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap46
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedGroupAccordion-test.tsx.snap26
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap178
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/Checkbox-test.tsx.snap22
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap14
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmButton-test.tsx.snap20
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmModal-test.tsx.snap81
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/EscKeydownHandler-test.tsx.snap7
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/FavoriteButton-test.tsx.snap65
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/GlobalMessages-test.tsx.snap212
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap53
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap21
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap13
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ListFooter-test.tsx.snap85
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap73
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/OutsideClickHandler-test.tsx.snap7
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap29
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap172
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap92
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap46
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap37
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchSelect-test.tsx.snap17
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectList-test.tsx.snap558
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListContainer-test.tsx.snap61
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListElement-test.tsx.snap41
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap52
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tabs-test.tsx.snap52
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap55
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggler-test.tsx.snap58
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap40
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap19
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap98
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap110
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap31
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/__snapshots__/clipboard-test.tsx.snap52
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/buttons-test.tsx77
-rw-r--r--server/sonar-ui-common/components/controls/__tests__/clipboard-test.tsx102
75 files changed, 0 insertions, 5292 deletions
diff --git a/server/sonar-ui-common/components/controls/__tests__/ActionsDropdown-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ActionsDropdown-test.tsx
deleted file mode 100644
index a74b20fd933..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ActionsDropdown-test.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 sonarjs/no-duplicate-string */
-import { mount, 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';
-
-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={true}
- 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('a'));
- expect(onClick).toBeCalled();
- });
-
- it('should render correctly copy item', () => {
- const wrapper = mountRender({ copyValue: 'my content to copy to clipboard' });
- expect(wrapper).toMatchSnapshot();
- });
-
- function shallowRender(props: Partial<ActionsDropdownItem['props']> = {}) {
- return shallow(renderContent(props));
- }
-
- function mountRender(props: Partial<ActionsDropdownItem['props']> = {}) {
- return mount(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-ui-common/components/controls/__tests__/BackButton-test.tsx b/server/sonar-ui-common/components/controls/__tests__/BackButton-test.tsx
deleted file mode 100644
index 0f206076ad9..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/BackButton-test.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 testTheme from '../../../config/jest/testTheme';
-import { click } from '../../../helpers/testUtils';
-import { ThemeProvider } from '../../theme';
-import BackButton from '../BackButton';
-
-it('should render properly', () => {
- const wrapper = shallowRender();
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.find('ContextConsumer').dive()).toMatchSnapshot();
-});
-
-it('should handle click', () => {
- const onClick = jest.fn();
- const wrapper = shallowRender({ onClick });
- expect(wrapper).toMatchSnapshot();
- click(wrapper.find('a'));
- expect(onClick).toBeCalled();
-});
-
-function shallowRender(props: Partial<BackButton['props']> = {}) {
- return shallow<BackButton>(<BackButton onClick={jest.fn()} {...props} />, {
- wrappingComponent: ThemeProvider,
- wrappingComponentProps: {
- theme: testTheme,
- },
- });
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/BoxedGroupAccordion-test.tsx b/server/sonar-ui-common/components/controls/__tests__/BoxedGroupAccordion-test.tsx
deleted file mode 100644
index 970a3546c3a..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/BoxedGroupAccordion-test.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 BoxedGroupAccordion from '../BoxedGroupAccordion';
-
-it('should render correctly', () => {
- expect(getWrapper()).toMatchSnapshot();
-});
-
-it('should show the inner content after a click', () => {
- const onClick = jest.fn();
- const wrapper = getWrapper({ onClick });
- click(wrapper.find('.boxed-group-header'));
-
- expect(onClick).lastCalledWith('foo');
- wrapper.setProps({ open: true });
-
- expect(wrapper.find('.boxed-group-inner').exists()).toBe(true);
-});
-
-function getWrapper(props = {}) {
- return shallow(
- <BoxedGroupAccordion
- data="foo"
- onClick={() => {}}
- open={false}
- renderHeader={() => <div>header content</div>}
- title="Foo"
- {...props}>
- <div>inner content</div>
- </BoxedGroupAccordion>
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/BoxedTabs-test.tsx b/server/sonar-ui-common/components/controls/__tests__/BoxedTabs-test.tsx
deleted file mode 100644
index 6db0b5c28e1..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/BoxedTabs-test.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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<K>(overrides: Partial<BoxedTabsProps<K>>) {
- 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-ui-common/components/controls/__tests__/Checkbox-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Checkbox-test.tsx
deleted file mode 100644
index b56cce6c559..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Checkbox-test.tsx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 Checkbox from '../Checkbox';
-
-it('should render', () => {
- const checkbox = shallow(<Checkbox checked={true} onCheck={() => {}} title="Title value" />);
- expect(checkbox).toMatchSnapshot();
-});
-
-it('should render unchecked', () => {
- const checkbox = shallow(<Checkbox checked={false} onCheck={() => true} />);
- expect(checkbox.is('.icon-checkbox-checked')).toBe(false);
- expect(checkbox.prop('aria-checked')).toBe(false);
-});
-
-it('should render checked', () => {
- const checkbox = shallow(<Checkbox checked={true} onCheck={() => true} />);
- expect(checkbox.is('.icon-checkbox-checked')).toBe(true);
- expect(checkbox.prop('aria-checked')).toBe(true);
-});
-
-it('should render disabled', () => {
- const checkbox = shallow(<Checkbox checked={true} disabled={true} onCheck={() => true} />);
- expect(checkbox.is('.icon-checkbox-disabled')).toBe(true);
-});
-
-it('should render unchecked third state', () => {
- const checkbox = shallow(<Checkbox checked={false} onCheck={() => true} thirdState={true} />);
- expect(checkbox.is('.icon-checkbox-single')).toBe(true);
- expect(checkbox.is('.icon-checkbox-checked')).toBe(false);
-});
-
-it('should render checked third state', () => {
- const checkbox = shallow(<Checkbox checked={true} onCheck={() => true} thirdState={true} />);
- expect(checkbox.is('.icon-checkbox-single')).toBe(true);
- expect(checkbox.is('.icon-checkbox-checked')).toBe(true);
-});
-
-it('should render with a spinner', () => {
- const checkbox = shallow(<Checkbox checked={false} loading={true} onCheck={() => true} />);
- expect(checkbox.find('DeferredSpinner').exists()).toBe(true);
-});
-
-it('should render children', () => {
- const checkbox = shallow(
- <Checkbox checked={false} onCheck={() => true}>
- <span>foo</span>
- </Checkbox>
- );
- expect(checkbox.hasClass('link-checkbox')).toBe(true);
- expect(checkbox.find('span').exists()).toBe(true);
-});
-
-it('should render children with a spinner', () => {
- const checkbox = shallow(
- <Checkbox checked={false} loading={true} onCheck={() => true}>
- <span>foo</span>
- </Checkbox>
- );
- expect(checkbox.hasClass('link-checkbox')).toBe(true);
- expect(checkbox.find('span').exists()).toBe(true);
- expect(checkbox.find('DeferredSpinner').exists()).toBe(true);
-});
-
-it('should call onCheck', () => {
- const onCheck = jest.fn();
- const checkbox = shallow(<Checkbox checked={false} onCheck={onCheck} />);
- click(checkbox);
- expect(onCheck).toBeCalledWith(true, undefined);
-});
-
-it('should not call onCheck when disabled', () => {
- const onCheck = jest.fn();
- const checkbox = shallow(<Checkbox checked={false} disabled={true} onCheck={onCheck} />);
- click(checkbox);
- expect(onCheck).toHaveBeenCalledTimes(0);
-});
-
-it('should call onCheck with id as second parameter', () => {
- const onCheck = jest.fn();
- const checkbox = shallow(<Checkbox checked={false} id="foo" onCheck={onCheck} />);
- click(checkbox);
- expect(onCheck).toBeCalledWith(true, 'foo');
-});
-
-it('should apply custom class', () => {
- const checkbox = shallow(
- <Checkbox checked={true} className="customclass" onCheck={() => true} />
- );
- expect(checkbox.is('.customclass')).toBe(true);
-});
-
-it('should render the checkbox on the right', () => {
- expect(shallow(<Checkbox checked={true} onCheck={() => true} right={true} />)).toMatchSnapshot();
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/ClickEventBoundary-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ClickEventBoundary-test.tsx
deleted file mode 100644
index c2f6d701a76..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ClickEventBoundary-test.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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).toBeCalled();
- expect(parentOnClick).not.toBeCalled();
-});
-
-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-ui-common/components/controls/__tests__/ConfirmButton-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ConfirmButton-test.tsx
deleted file mode 100644
index 69b6fde10d5..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ConfirmButton-test.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 ConfirmButton from '../ConfirmButton';
-
-it('should display a modal button', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('should display a confirm modal', () => {
- expect(
- shallowRender().find('ModalButton').prop<Function>('modal')({ onClose: jest.fn() })
- ).toMatchSnapshot();
-});
-
-function shallowRender() {
- return shallow(
- <ConfirmButton
- confirmButtonText="submit"
- modalBody={<div />}
- modalHeader="title"
- onConfirm={jest.fn()}>
- {() => 'Confirm button'}
- </ConfirmButton>
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/ConfirmModal-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ConfirmModal-test.tsx
deleted file mode 100644
index cfefbac465a..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ConfirmModal-test.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 { submit, waitAndUpdate } from '../../../helpers/testUtils';
-import ConfirmModal from '../ConfirmModal';
-
-it('should render correctly', () => {
- const wrapper = shallow(
- <ConfirmModal
- confirmButtonText="confirm"
- confirmData="data"
- header="title"
- onClose={jest.fn()}
- onConfirm={jest.fn()}>
- <p>My confirm message</p>
- </ConfirmModal>
- );
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.find('SimpleModal').dive()).toMatchSnapshot();
-});
-
-it('should confirm and close after confirm', async () => {
- const onClose = jest.fn();
- const onConfirm = jest.fn(() => Promise.resolve());
- const wrapper = shallow(
- <ConfirmModal
- confirmButtonText="confirm"
- confirmData="data"
- header="title"
- onClose={onClose}
- onConfirm={onConfirm}>
- <p>My confirm message</p>
- </ConfirmModal>
- );
- const modalContent = wrapper.find('SimpleModal').dive();
- submit(modalContent.find('form'));
- expect(onConfirm).toBeCalledWith('data');
- expect(modalContent.find('footer')).toMatchSnapshot();
-
- await waitAndUpdate(wrapper);
- expect(onClose).toHaveBeenCalled();
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/Dropdown-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Dropdown-test.tsx
deleted file mode 100644
index 6c051fefb3e..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Dropdown-test.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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, 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.toBeCalled();
- click(wrapper.find('Button'));
- expect(onOpen).toBeCalled();
- });
-
- 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().dive().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-ui-common/components/controls/__tests__/EscKeydownHandler-test.tsx b/server/sonar-ui-common/components/controls/__tests__/EscKeydownHandler-test.tsx
deleted file mode 100644
index 6c852477b81..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/EscKeydownHandler-test.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 { KeyCodes } from '../../../helpers/keycodes';
-import { keydown } from '../../../helpers/testUtils';
-import EscKeydownHandler from '../EscKeydownHandler';
-
-jest.useFakeTimers();
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('should correctly trigger the keydown handler when hitting Esc', () => {
- const onKeydown = jest.fn();
- shallowRender({ onKeydown });
- jest.runAllTimers();
- keydown(KeyCodes.Escape);
- expect(onKeydown).toBeCalled();
-});
-
-function shallowRender(props: Partial<EscKeydownHandler['props']> = {}) {
- return shallow<EscKeydownHandler>(
- <EscKeydownHandler onKeydown={jest.fn()} {...props}>
- <span>Hi there</span>
- </EscKeydownHandler>
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/FavoriteButton-test.tsx b/server/sonar-ui-common/components/controls/__tests__/FavoriteButton-test.tsx
deleted file mode 100644
index d0978f050d4..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/FavoriteButton-test.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 FavoriteButton, { Props } from '../FavoriteButton';
-
-it('should render favorite', () => {
- const favorite = renderFavoriteBase({ favorite: true });
- expect(favorite).toMatchSnapshot();
-});
-
-it('should render not favorite', () => {
- const favorite = renderFavoriteBase({ favorite: false });
- expect(favorite).toMatchSnapshot();
-});
-
-it('should update properly', () => {
- const favorite = renderFavoriteBase({ favorite: false });
- expect(favorite).toMatchSnapshot();
-
- favorite.setProps({ favorite: true });
- expect(favorite).toMatchSnapshot();
-});
-
-it('should toggle favorite', () => {
- const toggleFavorite = jest.fn();
- const favorite = renderFavoriteBase({ toggleFavorite });
- click(favorite.find('ButtonLink'));
- expect(toggleFavorite).toBeCalled();
-});
-
-function renderFavoriteBase(props: Partial<Props> = {}) {
- return shallow(
- <FavoriteButton favorite={true} qualifier="TRK" toggleFavorite={jest.fn()} {...props} />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/GlobalMessages-test.tsx b/server/sonar-ui-common/components/controls/__tests__/GlobalMessages-test.tsx
deleted file mode 100644
index af48c1a9701..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/GlobalMessages-test.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 { matchers } from 'jest-emotion';
-import * as React from 'react';
-import testTheme from '../../../config/jest/testTheme';
-import GlobalMessages, { GlobalMessagesProps } from '../GlobalMessages';
-
-expect.extend(matchers);
-
-it('should not render when no message', () => {
- expect(shallowRender({ messages: [] }).type()).toBeNull();
-});
-
-it('should render correctly with a message', () => {
- const wrapper = shallowRender();
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.find('GlobalMessage').first().dive()).toMatchSnapshot();
- expect(wrapper.find('GlobalMessage').last().dive()).toMatchSnapshot();
-});
-
-it('should render with correct css', () => {
- const wrapper = shallowRender();
- expect(wrapper.render()).toMatchSnapshot();
- expect(wrapper.find('GlobalMessage').first().render()).toHaveStyleRule(
- 'background-color',
- testTheme.colors.red
- );
-
- expect(wrapper.find('GlobalMessage').last().render()).toHaveStyleRule(
- 'background-color',
- testTheme.colors.green
- );
-});
-
-function shallowRender(props: Partial<GlobalMessagesProps> = {}) {
- return shallow(
- <GlobalMessages
- closeGlobalMessage={jest.fn()}
- messages={[
- { id: '1', level: 'ERROR', message: 'Test' },
- { id: '2', level: 'SUCCESS', message: 'Test 2' },
- ]}
- {...props}
- />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/HelpTooltip-test.tsx b/server/sonar-ui-common/components/controls/__tests__/HelpTooltip-test.tsx
deleted file mode 100644
index 6bd89e53b25..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/HelpTooltip-test.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 testTheme from '../../../config/jest/testTheme';
-import { ThemeProvider } from '../../theme';
-import HelpTooltip, { DarkHelpTooltip } from '../HelpTooltip';
-
-it('should render properly', () => {
- const wrapper = shallow(<HelpTooltip overlay={<div className="my-overlay" />} />, {
- wrappingComponent: ThemeProvider,
- wrappingComponentProps: {
- theme: testTheme,
- },
- });
- expect(wrapper).toMatchSnapshot('default');
- expect(wrapper.find('ContextConsumer').dive()).toMatchSnapshot('default icon');
-
- wrapper.setProps({ size: 18 });
- expect(wrapper.find('ContextConsumer').dive().prop('size')).toBe(18);
-});
-
-it('should render dark helptooltip properly', () => {
- const wrapper = shallow(<DarkHelpTooltip overlay={<div className="my-overlay" />} size={14} />, {
- wrappingComponent: ThemeProvider,
- wrappingComponentProps: {
- theme: testTheme,
- },
- });
- expect(wrapper).toMatchSnapshot('dark');
- expect(wrapper.find('ContextConsumer').dive()).toMatchSnapshot('dark icon');
-
- wrapper.setProps({ size: undefined });
- expect(wrapper.find('ContextConsumer').dive().prop('size')).toBe(12);
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/IdentityProviderLink-test.tsx b/server/sonar-ui-common/components/controls/__tests__/IdentityProviderLink-test.tsx
deleted file mode 100644
index 0050cd6f277..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/IdentityProviderLink-test.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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-ui-common/components/controls/__tests__/InputValidationField-test.tsx b/server/sonar-ui-common/components/controls/__tests__/InputValidationField-test.tsx
deleted file mode 100644
index 6c7c421452c..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/InputValidationField-test.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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={true}
- disabled={false}
- error="Bad formatting"
- label="Foo field"
- name="field"
- onBlur={jest.fn()}
- onChange={jest.fn()}
- touched={true}
- value="foo"
- {...props}
- />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/ListFooter-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ListFooter-test.tsx
deleted file mode 100644
index 8970e984359..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ListFooter-test.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 ListFooter, { ListFooterProps } from '../ListFooter';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot('default');
- expect(shallowRender({ loading: true })).toMatchSnapshot('loading');
- expect(shallowRender({ needReload: true, reload: jest.fn() })).toMatchSnapshot('reload');
- expect(shallowRender({ loading: true, needReload: true, reload: jest.fn() })).toMatchSnapshot(
- 'reload, loading'
- );
- expect(shallowRender({ loadMore: undefined })).toMatchSnapshot(
- 'empty if no loadMore nor reload props'
- );
- expect(shallowRender({ count: 5 })).toMatchSnapshot('empty if everything is loaded');
-});
-
-it('should properly call loadMore', () => {
- const loadMore = jest.fn();
- const wrapper = shallowRender({ loadMore });
- click(wrapper.find(Button));
- expect(loadMore).toBeCalled();
-});
-
-it('should properly call reload', () => {
- const reload = jest.fn();
- const wrapper = shallowRender({ needReload: true, reload });
- click(wrapper.find(Button));
- expect(reload).toBeCalled();
-});
-
-function shallowRender(props: Partial<ListFooterProps> = {}) {
- return shallow<ListFooterProps>(
- <ListFooter count={3} loadMore={jest.fn()} total={5} {...props} />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/ModalButton-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ModalButton-test.tsx
deleted file mode 100644
index 490609803a7..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ModalButton-test.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 ModalButton from '../ModalButton';
-
-it('should open/close modal', () => {
- const wrapper = shallow(
- <ModalButton modal={({ onClose }) => <button id="js-close" onClick={onClose} type="button" />}>
- {({ onClick }) => <button id="js-open" onClick={onClick} type="button" />}
- </ModalButton>
- );
-
- expect(wrapper.find('#js-open').exists()).toBe(true);
- expect(wrapper.find('#js-close').exists()).toBe(false);
- click(wrapper.find('#js-open'));
- expect(wrapper.find('#js-close').exists()).toBe(true);
- click(wrapper.find('#js-close'));
- expect(wrapper.find('#js-close').exists()).toBe(false);
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/ModalValidationField-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ModalValidationField-test.tsx
deleted file mode 100644
index 27f9743870d..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ModalValidationField-test.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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={true}
- error="Is required"
- label={<label>Foo</label>}
- touched={true}
- {...props}>
- {({ className }) => <input className={className} type="text" />}
- </ModalValidationField>
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/OutsideClickHandler-test.tsx b/server/sonar-ui-common/components/controls/__tests__/OutsideClickHandler-test.tsx
deleted file mode 100644
index 4f540f59fec..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/OutsideClickHandler-test.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 OutsideClickHandler from '../OutsideClickHandler';
-
-jest.useFakeTimers();
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('should register for click event', () => {
- const addEventListener = jest.spyOn(window, 'addEventListener');
- const removeEventListener = jest.spyOn(window, 'removeEventListener');
-
- const wrapper = shallowRender();
-
- jest.runAllTimers();
-
- expect(addEventListener).toHaveBeenCalledWith('click', expect.anything());
-
- wrapper.instance().componentWillUnmount();
-
- expect(removeEventListener).toHaveBeenCalledWith('click', expect.anything());
-});
-
-it('should call event handler on click on window', () => {
- const onClickOutside = jest.fn();
-
- const map: { [key: string]: EventListener } = {};
- window.addEventListener = jest.fn((event, callback) => {
- map[event] = callback as EventListener;
- });
-
- mount(
- <div id="outside-element">
- <OutsideClickHandler onClickOutside={onClickOutside}>
- <div id="children" />
- </OutsideClickHandler>
- </div>
- );
-
- jest.runAllTimers();
-
- map['click'](new Event('click'));
- expect(onClickOutside).toHaveBeenCalled();
-});
-
-function shallowRender(props: Partial<OutsideClickHandler['props']> = {}) {
- return shallow<OutsideClickHandler>(
- <OutsideClickHandler onClickOutside={jest.fn()} {...props}>
- <div id="children" />
- </OutsideClickHandler>
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/Radio-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Radio-test.tsx
deleted file mode 100644
index 60d2050a45d..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Radio-test.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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-ui-common/components/controls/__tests__/RadioCard-test.tsx b/server/sonar-ui-common/components/controls/__tests__/RadioCard-test.tsx
deleted file mode 100644
index 2232f38b252..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/RadioCard-test.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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={true}>
- <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: true, titleInfo: 'info' });
- expect(wrapper).toMatchSnapshot();
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/RadioToggle-test.tsx b/server/sonar-ui-common/components/controls/__tests__/RadioToggle-test.tsx
deleted file mode 100644
index 3653374e31a..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/RadioToggle-test.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 { change } from '../../../helpers/testUtils';
-import RadioToggle from '../RadioToggle';
-
-it('renders', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('calls onCheck', () => {
- const onCheck = jest.fn();
- const wrapper = shallowRender({ onCheck });
- change(wrapper.find('input[id="sample__two"]'), '');
- expect(onCheck).toBeCalledWith('two');
-});
-
-it('handles numeric values', () => {
- const onCheck = jest.fn();
- const wrapper = shallowRender({
- onCheck,
- options: [
- { value: 1, label: 'first', tooltip: 'foo' },
- { value: 2, label: 'second', tooltip: 'bar' },
- ],
- value: 1,
- });
- change(wrapper.find('input[id="sample__2"]'), '');
- expect(onCheck).toBeCalledWith(2);
-});
-
-it('handles boolean values', () => {
- const onCheck = jest.fn();
- const wrapper = shallowRender({
- onCheck,
- options: [
- { value: true, label: 'yes', tooltip: 'foo' },
- { value: false, label: 'no', tooltip: 'bar' },
- ],
- value: true,
- });
- change(wrapper.find('input[id="sample__false"]'), '');
- expect(onCheck).toBeCalledWith(false);
-});
-
-it('initialize value', () => {
- const onCheck = jest.fn();
- const wrapper = shallowRender({
- onCheck,
- options: [
- { value: 1, label: 'first', tooltip: 'foo' },
- { value: 2, label: 'second', tooltip: 'bar', disabled: true },
- ],
- value: 2,
- });
- expect(wrapper.find('input[checked=true]').prop('id')).toBe('sample__2');
-});
-
-it('accepts advanced options fields', () => {
- expect(
- shallowRender({
- options: [
- { value: 'one', label: 'first', tooltip: 'foo' },
- { value: 'two', label: 'second', tooltip: 'bar', disabled: true },
- ],
- })
- ).toMatchSnapshot();
-});
-
-function shallowRender(props?: Partial<RadioToggle['props']>) {
- const options = [
- { value: 'one', label: 'first' },
- { value: 'two', label: 'second' },
- ];
- return shallow(<RadioToggle name="sample" onCheck={() => true} options={options} {...props} />);
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/ReloadButton-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ReloadButton-test.tsx
deleted file mode 100644
index c22fd1f313e..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ReloadButton-test.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 testTheme from '../../../config/jest/testTheme';
-import { click } from '../../../helpers/testUtils';
-import { ThemeProvider } from '../../theme';
-import ReloadButton from '../ReloadButton';
-
-it('should render properly', () => {
- const wrapper = shallowRender();
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.find('ContextConsumer').dive()).toMatchSnapshot();
-});
-
-it('should handle click', () => {
- const onClick = jest.fn();
- const wrapper = shallowRender({ onClick });
- expect(wrapper).toMatchSnapshot();
- click(wrapper.find('a'));
- expect(onClick).toBeCalled();
-});
-
-function shallowRender(props: Partial<ReloadButton['props']> = {}) {
- return shallow<ReloadButton>(<ReloadButton onClick={jest.fn()} {...props} />, {
- wrappingComponent: ThemeProvider,
- wrappingComponentProps: {
- theme: testTheme,
- },
- });
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/ScreenPositionFixer-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ScreenPositionFixer-test.tsx
deleted file mode 100644
index f857666cecd..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ScreenPositionFixer-test.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 testTheme from '../../../config/jest/testTheme';
-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 theme={testTheme} children={() => <div />} {...props} />);
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/SearchBox-test.tsx b/server/sonar-ui-common/components/controls/__tests__/SearchBox-test.tsx
deleted file mode 100644
index 7afa1839c5f..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/SearchBox-test.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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).toBeCalled();
- 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).toBeCalledWith('');
-});
-
-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).toBeCalledWith('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.toBeCalled();
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/SearchSelect-test.tsx b/server/sonar-ui-common/components/controls/__tests__/SearchSelect-test.tsx
deleted file mode 100644
index ed13eea6fa7..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/SearchSelect-test.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 SearchSelect from '../SearchSelect';
-
-jest.mock('lodash', () => {
- const lodash = require.requireActual('lodash');
- lodash.debounce = jest.fn((fn) => fn);
- return lodash;
-});
-
-it('should render Select', () => {
- expect(shallow(<SearchSelect onSearch={jest.fn()} onSelect={jest.fn()} />)).toMatchSnapshot();
-});
-
-it('should call onSelect', () => {
- const onSelect = jest.fn();
- const wrapper = shallow(<SearchSelect onSearch={jest.fn()} onSelect={onSelect} />);
- wrapper.prop('onChange')({ value: 'foo' });
- expect(onSelect).lastCalledWith({ value: 'foo' });
-});
-
-it('should call onSearch', () => {
- const onSearch = jest.fn().mockReturnValue(Promise.resolve([]));
- const wrapper = shallow(
- <SearchSelect minimumQueryLength={2} onSearch={onSearch} onSelect={jest.fn()} />
- );
- wrapper.prop('onInputChange')('f');
- expect(onSearch).not.toHaveBeenCalled();
- wrapper.prop('onInputChange')('foo');
- expect(onSearch).lastCalledWith('foo');
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/SelectList-test.tsx b/server/sonar-ui-common/components/controls/__tests__/SelectList-test.tsx
deleted file mode 100644
index ab3eb4f8072..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/SelectList-test.tsx
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 SelectList, { SelectListFilter } from '../SelectList';
-
-const elements = ['foo', 'bar', 'baz'];
-const selectedElements = [elements[0]];
-const disabledElements = [elements[1]];
-
-it('should display properly with basics features', async () => {
- const wrapper = shallowRender();
- await waitAndUpdate(wrapper);
- expect(wrapper.instance().mounted).toBe(true);
-
- expect(wrapper).toMatchSnapshot();
-
- wrapper.instance().componentWillUnmount();
- expect(wrapper.instance().mounted).toBe(false);
-});
-
-it('should display properly with advanced features', async () => {
- const wrapper = shallowRender({
- allowBulkSelection: true,
- elementsTotalCount: 125,
- pageSize: 10,
- readOnly: true,
- withPaging: true,
- });
- await waitAndUpdate(wrapper);
-
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should display a loader when searching', async () => {
- const wrapper = shallowRender();
- await waitAndUpdate(wrapper);
- expect(wrapper.state().loading).toBe(false);
-
- wrapper.instance().search({});
- expect(wrapper.state().loading).toBe(true);
- expect(wrapper).toMatchSnapshot();
-
- await waitAndUpdate(wrapper);
- expect(wrapper.state().loading).toBe(false);
-});
-
-it('should cancel filter selection when search is active', async () => {
- const spy = jest.fn().mockResolvedValue({});
- const wrapper = shallowRender({ onSearch: spy });
- wrapper.instance().changeFilter(SelectListFilter.Unselected);
- await waitAndUpdate(wrapper);
-
- expect(spy).toHaveBeenCalledWith({
- query: '',
- filter: SelectListFilter.Unselected,
- page: undefined,
- pageSize: undefined,
- });
- expect(wrapper).toMatchSnapshot();
-
- const query = 'test';
- wrapper.instance().handleQueryChange(query);
- expect(spy).toHaveBeenCalledWith({
- query,
- filter: SelectListFilter.All,
- page: undefined,
- pageSize: undefined,
- });
-
- await waitAndUpdate(wrapper);
- expect(wrapper).toMatchSnapshot();
-
- wrapper.instance().handleQueryChange('');
- expect(spy).toHaveBeenCalledWith({
- query: '',
- filter: SelectListFilter.Unselected,
- page: undefined,
- pageSize: undefined,
- });
-
- await waitAndUpdate(wrapper);
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should display pagination element properly and call search method with correct parameters', () => {
- const spy = jest.fn().mockResolvedValue({});
- const wrapper = shallowRender({ elementsTotalCount: 100, onSearch: spy, withPaging: true });
- expect(wrapper).toMatchSnapshot();
- expect(spy).toHaveBeenCalledWith({
- query: '',
- filter: SelectListFilter.Selected,
- page: 1,
- pageSize: 100,
- }); // Basic default call
-
- wrapper.instance().onLoadMore();
- expect(spy).toHaveBeenCalledWith({
- query: '',
- filter: SelectListFilter.Selected,
- page: 2,
- pageSize: 100,
- }); // Load more call
-
- wrapper.instance().onReload();
- expect(spy).toHaveBeenCalledWith({
- query: '',
- filter: SelectListFilter.Selected,
- page: 1,
- pageSize: 100,
- }); // Reload call
-
- wrapper.setProps({ needToReload: true });
- expect(wrapper).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<SelectList['props']> = {}) {
- return shallow<SelectList>(
- <SelectList
- disabledElements={disabledElements}
- elements={elements}
- onSearch={jest.fn(() => Promise.resolve())}
- onSelect={jest.fn(() => Promise.resolve())}
- onUnselect={jest.fn(() => Promise.resolve())}
- renderElement={(foo: string) => foo}
- selectedElements={selectedElements}
- {...props}
- />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/SelectListListContainer-test.tsx b/server/sonar-ui-common/components/controls/__tests__/SelectListListContainer-test.tsx
deleted file mode 100644
index 1b24bc866c1..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/SelectListListContainer-test.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 { SelectListFilter } from '../SelectList';
-import SelectListListContainer from '../SelectListListContainer';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<SelectListListContainer['props']> = {}) {
- return shallow(
- <SelectListListContainer
- allowBulkSelection={true}
- disabledElements={[]}
- elements={['foo', 'bar', 'baz']}
- filter={SelectListFilter.All}
- onSelect={jest.fn(() => Promise.resolve())}
- onUnselect={jest.fn(() => Promise.resolve())}
- readOnly={false}
- renderElement={(foo: string) => foo}
- selectedElements={['foo']}
- {...props}
- />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/SelectListListElement-test.tsx b/server/sonar-ui-common/components/controls/__tests__/SelectListListElement-test.tsx
deleted file mode 100644
index ca127222e04..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/SelectListListElement-test.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 SelectListListElement from '../SelectListListElement';
-
-const listElement = (
- <SelectListListElement
- element="foo"
- key="foo"
- onSelect={jest.fn(() => Promise.resolve())}
- onUnselect={jest.fn(() => Promise.resolve())}
- renderElement={(foo: string) => foo}
- selected={false}
- />
-);
-
-it('should display a loader when checking', async () => {
- const wrapper = shallow<SelectListListElement>(listElement);
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.state().loading).toBe(false);
-
- (wrapper.instance() as SelectListListElement).handleCheck(true);
- expect(wrapper.state().loading).toBe(true);
- expect(wrapper).toMatchSnapshot();
-
- await waitAndUpdate(wrapper);
- expect(wrapper.state().loading).toBe(false);
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/SimpleModal-test.tsx b/server/sonar-ui-common/components/controls/__tests__/SimpleModal-test.tsx
deleted file mode 100644
index 5a8e6bb0cd7..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/SimpleModal-test.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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).toBeCalled();
-});
-
-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).toBeCalled();
- 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-ui-common/components/controls/__tests__/Tabs-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Tabs-test.tsx
deleted file mode 100644
index 11cf4e5e353..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Tabs-test.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 Tabs, { Tab } from '../Tabs';
-
-it('should render correctly', () => {
- const wrapper = shallow(
- <Tabs
- onChange={jest.fn()}
- selected="bar"
- tabs={[
- { key: 'foo', node: 'Foo' },
- { key: 'bar', node: 'Bar' },
- ]}
- />
- );
-
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should switch tabs', () => {
- const onChange = jest.fn();
- const wrapper = shallow(
- <Tabs
- onChange={onChange}
- selected="bar"
- tabs={[
- { key: 'foo', node: 'Foo' },
- { key: 'bar', node: 'Bar' },
- ]}
- />
- );
-
- click(shallow(wrapper.find('Tab').get(0)).find('.js-foo'));
- expect(onChange).toBeCalledWith('foo');
- click(shallow(wrapper.find('Tab').get(1)).find('.js-bar'));
- expect(onChange).toBeCalledWith('bar');
-});
-
-it('should render single tab correctly', () => {
- const onSelect = jest.fn();
- const wrapper = shallow(
- <Tab name="foo" onSelect={onSelect} selected={true}>
- <span>Foo</span>
- </Tab>
- );
- expect(wrapper).toMatchSnapshot();
- click(wrapper.find('a'));
- expect(onSelect).toBeCalledWith('foo');
-});
-
-it('should disable single tab', () => {
- const onSelect = jest.fn();
- const wrapper = shallow(
- <Tab disabled={true} name="foo" onSelect={onSelect} selected={true}>
- <span>Foo</span>
- </Tab>
- );
- expect(wrapper).toMatchSnapshot();
- click(wrapper.find('a'));
- expect(onSelect).not.toBeCalled();
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/Toggle-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Toggle-test.tsx
deleted file mode 100644
index f3e39aca5df..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Toggle-test.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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).toBeCalledWith(false);
-});
-
-function shallowRender(props?: Partial<Toggle['props']>) {
- return shallow(
- <Toggle disabled={true} name="toggle-name" onChange={jest.fn()} value={true} {...props} />
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/Toggler-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Toggler-test.tsx
deleted file mode 100644
index 679177cfda3..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Toggler-test.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 Toggler from '../Toggler';
-
-it('should render only children', () => {
- expect(shallowRender({ open: false })).toMatchSnapshot();
-});
-
-it('should render children and overlay', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('should render when closeOnClick=true', () => {
- expect(shallowRender({ closeOnClick: true })).toMatchSnapshot();
-});
-
-it('should not render click wrappers', () => {
- expect(
- shallowRender({ closeOnClick: false, closeOnClickOutside: false, closeOnEscape: false })
- ).toMatchSnapshot();
-});
-
-function shallowRender(props?: Partial<Toggler['props']>) {
- return shallow(
- <Toggler onRequestClose={jest.fn()} open={true} overlay={<div id="overlay" />} {...props}>
- <div id="toggle" />
- </Toggler>
- );
-}
diff --git a/server/sonar-ui-common/components/controls/__tests__/Tooltip-test.tsx b/server/sonar-ui-common/components/controls/__tests__/Tooltip-test.tsx
deleted file mode 100644
index e2a395b609e..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/Tooltip-test.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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';
-
-jest.useFakeTimers();
-jest.mock('react-dom', () => {
- const actual = jest.requireActual('react-dom');
- return Object.assign({}, actual, {
- findDOMNode: jest.fn().mockReturnValue(undefined),
- });
-});
-
-beforeEach(jest.clearAllMocks);
-
-it('should render', () => {
- expect(shallowRenderTooltipInner()).toMatchSnapshot();
- expect(
- shallow(
- <TooltipInner overlay={<span id="overlay" />} visible={true}>
- <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('mouseenter');
- jest.runOnlyPendingTimers();
- wrapper.update();
- expect(wrapper.find('TooltipPortal').exists()).toBe(true);
- expect(onShow).toBeCalled();
-
- wrapper.find('#tooltip').simulate('mouseleave');
- jest.runOnlyPendingTimers();
- wrapper.update();
- expect(wrapper.find('TooltipPortal').exists()).toBe(false);
- expect(onHide).toBeCalled();
-});
-
-it('should not open when mouse goes away quickly', () => {
- const onShow = jest.fn();
- const onHide = jest.fn();
- const wrapper = shallowRenderTooltipInner({ onHide, onShow });
-
- wrapper.find('#tooltip').simulate('mouseenter');
- wrapper.find('#tooltip').simulate('mouseleave');
- jest.runOnlyPendingTimers();
- wrapper.update();
-
- expect(wrapper.find('TooltipPortal').exists()).toBe(false);
-});
-
-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-ui-common/components/controls/__tests__/ValidationForm-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ValidationForm-test.tsx
deleted file mode 100644
index 64827f932ed..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ValidationForm-test.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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();
- 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).toBeCalledWith(
- expect.objectContaining({ dirty: false, errors: {}, values: { foo: 'bar' } })
- );
-
- wrapper.prop<Function>('onSubmit')({ foo: 'bar' }, { setSubmitting });
- expect(setSubmitting).toBeCalledWith(false);
-
- onSubmit.mockResolvedValue(undefined).mockClear();
- setSubmitting.mockClear();
- wrapper.prop<Function>('onSubmit')({ foo: 'bar' }, { setSubmitting });
- await new Promise(setImmediate);
- expect(setSubmitting).toBeCalledWith(false);
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/ValidationInput-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ValidationInput-test.tsx
deleted file mode 100644
index 97d4a2a5937..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ValidationInput-test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 '../ValidationInput';
-
-it('should render', () => {
- expect(
- shallow(
- <ValidationInput
- description="My description"
- error={undefined}
- help="Help message"
- id="field-id"
- isInvalid={false}
- isValid={false}
- label="Field label"
- required={true}>
- <div />
- </ValidationInput>
- )
- ).toMatchSnapshot();
-});
-
-it('should render with error', () => {
- expect(
- shallow(
- <ValidationInput
- description={<div>My description</div>}
- error="Field error message"
- id="field-id"
- isInvalid={true}
- isValid={false}
- label="Field label">
- <div />
- </ValidationInput>
- )
- ).toMatchSnapshot();
-});
-
-it('should render when valid', () => {
- expect(
- shallow(
- <ValidationInput
- description="My description"
- error={undefined}
- id="field-id"
- isInvalid={false}
- isValid={true}
- label="Field label"
- required={true}>
- <div />
- </ValidationInput>
- )
- ).toMatchSnapshot();
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/ValidationModal-test.tsx b/server/sonar-ui-common/components/controls/__tests__/ValidationModal-test.tsx
deleted file mode 100644
index e3825083577..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/ValidationModal-test.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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).toBeCalledWith(data);
-
- await waitAndUpdate(wrapper);
- expect(onClose).toBeCalled();
-});
-
-function shallowRender(props: Partial<ValidationModal<{ field: string }>['props']> = {}) {
- return shallow<ValidationModal<{ field: string }>>(
- <ValidationModal<{ field: string }>
- confirmButtonText="confirm"
- header="title"
- initialValues={{ field: 'foo' }}
- isDestructive={true}
- isInitialValid={true}
- 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-ui-common/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap
deleted file mode 100644
index 4bd6a2ea46d..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap
+++ /dev/null
@@ -1,143 +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>
- <a
- className="foo"
- href="#"
- onClick={[Function]}
- >
- <span>
- Hello world
- </span>
- </a>
-</li>
-`;
-
-exports[`ActionsDropdownItem should render correctly 2`] = `
-<li>
- <Link
- className="foo text-danger"
- id="baz"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="path/name"
- >
- <span>
- Hello world
- </span>
- </Link>
-</li>
-`;
-
-exports[`ActionsDropdownItem should render correctly 3`] = `
-<li>
- <a
- className="foo"
- download="foo/bar"
- href="path/name"
- >
- <span>
- Hello world
- </span>
- </a>
-</li>
-`;
-
-exports[`ActionsDropdownItem should render correctly copy item 1`] = `
-<ActionsDropdownItem
- className="foo"
- copyValue="my content to copy to clipboard"
->
- <ClipboardBase>
- <Tooltip
- overlay="copied_action"
- visible={false}
- >
- <TooltipInner
- mouseEnterDelay={0.1}
- overlay="copied_action"
- visible={false}
- >
- <li
- data-clipboard-text="my content to copy to clipboard"
- onMouseEnter={[Function]}
- onMouseLeave={[Function]}
- >
- <a
- className="foo"
- href="#"
- onClick={[Function]}
- >
- <span>
- Hello world
- </span>
- </a>
- </li>
- </TooltipInner>
- </Tooltip>
- </ClipboardBase>
-</ActionsDropdownItem>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap
deleted file mode 100644
index 57a5f2c6135..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap
+++ /dev/null
@@ -1,46 +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]}
- >
- <ContextConsumer>
- <Component />
- </ContextConsumer>
- </a>
-</Tooltip>
-`;
-
-exports[`should render properly 1`] = `
-<Tooltip
- overlay="issues.return_to_list"
->
- <a
- className="link-no-underline"
- href="#"
- onClick={[Function]}
- >
- <ContextConsumer>
- <Component />
- </ContextConsumer>
- </a>
-</Tooltip>
-`;
-
-exports[`should render properly 2`] = `
-<svg
- 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="#777"
- />
-</svg>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedGroupAccordion-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedGroupAccordion-test.tsx.snap
deleted file mode 100644
index 0c7b74b79d9..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedGroupAccordion-test.tsx.snap
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- className="boxed-group boxed-group-accordion"
->
- <div
- className="boxed-group-header"
- onClick={[Function]}
- role="listitem"
- >
- <span
- className="boxed-group-accordion-title"
- >
- <OpenCloseIcon
- className="little-spacer-right"
- open={false}
- />
- Foo
- </span>
- <div>
- header content
- </div>
- </div>
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap
deleted file mode 100644
index 22d8f761533..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/BoxedTabs-test.tsx.snap
+++ /dev/null
@@ -1,178 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-.emotion-6 {
- 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-0 {
- 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-2 {
- display: none;
- background-color: #4b9fd5;
- height: 3px;
- width: 100%;
- position: absolute;
- left: 0;
- top: -1px;
-}
-
-<BoxedTabs
- className="boxed-tabs"
- onSelect={[MockFunction]}
- selected="a"
- tabs={
- Array [
- Object {
- "key": "a",
- "label": "labela",
- },
- Object {
- "key": "b",
- "label": "labelb",
- },
- Object {
- "key": "c",
- "label": <span>
- Complex label
- <strong>
- !!!
- </strong>
- </span>,
- },
- ]
- }
->
- <Styled(div)
- className="boxed-tabs"
- >
- <div
- className="boxed-tabs emotion-6"
- >
- <Styled(button)
- active={true}
- key="0"
- onClick={[Function]}
- type="button"
- >
- <button
- className="emotion-1"
- onClick={[Function]}
- type="button"
- >
- <Styled(div)
- active={true}
- >
- <div
- className="emotion-0"
- />
- </Styled(div)>
- labela
- </button>
- </Styled(button)>
- <Styled(button)
- active={false}
- key="1"
- onClick={[Function]}
- type="button"
- >
- <button
- className="emotion-3"
- onClick={[Function]}
- type="button"
- >
- <Styled(div)
- active={false}
- >
- <div
- className="emotion-2"
- />
- </Styled(div)>
- labelb
- </button>
- </Styled(button)>
- <Styled(button)
- active={false}
- key="2"
- onClick={[Function]}
- type="button"
- >
- <button
- className="emotion-3"
- onClick={[Function]}
- type="button"
- >
- <Styled(div)
- active={false}
- >
- <div
- className="emotion-2"
- />
- </Styled(div)>
- <span>
- Complex label
- <strong>
- !!!
- </strong>
- </span>
- </button>
- </Styled(button)>
- </div>
- </Styled(div)>
-</BoxedTabs>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Checkbox-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Checkbox-test.tsx.snap
deleted file mode 100644
index 69c0c60af8c..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Checkbox-test.tsx.snap
+++ /dev/null
@@ -1,22 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render 1`] = `
-<a
- aria-checked={true}
- className="icon-checkbox icon-checkbox-checked"
- href="#"
- onClick={[Function]}
- role="checkbox"
- title="Title value"
-/>
-`;
-
-exports[`should render the checkbox on the right 1`] = `
-<a
- aria-checked={true}
- className="icon-checkbox icon-checkbox-checked"
- href="#"
- onClick={[Function]}
- role="checkbox"
-/>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ClickEventBoundary-test.tsx.snap
deleted file mode 100644
index 62eac278e7f..00000000000
--- a/server/sonar-ui-common/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-ui-common/components/controls/__tests__/__snapshots__/ConfirmButton-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmButton-test.tsx.snap
deleted file mode 100644
index f94c3829503..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmButton-test.tsx.snap
+++ /dev/null
@@ -1,20 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should display a confirm modal 1`] = `
-<ConfirmModal
- confirmButtonText="submit"
- header="title"
- onClose={[MockFunction]}
- onConfirm={[MockFunction]}
->
- <div />
-</ConfirmModal>
-`;
-
-exports[`should display a modal button 1`] = `
-<ModalButton
- modal={[Function]}
->
- <Component />
-</ModalButton>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmModal-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmModal-test.tsx.snap
deleted file mode 100644
index f1367ae048a..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ConfirmModal-test.tsx.snap
+++ /dev/null
@@ -1,81 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should confirm and close after confirm 1`] = `
-<footer
- className="modal-foot"
->
- <DeferredSpinner
- className="spacer-right"
- loading={true}
- />
- <SubmitButton
- autoFocus={true}
- disabled={true}
- >
- confirm
- </SubmitButton>
- <ResetButtonLink
- disabled={true}
- onClick={[Function]}
- >
- cancel
- </ResetButtonLink>
-</footer>
-`;
-
-exports[`should render correctly 1`] = `
-<SimpleModal
- header="title"
- onClose={[MockFunction]}
- onSubmit={[Function]}
->
- <Component />
-</SimpleModal>
-`;
-
-exports[`should render correctly 2`] = `
-<Modal
- contentLabel="title"
- onRequestClose={[MockFunction]}
->
- <ClickEventBoundary>
- <form
- onSubmit={[Function]}
- >
- <header
- className="modal-head"
- >
- <h2>
- title
- </h2>
- </header>
- <div
- className="modal-body"
- >
- <p>
- My confirm message
- </p>
- </div>
- <footer
- className="modal-foot"
- >
- <DeferredSpinner
- className="spacer-right"
- loading={false}
- />
- <SubmitButton
- autoFocus={true}
- >
- confirm
- </SubmitButton>
- <ResetButtonLink
- disabled={false}
- onClick={[Function]}
- >
- cancel
- </ResetButtonLink>
- </footer>
- </form>
- </ClickEventBoundary>
-</Modal>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/EscKeydownHandler-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/EscKeydownHandler-test.tsx.snap
deleted file mode 100644
index 239d6bfe358..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/EscKeydownHandler-test.tsx.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<span>
- Hi there
-</span>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/FavoriteButton-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/FavoriteButton-test.tsx.snap
deleted file mode 100644
index f66e2ddd464..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/FavoriteButton-test.tsx.snap
+++ /dev/null
@@ -1,65 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render favorite 1`] = `
-<Tooltip
- overlay="favorite.current.TRK"
->
- <ButtonLink
- aria-label="favorite.action.remove"
- className="favorite-link link-no-underline"
- onClick={[MockFunction]}
- >
- <FavoriteIcon
- favorite={true}
- />
- </ButtonLink>
-</Tooltip>
-`;
-
-exports[`should render not favorite 1`] = `
-<Tooltip
- overlay="favorite.check.TRK"
->
- <ButtonLink
- aria-label="favorite.action.add"
- className="favorite-link link-no-underline"
- onClick={[MockFunction]}
- >
- <FavoriteIcon
- favorite={false}
- />
- </ButtonLink>
-</Tooltip>
-`;
-
-exports[`should update properly 1`] = `
-<Tooltip
- overlay="favorite.check.TRK"
->
- <ButtonLink
- aria-label="favorite.action.add"
- className="favorite-link link-no-underline"
- onClick={[MockFunction]}
- >
- <FavoriteIcon
- favorite={false}
- />
- </ButtonLink>
-</Tooltip>
-`;
-
-exports[`should update properly 2`] = `
-<Tooltip
- overlay="favorite.current.TRK"
->
- <ButtonLink
- aria-label="favorite.action.remove"
- className="favorite-link link-no-underline"
- onClick={[MockFunction]}
- >
- <FavoriteIcon
- favorite={true}
- />
- </ButtonLink>
-</Tooltip>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/GlobalMessages-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/GlobalMessages-test.tsx.snap
deleted file mode 100644
index fdeaf6c28e4..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/GlobalMessages-test.tsx.snap
+++ /dev/null
@@ -1,212 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly with a message 1`] = `
-<Styled(div)>
- <GlobalMessage
- closeGlobalMessage={[MockFunction]}
- key="1"
- message={
- Object {
- "id": "1",
- "level": "ERROR",
- "message": "Test",
- }
- }
- />
- <GlobalMessage
- closeGlobalMessage={[MockFunction]}
- key="2"
- message={
- Object {
- "id": "2",
- "level": "SUCCESS",
- "message": "Test 2",
- }
- }
- />
-</Styled(div)>
-`;
-
-exports[`should render correctly with a message 2`] = `
-<Styled(div)
- data-test="global-message__ERROR"
- level="ERROR"
- role="alert"
->
- Test
- <Styled(ClearButton)
- className="button-small"
- color="#fff"
- level="ERROR"
- onClick={[Function]}
- />
-</Styled(div)>
-`;
-
-exports[`should render correctly with a message 3`] = `
-<Styled(div)
- data-test="global-message__SUCCESS"
- level="SUCCESS"
- role="status"
->
- Test 2
- <Styled(ClearButton)
- className="button-small"
- color="#fff"
- level="SUCCESS"
- onClick={[Function]}
- />
-</Styled(div)>
-`;
-
-exports[`should render with correct css 1`] = `
-@keyframes animation-0 {
- from {
- opacity: 0;
- }
-
- to {
- opacity: 1;
- }
-}
-
-@keyframes animation-0 {
- from {
- opacity: 0;
- }
-
- to {
- opacity: 1;
- }
-}
-
-.emotion-4 {
- position: fixed;
- z-index: 7000;
- top: 0;
- left: 50%;
- width: 350px;
- margin-left: -175px;
-}
-
-.emotion-1 {
- position: relative;
- padding: 0 30px 0 10px;
- line-height: 24px;
- border-radius: 0 0 3px 3px;
- box-sizing: border-box;
- color: #ffffff;
- background-color: #d4333f;
- text-align: center;
- opacity: 0;
- -webkit-animation: animation-0 0.2s ease forwards;
- animation: animation-0 0.2s ease forwards;
-}
-
-.emotion-1 + .emotion-1 {
- margin-top: calc(8px / 2);
- border-radius: 3px;
-}
-
-.emotion-0 {
- position: absolute;
- top: calc(8px / 4);
- right: calc(8px / 4);
-}
-
-.emotion-0:hover svg,
-.emotion-0:focus svg {
- color: #d4333f;
-}
-
-.emotion-3 {
- position: relative;
- padding: 0 30px 0 10px;
- line-height: 24px;
- border-radius: 0 0 3px 3px;
- box-sizing: border-box;
- color: #ffffff;
- background-color: #00aa00;
- text-align: center;
- opacity: 0;
- -webkit-animation: animation-0 0.2s ease forwards;
- animation: animation-0 0.2s ease forwards;
-}
-
-.emotion-3 + .emotion-3 {
- margin-top: calc(8px / 2);
- border-radius: 3px;
-}
-
-.emotion-2 {
- position: absolute;
- top: calc(8px / 4);
- right: calc(8px / 4);
-}
-
-.emotion-2:hover svg,
-.emotion-2:focus svg {
- color: #00aa00;
-}
-
-<div
- class="emotion-4"
->
- <div
- class="emotion-1"
- data-test="global-message__ERROR"
- role="alert"
- >
- Test
- <button
- class="button button-small emotion-0 button-icon"
- level="ERROR"
- style="color:#fff"
- type="button"
- >
- <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"
- >
- <path
- d="M14 4.242L11.758 2l-3.76 3.76L4.242 2 2 4.242l3.756 3.756L2 11.758 4.242 14l3.756-3.76 3.76 3.76L14 11.758l-3.76-3.76L14 4.242z"
- style="fill:currentColor"
- />
- </svg>
- </button>
- </div>
- <div
- class="emotion-3"
- data-test="global-message__SUCCESS"
- role="status"
- >
- Test 2
- <button
- class="button button-small emotion-2 button-icon"
- level="SUCCESS"
- style="color:#fff"
- type="button"
- >
- <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"
- >
- <path
- d="M14 4.242L11.758 2l-3.76 3.76L4.242 2 2 4.242l3.756 3.756L2 11.758 4.242 14l3.756-3.76 3.76 3.76L14 11.758l-3.76-3.76L14 4.242z"
- style="fill:currentColor"
- />
- </svg>
- </button>
- </div>
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap
deleted file mode 100644
index abf28dfdd32..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/HelpTooltip-test.tsx.snap
+++ /dev/null
@@ -1,53 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render dark helptooltip properly: dark 1`] = `
-<HelpTooltip
- overlay={
- <div
- className="my-overlay"
- />
- }
->
- <ContextConsumer>
- <Component />
- </ContextConsumer>
-</HelpTooltip>
-`;
-
-exports[`should render dark helptooltip properly: dark icon 1`] = `
-<HelpIcon
- fill="rgba(0, 0, 0, 0.25)"
- fillInner="#ffffff"
- size={14}
-/>
-`;
-
-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"
- >
- <ContextConsumer>
- <Component />
- </ContextConsumer>
- </span>
- </Tooltip>
-</div>
-`;
-
-exports[`should render properly: default icon 1`] = `
-<HelpIcon
- fill="#b4b4b4"
- size={12}
-/>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/IdentityProviderLink-test.tsx.snap
deleted file mode 100644
index d3a38a52376..00000000000
--- a/server/sonar-ui-common/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={
- Object {
- "backgroundColor": "#000",
- }
- }
->
- <img
- alt="Foo"
- height={20}
- src="/some/path"
- width={20}
- />
- Link text
-</a>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/InputValidationField-test.tsx.snap
deleted file mode 100644
index 16f3e1c2dfa..00000000000
--- a/server/sonar-ui-common/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-ui-common/components/controls/__tests__/__snapshots__/ListFooter-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ListFooter-test.tsx.snap
deleted file mode 100644
index 2d55aa0d03b..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ListFooter-test.tsx.snap
+++ /dev/null
@@ -1,85 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly: default 1`] = `
-<footer
- className="spacer-top note text-center"
->
- x_of_y_shown.3.5
- <Button
- className="spacer-left"
- data-test="show-more"
- onClick={[MockFunction]}
- >
- show_more
- </Button>
-</footer>
-`;
-
-exports[`should render correctly: empty if everything is loaded 1`] = `
-<footer
- className="spacer-top note text-center"
->
- x_of_y_shown.5.5
-</footer>
-`;
-
-exports[`should render correctly: empty if no loadMore nor reload props 1`] = `
-<footer
- className="spacer-top note text-center"
->
- x_of_y_shown.3.5
-</footer>
-`;
-
-exports[`should render correctly: loading 1`] = `
-<footer
- className="spacer-top note text-center"
->
- x_of_y_shown.3.5
- <Button
- className="spacer-left"
- data-test="show-more"
- disabled={true}
- onClick={[MockFunction]}
- >
- show_more
- </Button>
- <DeferredSpinner
- className="text-bottom spacer-left position-absolute"
- />
-</footer>
-`;
-
-exports[`should render correctly: reload 1`] = `
-<footer
- className="spacer-top note text-center"
->
- x_of_y_shown.3.5
- <Button
- className="spacer-left"
- data-test="reload"
- onClick={[MockFunction]}
- >
- reload
- </Button>
-</footer>
-`;
-
-exports[`should render correctly: reload, loading 1`] = `
-<footer
- className="spacer-top note text-center"
->
- x_of_y_shown.3.5
- <Button
- className="spacer-left"
- data-test="reload"
- disabled={true}
- onClick={[MockFunction]}
- >
- reload
- </Button>
- <DeferredSpinner
- className="text-bottom spacer-left position-absolute"
- />
-</footer>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap
deleted file mode 100644
index 4b4e605c0ad..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ModalValidationField-test.tsx.snap
+++ /dev/null
@@ -1,73 +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
- className=""
- 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
- className=""
- type="text"
- />
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/OutsideClickHandler-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/OutsideClickHandler-test.tsx.snap
deleted file mode 100644
index a4f533d8e3a..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/OutsideClickHandler-test.tsx.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- id="children"
-/>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Radio-test.tsx.snap
deleted file mode 100644
index 8649fba79b8..00000000000
--- a/server/sonar-ui-common/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-ui-common/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap
deleted file mode 100644
index e58f9d73597..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioCard-test.tsx.snap
+++ /dev/null
@@ -1,172 +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={true}
- className="radio-card radio-card-actionable selected"
- onClick={
- [MockFunction] {
- "calls": Array [
- Array [
- Object {
- "currentTarget": Object {
- "blur": [Function],
- },
- "preventDefault": [Function],
- "stopPropagation": [Function],
- "target": Object {
- "blur": [Function],
- },
- },
- ],
- ],
- "results": Array [
- Object {
- "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 is-checked"
- />
- 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={
- Object {
- "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={
- Object {
- "recommended": <strong>
- recommended
- </strong>,
- }
- }
- />
- </div>
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap
deleted file mode 100644
index 791d312e720..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/RadioToggle-test.tsx.snap
+++ /dev/null
@@ -1,92 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`accepts advanced options fields 1`] = `
-<ul
- className="radio-toggle"
->
- <li
- key="one"
- >
- <input
- checked={false}
- id="sample__one"
- name="sample"
- onChange={[Function]}
- type="radio"
- />
- <Tooltip
- overlay="foo"
- >
- <label
- htmlFor="sample__one"
- >
- first
- </label>
- </Tooltip>
- </li>
- <li
- key="two"
- >
- <input
- checked={false}
- disabled={true}
- id="sample__two"
- name="sample"
- onChange={[Function]}
- type="radio"
- />
- <Tooltip
- overlay="bar"
- >
- <label
- htmlFor="sample__two"
- >
- second
- </label>
- </Tooltip>
- </li>
-</ul>
-`;
-
-exports[`renders 1`] = `
-<ul
- className="radio-toggle"
->
- <li
- key="one"
- >
- <input
- checked={false}
- id="sample__one"
- name="sample"
- onChange={[Function]}
- type="radio"
- />
- <Tooltip>
- <label
- htmlFor="sample__one"
- >
- first
- </label>
- </Tooltip>
- </li>
- <li
- key="two"
- >
- <input
- checked={false}
- id="sample__two"
- name="sample"
- onChange={[Function]}
- type="radio"
- />
- <Tooltip>
- <label
- htmlFor="sample__two"
- >
- second
- </label>
- </Tooltip>
- </li>
-</ul>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap
deleted file mode 100644
index 9510ca69cca..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ReloadButton-test.tsx.snap
+++ /dev/null
@@ -1,46 +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]}
- >
- <ContextConsumer>
- <Component />
- </ContextConsumer>
- </a>
-</Tooltip>
-`;
-
-exports[`should render properly 1`] = `
-<Tooltip
- overlay="reload"
->
- <a
- className="link-no-underline"
- href="#"
- onClick={[Function]}
- >
- <ContextConsumer>
- <Component />
- </ContextConsumer>
- </a>
-</Tooltip>
-`;
-
-exports[`should render properly 2`] = `
-<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="#777"
- />
-</svg>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap
deleted file mode 100644
index 4ed69eb6a29..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap
+++ /dev/null
@@ -1,37 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders 1`] = `
-<div
- className="search-box"
- title=""
->
- <input
- aria-label="search_verb"
- autoComplete="off"
- className="search-box-input"
- maxLength={150}
- onChange={[Function]}
- onKeyDown={[Function]}
- placeholder="placeholder"
- type="search"
- value="foo"
- />
- <DeferredSpinner
- loading={false}
- >
- <SearchIcon
- className="search-box-magnifier"
- />
- </DeferredSpinner>
- <ClearButton
- aria-label="clear"
- className="button-tiny search-box-clear"
- iconProps={
- Object {
- "size": 12,
- }
- }
- onClick={[Function]}
- />
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchSelect-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchSelect-test.tsx.snap
deleted file mode 100644
index 792343f1a73..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SearchSelect-test.tsx.snap
+++ /dev/null
@@ -1,17 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render Select 1`] = `
-<Select
- autoFocus={true}
- escapeClearsValue={false}
- filterOption={[Function]}
- isLoading={false}
- noResultsText="select2.tooShort.2"
- onBlurResetsInput={true}
- onChange={[Function]}
- onInputChange={[Function]}
- options={Array []}
- placeholder="search_verb"
- searchable={true}
-/>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectList-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectList-test.tsx.snap
deleted file mode 100644
index 14d46bbffc3..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectList-test.tsx.snap
+++ /dev/null
@@ -1,558 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should cancel filter selection when search is active 1`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="deselected"
- />
- <SearchBox
- autoFocus={true}
- loading={false}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="deselected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
-</div>
-`;
-
-exports[`should cancel filter selection when search is active 2`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": true,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": true,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": true,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="deselected"
- />
- <SearchBox
- autoFocus={true}
- loading={false}
- onChange={[Function]}
- placeholder="search_verb"
- value="test"
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="all"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
-</div>
-`;
-
-exports[`should cancel filter selection when search is active 3`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="deselected"
- />
- <SearchBox
- autoFocus={true}
- loading={false}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="deselected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
-</div>
-`;
-
-exports[`should display a loader when searching 1`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="selected"
- />
- <SearchBox
- autoFocus={true}
- loading={true}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="selected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
-</div>
-`;
-
-exports[`should display pagination element properly and call search method with correct parameters 1`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="selected"
- />
- <SearchBox
- autoFocus={true}
- loading={true}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="selected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
- <ListFooter
- count={3}
- loadMore={[Function]}
- reload={[Function]}
- total={100}
- />
-</div>
-`;
-
-exports[`should display pagination element properly and call search method with correct parameters 2`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="selected"
- />
- <SearchBox
- autoFocus={true}
- loading={true}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="selected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
- <ListFooter
- count={3}
- loadMore={[Function]}
- needReload={true}
- reload={[Function]}
- total={100}
- />
-</div>
-`;
-
-exports[`should display properly with advanced features 1`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="selected"
- />
- <SearchBox
- autoFocus={true}
- loading={false}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- allowBulkSelection={true}
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="selected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- readOnly={true}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
- <ListFooter
- count={3}
- loadMore={[Function]}
- reload={[Function]}
- total={125}
- />
-</div>
-`;
-
-exports[`should display properly with basics features 1`] = `
-<div
- className="select-list"
->
- <div
- className="display-flex-center"
- >
- <RadioToggle
- className="select-list-filter spacer-right"
- disabled={false}
- name="filter"
- onCheck={[Function]}
- options={
- Array [
- Object {
- "disabled": false,
- "label": "selected",
- "value": "selected",
- },
- Object {
- "disabled": false,
- "label": "unselected",
- "value": "deselected",
- },
- Object {
- "disabled": false,
- "label": "all",
- "value": "all",
- },
- ]
- }
- value="selected"
- />
- <SearchBox
- autoFocus={true}
- loading={false}
- onChange={[Function]}
- placeholder="search_verb"
- value=""
- />
- </div>
- <SelectListListContainer
- disabledElements={
- Array [
- "bar",
- ]
- }
- elements={
- Array [
- "foo",
- "bar",
- "baz",
- ]
- }
- filter="selected"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selectedElements={
- Array [
- "foo",
- ]
- }
- />
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListContainer-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListContainer-test.tsx.snap
deleted file mode 100644
index bf96116e95a..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListContainer-test.tsx.snap
+++ /dev/null
@@ -1,61 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- className="select-list-list-container spacer-top"
->
- <ul
- className="menu"
- >
- <li>
- <Checkbox
- checked={true}
- disabled={false}
- onCheck={[Function]}
- thirdState={true}
- >
- <span
- className="big-spacer-left"
- >
- bulk_change
- <DeferredSpinner
- className="spacer-left"
- loading={false}
- timeout={10}
- />
- </span>
- </Checkbox>
- </li>
- <li
- className="divider"
- />
- <SelectListListElement
- disabled={false}
- element="foo"
- key="foo"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selected={true}
- />
- <SelectListListElement
- disabled={false}
- element="bar"
- key="bar"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selected={false}
- />
- <SelectListListElement
- disabled={false}
- element="baz"
- key="baz"
- onSelect={[MockFunction]}
- onUnselect={[MockFunction]}
- renderElement={[Function]}
- selected={false}
- />
- </ul>
-</div>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListElement-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListElement-test.tsx.snap
deleted file mode 100644
index e5d4ba3601f..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SelectListListElement-test.tsx.snap
+++ /dev/null
@@ -1,41 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should display a loader when checking 1`] = `
-<li
- className=""
->
- <Checkbox
- checked={false}
- className="select-list-list-checkbox"
- loading={false}
- onCheck={[Function]}
- thirdState={false}
- >
- <span
- className="little-spacer-left"
- >
- foo
- </span>
- </Checkbox>
-</li>
-`;
-
-exports[`should display a loader when checking 2`] = `
-<li
- className=""
->
- <Checkbox
- checked={false}
- className="select-list-list-checkbox"
- loading={true}
- onCheck={[Function]}
- thirdState={false}
- >
- <span
- className="little-spacer-left"
- >
- foo
- </span>
- </Checkbox>
-</li>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/SimpleModal-test.tsx.snap
deleted file mode 100644
index 49b14a9e20f..00000000000
--- a/server/sonar-ui-common/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-ui-common/components/controls/__tests__/__snapshots__/Tabs-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tabs-test.tsx.snap
deleted file mode 100644
index 2db4cec05a8..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tabs-test.tsx.snap
+++ /dev/null
@@ -1,52 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should disable single tab 1`] = `
-<li>
- <a
- className="js-foo disabled selected"
- href="#"
- onClick={[Function]}
- >
- <span>
- Foo
- </span>
- </a>
-</li>
-`;
-
-exports[`should render correctly 1`] = `
-<ul
- className="flex-tabs"
->
- <Tab
- key="foo"
- name="foo"
- onSelect={[MockFunction]}
- selected={false}
- >
- Foo
- </Tab>
- <Tab
- key="bar"
- name="bar"
- onSelect={[MockFunction]}
- selected={true}
- >
- Bar
- </Tab>
-</ul>
-`;
-
-exports[`should render single tab correctly 1`] = `
-<li>
- <a
- className="js-foo selected"
- href="#"
- onClick={[Function]}
- >
- <span>
- Foo
- </span>
- </a>
-</li>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap
deleted file mode 100644
index 8862993eb41..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggle-test.tsx.snap
+++ /dev/null
@@ -1,55 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly: disabled 1`] = `
-<Button
- className="boolean-toggle boolean-toggle-on"
- disabled={true}
- name="toggle-name"
- onClick={[Function]}
->
- <div
- aria-label="on"
- className="boolean-toggle-handle"
- >
- <CheckIcon
- size={12}
- />
- </div>
-</Button>
-`;
-
-exports[`should render correctly: off 1`] = `
-<Button
- className="boolean-toggle"
- disabled={true}
- name="toggle-name"
- onClick={[Function]}
->
- <div
- aria-label="off"
- className="boolean-toggle-handle"
- >
- <CheckIcon
- size={12}
- />
- </div>
-</Button>
-`;
-
-exports[`should render correctly: on 1`] = `
-<Button
- className="boolean-toggle boolean-toggle-on"
- disabled={true}
- name="toggle-name"
- onClick={[Function]}
->
- <div
- aria-label="on"
- className="boolean-toggle-handle"
- >
- <CheckIcon
- size={12}
- />
- </div>
-</Button>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggler-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggler-test.tsx.snap
deleted file mode 100644
index dfe5d96a394..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Toggler-test.tsx.snap
+++ /dev/null
@@ -1,58 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should not render click wrappers 1`] = `
-<Fragment>
- <div
- id="toggle"
- />
- <div
- id="overlay"
- />
-</Fragment>
-`;
-
-exports[`should render children and overlay 1`] = `
-<Fragment>
- <div
- id="toggle"
- />
- <OutsideClickHandler
- onClickOutside={[MockFunction]}
- >
- <EscKeydownHandler
- onKeydown={[MockFunction]}
- >
- <div
- id="overlay"
- />
- </EscKeydownHandler>
- </OutsideClickHandler>
-</Fragment>
-`;
-
-exports[`should render only children 1`] = `
-<Fragment>
- <div
- id="toggle"
- />
-</Fragment>
-`;
-
-exports[`should render when closeOnClick=true 1`] = `
-<Fragment>
- <div
- id="toggle"
- />
- <DocumentClickHandler
- onClick={[MockFunction]}
- >
- <EscKeydownHandler
- onKeydown={[MockFunction]}
- >
- <div
- id="overlay"
- />
- </EscKeydownHandler>
- </DocumentClickHandler>
-</Fragment>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap
deleted file mode 100644
index 786b1bfe0ad..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap
+++ /dev/null
@@ -1,40 +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
- id="tooltip"
- onMouseEnter={[Function]}
- onMouseLeave={[Function]}
- />
-</Fragment>
-`;
-
-exports[`should render 2`] = `
-<Fragment>
- <div
- id="tooltip"
- onMouseEnter={[Function]}
- onMouseLeave={[Function]}
- />
- <TooltipPortal>
- <WithTheme(ScreenPositionFixer)
- ready={false}
- >
- <Component />
- </WithTheme(ScreenPositionFixer)>
- </TooltipPortal>
-</Fragment>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap
deleted file mode 100644
index e00f009ef2f..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationForm-test.tsx.snap
+++ /dev/null
@@ -1,19 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render and submit 1`] = `
-<Formik
- enableReinitialize={false}
- initialValues={
- Object {
- "foo": "bar",
- }
- }
- isInitialValid={false}
- onSubmit={[Function]}
- validate={[MockFunction]}
- validateOnBlur={true}
- validateOnChange={true}
->
- <Component />
-</Formik>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap
deleted file mode 100644
index c2d68a1d2bf..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap
+++ /dev/null
@@ -1,98 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render 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>
-`;
-
-exports[`should render when valid 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"
- />
- </div>
- <div
- className="note abs-width-400"
- >
- My description
- </div>
-</div>
-`;
-
-exports[`should render 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>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap
deleted file mode 100644
index 67db9979a9e..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/ValidationModal-test.tsx.snap
+++ /dev/null
@@ -1,110 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<Modal
- contentLabel="title"
- onRequestClose={[MockFunction]}
->
- <ValidationForm
- initialValues={
- Object {
- "field": "foo",
- }
- }
- isInitialValid={true}
- onSubmit={[Function]}
- validate={[MockFunction]}
- >
- <Component />
- </ValidationForm>
-</Modal>
-`;
-
-exports[`should render correctly 2`] = `
-<ContextProvider
- value={
- Object {
- "dirty": false,
- "errors": Object {},
- "handleBlur": [Function],
- "handleChange": [Function],
- "handleReset": [Function],
- "handleSubmit": [Function],
- "initialValues": Object {
- "field": "foo",
- },
- "isSubmitting": false,
- "isValid": true,
- "isValidating": false,
- "registerField": [Function],
- "resetForm": [Function],
- "setError": [Function],
- "setErrors": [Function],
- "setFieldError": [Function],
- "setFieldTouched": [Function],
- "setFieldValue": [Function],
- "setFormikState": [Function],
- "setStatus": [Function],
- "setSubmitting": [Function],
- "setTouched": [Function],
- "setValues": [Function],
- "submitCount": 0,
- "submitForm": [Function],
- "touched": Object {},
- "unregisterField": [Function],
- "validate": [MockFunction],
- "validateField": [Function],
- "validateForm": [Function],
- "validateOnBlur": true,
- "validateOnChange": true,
- "validationSchema": undefined,
- "values": Object {
- "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"
- >
- <DeferredSpinner
- 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-ui-common/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/buttons-test.tsx.snap
deleted file mode 100644
index 8d915b89387..00000000000
--- a/server/sonar-ui-common/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={
- Object {
- "color": "#236a97",
- }
- }
- >
- <i />
- </Button>
-</Tooltip>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/clipboard-test.tsx.snap b/server/sonar-ui-common/components/controls/__tests__/__snapshots__/clipboard-test.tsx.snap
deleted file mode 100644
index de2081cb464..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/__snapshots__/clipboard-test.tsx.snap
+++ /dev/null
@@ -1,52 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`ClipboardBase should display correctly 1`] = `
-<Button>
- copy
-</Button>
-`;
-
-exports[`ClipboardButton should display correctly 1`] = `
-<Tooltip
- overlay="copied_action"
- visible={false}
->
- <Button
- className="no-select"
- data-clipboard-text="foo"
- innerRef={[Function]}
- >
- <CopyIcon
- className="little-spacer-right"
- />
- copy
- </Button>
-</Tooltip>
-`;
-
-exports[`ClipboardButton should render a custom label if provided 1`] = `
-<Tooltip
- overlay="copied_action"
- visible={false}
->
- <Button
- className="no-select"
- data-clipboard-text="foo"
- innerRef={[Function]}
- >
- Foo Bar
- </Button>
-</Tooltip>
-`;
-
-exports[`ClipboardIconButton should display correctly 1`] = `
-<ButtonIcon
- aria-label="copy_to_clipboard"
- className="no-select"
- data-clipboard-text="foo"
- innerRef={[Function]}
- tooltip="copy_to_clipboard"
->
- <CopyIcon />
-</ButtonIcon>
-`;
diff --git a/server/sonar-ui-common/components/controls/__tests__/buttons-test.tsx b/server/sonar-ui-common/components/controls/__tests__/buttons-test.tsx
deleted file mode 100644
index c199c5778cc..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/buttons-test.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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).toBeCalled();
- expect(preventDefault).toBeCalled();
- expect(stopPropagation).not.toBeCalled();
- });
-
- 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.toBeCalled();
- expect(stopPropagation).toBeCalled();
- });
-
- 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).toBeUndefined();
- expect(button.props().className).toContain('disabled');
- expect(button.props()['aria-disabled']).toBe(true);
- click(button, mockEvent({ preventDefault }));
- expect(onClick).not.toBeCalled();
- expect(preventDefault).toBeCalled();
- });
-
- 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>
- ).dive();
- }
-});
diff --git a/server/sonar-ui-common/components/controls/__tests__/clipboard-test.tsx b/server/sonar-ui-common/components/controls/__tests__/clipboard-test.tsx
deleted file mode 100644
index 36b2d6f02db..00000000000
--- a/server/sonar-ui-common/components/controls/__tests__/clipboard-test.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 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 { Button } from '../buttons';
-import { ClipboardBase, ClipboardButton, ClipboardIconButton } from '../clipboard';
-
-const constructor = jest.fn();
-const destroy = jest.fn();
-const on = jest.fn();
-
-jest.mock(
- 'clipboard',
- () =>
- function (...args: any) {
- constructor(...args);
- return {
- destroy,
- on,
- };
- }
-);
-
-jest.useFakeTimers();
-
-describe('ClipboardBase', () => {
- it('should display correctly', () => {
- const children = jest.fn().mockReturnValue(<Button>copy</Button>);
- const wrapper = shallowRender(children);
- const instance = wrapper.instance();
- expect(wrapper).toMatchSnapshot();
- instance.handleSuccessCopy();
- expect(children).toBeCalledWith({ copySuccess: true, setCopyButton: instance.setCopyButton });
- jest.runAllTimers();
- expect(children).toBeCalledWith({ copySuccess: false, setCopyButton: instance.setCopyButton });
- });
-
- it('should allow its content to be copied', () => {
- const wrapper = mountRender(({ setCopyButton }) => (
- <Button innerRef={setCopyButton}>click</Button>
- ));
- const button = wrapper.find('button').getDOMNode();
- const instance = wrapper.instance();
-
- expect(constructor).toBeCalledWith(button);
- expect(on).toBeCalledWith('success', instance.handleSuccessCopy);
-
- jest.clearAllMocks();
-
- wrapper.unmount();
- expect(destroy).toBeCalled();
- });
-
- function shallowRender(children?: ClipboardBase['props']['children']) {
- return shallow<ClipboardBase>(<ClipboardBase>{children || (() => null)}</ClipboardBase>);
- }
-
- function mountRender(children?: ClipboardBase['props']['children']) {
- return mount<ClipboardBase>(<ClipboardBase>{children || (() => null)}</ClipboardBase>);
- }
-});
-
-describe('ClipboardButton', () => {
- it('should display correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- });
-
- it('should render a custom label if provided', () => {
- expect(shallowRender('Foo Bar')).toMatchSnapshot();
- });
-
- function shallowRender(children?: React.ReactNode) {
- return shallow(<ClipboardButton copyValue="foo">{children}</ClipboardButton>).dive();
- }
-});
-
-describe('ClipboardIconButton', () => {
- it('should display correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- });
-
- function shallowRender() {
- return shallow(<ClipboardIconButton copyValue="foo" />).dive();
- }
-});