[MM-63046] Have the draft actions labelled by their tooltip (#31369)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5e3a89d70c
Коммит
c47a84da39
@@ -5,16 +5,17 @@ exports[`components/drafts/draft_actions/action should match snapshot 1`] = `
|
|||||||
className="DraftAction"
|
className="DraftAction"
|
||||||
>
|
>
|
||||||
<WithTooltip
|
<WithTooltip
|
||||||
title=""
|
id="draft_tooltip_some-id"
|
||||||
|
title="some-tooltip-text"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-label=""
|
aria-labelledby="draft_tooltip_some-id"
|
||||||
className="DraftAction__button"
|
className="DraftAction__button"
|
||||||
id="draft__"
|
id="draft_some-icon_some-id"
|
||||||
onClick={[MockFunction]}
|
onClick={[MockFunction]}
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
className="icon"
|
className="icon some-icon"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import Action from './action';
|
|||||||
|
|
||||||
describe('components/drafts/draft_actions/action', () => {
|
describe('components/drafts/draft_actions/action', () => {
|
||||||
const baseProps = {
|
const baseProps = {
|
||||||
icon: '',
|
icon: 'some-icon',
|
||||||
id: '',
|
id: 'some-id',
|
||||||
name: '',
|
name: 'some-name',
|
||||||
onClick: jest.fn(),
|
onClick: jest.fn(),
|
||||||
tooltipText: '',
|
tooltipText: 'some-tooltip-text',
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should match snapshot', () => {
|
it('should match snapshot', () => {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ function Action({
|
|||||||
<div className='DraftAction'>
|
<div className='DraftAction'>
|
||||||
<WithTooltip
|
<WithTooltip
|
||||||
title={tooltipText}
|
title={tooltipText}
|
||||||
|
id={`draft_tooltip_${id}`}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -35,7 +36,7 @@ function Action({
|
|||||||
)}
|
)}
|
||||||
id={`draft_${icon}_${id}`}
|
id={`draft_${icon}_${id}`}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
aria-label={name}
|
aria-labelledby={`draft_tooltip_${id}`}
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
className={classNames(
|
className={classNames(
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ interface Props {
|
|||||||
isEmojiLarge?: boolean;
|
isEmojiLarge?: boolean;
|
||||||
hint?: string | ReactNode | MessageDescriptor;
|
hint?: string | ReactNode | MessageDescriptor;
|
||||||
shortcut?: ShortcutDefinition;
|
shortcut?: ShortcutDefinition;
|
||||||
|
id?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the tooltip should be vertical or horizontal, by default it is vertical
|
* Whether the tooltip should be vertical or horizontal, by default it is vertical
|
||||||
@@ -100,6 +101,7 @@ export default function WithTooltip({
|
|||||||
onOpen,
|
onOpen,
|
||||||
disabled,
|
disabled,
|
||||||
forcedPlacement,
|
forcedPlacement,
|
||||||
|
id,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
@@ -188,6 +190,7 @@ export default function WithTooltip({
|
|||||||
className={classNames('tooltipContainer', className)}
|
className={classNames('tooltipContainer', className)}
|
||||||
style={{...floatingStyles, ...transitionStyles}}
|
style={{...floatingStyles, ...transitionStyles}}
|
||||||
{...getFloatingProps()}
|
{...getFloatingProps()}
|
||||||
|
id={id}
|
||||||
>
|
>
|
||||||
<TooltipContent
|
<TooltipContent
|
||||||
title={title}
|
title={title}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user