[MM-59889] Remove SimpleTooltip of "components/widgets/simple_tooltip" (#28036)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e64cdfb34b
Коммит
626ccdea4b
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -1,12 +1,9 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import {shallow} from 'enzyme';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import * as reactRedux from 'react-redux';
|
|
||||||
|
|
||||||
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
|
import {renderWithContext} from 'tests/react_testing_utils';
|
||||||
import mockStore from 'tests/test_store';
|
|
||||||
import {CloudProducts} from 'utils/constants';
|
import {CloudProducts} from 'utils/constants';
|
||||||
import {FileSizes} from 'utils/file_utils';
|
import {FileSizes} from 'utils/file_utils';
|
||||||
import {TestHelper} from 'utils/test_helper';
|
import {TestHelper} from 'utils/test_helper';
|
||||||
@@ -19,6 +16,7 @@ describe('admin_console/team_channel_settings/team/TeamProfile__Cloud', () => {
|
|||||||
onToggleArchive: jest.fn(),
|
onToggleArchive: jest.fn(),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
views: {
|
views: {
|
||||||
announcementBar: {
|
announcementBar: {
|
||||||
@@ -102,14 +100,8 @@ describe('admin_console/team_channel_settings/team/TeamProfile__Cloud', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test('should match snapshot - archived, at teams limit', () => {
|
test('should match snapshot - archived, at teams limit', () => {
|
||||||
const store = mockStore(initialState);
|
const {container} = renderWithContext(<TeamProfile {...baseProps}/>, initialState);
|
||||||
const wrapper = mountWithIntl(
|
expect(container).toMatchSnapshot();
|
||||||
<reactRedux.Provider store={store}>
|
|
||||||
<TeamProfile {...baseProps}/>
|
|
||||||
</reactRedux.Provider>,
|
|
||||||
);
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
|
||||||
expect(wrapper.find('OverlayTrigger').exists()).toEqual(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should match snapshot - not archived, at teams limit', () => {
|
test('should match snapshot - not archived, at teams limit', () => {
|
||||||
@@ -117,16 +109,9 @@ describe('admin_console/team_channel_settings/team/TeamProfile__Cloud', () => {
|
|||||||
...baseProps,
|
...baseProps,
|
||||||
isArchived: false,
|
isArchived: false,
|
||||||
};
|
};
|
||||||
const store = mockStore(initialState);
|
|
||||||
const wrapper = mountWithIntl(
|
|
||||||
<reactRedux.Provider store={store}>
|
|
||||||
<TeamProfile {...props}/>
|
|
||||||
</reactRedux.Provider>,
|
|
||||||
);
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
|
||||||
|
|
||||||
// Unarchived will always be archiveable
|
const {container} = renderWithContext(<TeamProfile {...props}/>, initialState);
|
||||||
expect(wrapper.find('OverlayTrigger').exists()).toEqual(false);
|
expect(container).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('restore should not be disabled when below teams limit', () => {
|
test('restore should not be disabled when below teams limit', () => {
|
||||||
@@ -175,16 +160,9 @@ describe('admin_console/team_channel_settings/team/TeamProfile__Cloud', () => {
|
|||||||
cardsLoaded: true,
|
cardsLoaded: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const store = mockStore(state);
|
|
||||||
const wrapper = mountWithIntl(
|
|
||||||
<reactRedux.Provider store={store}>
|
|
||||||
<TeamProfile {...baseProps}/>
|
|
||||||
</reactRedux.Provider>,
|
|
||||||
);
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
|
||||||
|
|
||||||
// Unarchived will always be archiveable
|
const {container} = renderWithContext(<TeamProfile {...baseProps}/>, state);
|
||||||
expect(wrapper.find('OverlayTrigger').exists()).toEqual(false);
|
expect(container).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -194,6 +172,7 @@ describe('admin_console/team_channel_settings/team/TeamProfile', () => {
|
|||||||
onToggleArchive: jest.fn(),
|
onToggleArchive: jest.fn(),
|
||||||
isArchived: false,
|
isArchived: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
views: {
|
views: {
|
||||||
announcementBar: {
|
announcementBar: {
|
||||||
@@ -274,16 +253,10 @@ describe('admin_console/team_channel_settings/team/TeamProfile', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const state = JSON.parse(JSON.stringify(initialState));
|
|
||||||
const store = mockStore(state);
|
|
||||||
test('should match snapshot (not cloud, freemium disabled', () => {
|
test('should match snapshot (not cloud, freemium disabled', () => {
|
||||||
const wrapper = shallow(
|
const {container} = renderWithContext(<TeamProfile {...baseProps}/>, initialState);
|
||||||
<reactRedux.Provider store={store}>
|
expect(container).toMatchSnapshot();
|
||||||
<TeamProfile {...baseProps}/>
|
|
||||||
</reactRedux.Provider>,
|
|
||||||
);
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
|
||||||
expect(wrapper.find('OverlayTrigger').exists()).toEqual(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should match snapshot with isArchived true', () => {
|
test('should match snapshot with isArchived true', () => {
|
||||||
@@ -291,12 +264,8 @@ describe('admin_console/team_channel_settings/team/TeamProfile', () => {
|
|||||||
...baseProps,
|
...baseProps,
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
};
|
};
|
||||||
const wrapper = shallow(
|
|
||||||
<reactRedux.Provider store={store}>
|
const {container} = renderWithContext(<TeamProfile {...props}/>, initialState);
|
||||||
<TeamProfile {...props}/>
|
expect(container).toMatchSnapshot();
|
||||||
</reactRedux.Provider>,
|
|
||||||
);
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
|
||||||
expect(wrapper.find('OverlayTrigger').exists()).toEqual(false);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
||||||
// See LICENSE.txt for license information.
|
|
||||||
|
|
||||||
export {
|
|
||||||
default,
|
|
||||||
} from './simple_tooltip';
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
||||||
// See LICENSE.txt for license information.
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import type {ReactNode, ComponentProps, CSSProperties} from 'react';
|
|
||||||
|
|
||||||
import OverlayTrigger from 'components/overlay_trigger';
|
|
||||||
import Tooltip from 'components/tooltip';
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
id?: string;
|
|
||||||
content: ReactNode;
|
|
||||||
children: ReactNode;
|
|
||||||
className?: string;
|
|
||||||
arrowOffsetTop?: number | string;
|
|
||||||
style?: CSSProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SimpleTooltip = ({
|
|
||||||
id,
|
|
||||||
content,
|
|
||||||
children,
|
|
||||||
placement = 'top',
|
|
||||||
className = 'hidden-xs',
|
|
||||||
delayShow = 100,
|
|
||||||
style,
|
|
||||||
...props
|
|
||||||
}: Props & Omit<ComponentProps<typeof OverlayTrigger>, 'overlay'>) => {
|
|
||||||
return (
|
|
||||||
<OverlayTrigger
|
|
||||||
{...props}
|
|
||||||
delayShow={delayShow}
|
|
||||||
placement={placement}
|
|
||||||
overlay={
|
|
||||||
<Tooltip
|
|
||||||
id={id}
|
|
||||||
style={style}
|
|
||||||
className={className}
|
|
||||||
placement={placement}
|
|
||||||
>
|
|
||||||
{content}
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</OverlayTrigger>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SimpleTooltip;
|
|
||||||
Ссылка в новой задаче
Block a user