[MM-59340] Migrate tooltips of "components/widgets/inputs/input/input.tsx" to WithTooltip (#27590)
Этот коммит содержится в:
@@ -1,10 +1,10 @@
|
|||||||
// 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 {mount, shallow} from 'enzyme';
|
import {shallow} from 'enzyme';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import OverlayTrigger from 'components/overlay_trigger';
|
import WithTooltip from 'components/with_tooltip';
|
||||||
|
|
||||||
import Input from './input';
|
import Input from './input';
|
||||||
|
|
||||||
@@ -35,11 +35,11 @@ describe('components/widgets/inputs/Input', () => {
|
|||||||
expect(clear.length).toEqual(1);
|
expect(clear.length).toEqual(1);
|
||||||
expect(wrapper.find('CloseCircleIcon').length).toEqual(1);
|
expect(wrapper.find('CloseCircleIcon').length).toEqual(1);
|
||||||
|
|
||||||
const tooltip = wrapper.find(OverlayTrigger);
|
const tooltip = wrapper.find(WithTooltip);
|
||||||
expect(tooltip.length).toEqual(1);
|
expect(tooltip.length).toEqual(1);
|
||||||
|
|
||||||
const overlay = mount(tooltip.prop('overlay'));
|
const titleProp = tooltip.prop('title');
|
||||||
expect(overlay.text()).toEqual(clearableTooltipText);
|
expect(titleProp).toEqual(clearableTooltipText);
|
||||||
|
|
||||||
clear.first().simulate('mousedown');
|
clear.first().simulate('mousedown');
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import {useIntl} from 'react-intl';
|
|||||||
|
|
||||||
import {CloseCircleIcon} from '@mattermost/compass-icons/components';
|
import {CloseCircleIcon} from '@mattermost/compass-icons/components';
|
||||||
|
|
||||||
import OverlayTrigger from 'components/overlay_trigger';
|
import WithTooltip from 'components/with_tooltip';
|
||||||
import Tooltip from 'components/tooltip';
|
|
||||||
|
|
||||||
import Constants, {ItemStatus} from 'utils/constants';
|
import {ItemStatus} from 'utils/constants';
|
||||||
|
|
||||||
import './input.scss';
|
import './input.scss';
|
||||||
|
|
||||||
@@ -143,17 +142,13 @@ const Input = React.forwardRef((
|
|||||||
onMouseDown={handleOnClear}
|
onMouseDown={handleOnClear}
|
||||||
onTouchEnd={handleOnClear}
|
onTouchEnd={handleOnClear}
|
||||||
>
|
>
|
||||||
<OverlayTrigger
|
<WithTooltip
|
||||||
delayShow={Constants.OVERLAY_TIME_DELAY}
|
id='inputClearTooltip'
|
||||||
|
title={clearableTooltipText || formatMessage({id: 'widget.input.clear', defaultMessage: 'Clear'})}
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
overlay={(
|
|
||||||
<Tooltip id={'InputClearTooltip'}>
|
|
||||||
{clearableTooltipText || formatMessage({id: 'widget.input.clear', defaultMessage: 'Clear'})}
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<CloseCircleIcon size={18}/>
|
<CloseCircleIcon size={18}/>
|
||||||
</OverlayTrigger>
|
</WithTooltip>
|
||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user