mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-26 14:38:06 +03:00
fix: use data-testid
(#2487)
This commit is contained in:
parent
f01997f8ee
commit
ef0a20b358
@ -109,7 +109,7 @@ const PageMenu = () => {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Export />
|
<Export />
|
||||||
<MoveToTrash
|
<MoveToTrash
|
||||||
testId="editor-option-menu-delete"
|
data-testid="editor-option-menu-delete"
|
||||||
onItemClick={() => {
|
onItemClick={() => {
|
||||||
setOpenConfirm(true);
|
setOpenConfirm(true);
|
||||||
}}
|
}}
|
||||||
|
@ -47,7 +47,7 @@ export const OperationCell: React.FC<OperationCellProps> = ({
|
|||||||
<>
|
<>
|
||||||
{isPublic && (
|
{isPublic && (
|
||||||
<DisablePublicSharing
|
<DisablePublicSharing
|
||||||
testId="disable-public-sharing"
|
data-testid="disable-public-sharing"
|
||||||
onItemClick={() => {
|
onItemClick={() => {
|
||||||
setOpenDisableShared(true);
|
setOpenDisableShared(true);
|
||||||
}}
|
}}
|
||||||
@ -71,7 +71,7 @@ export const OperationCell: React.FC<OperationCellProps> = ({
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
<MoveToTrash
|
<MoveToTrash
|
||||||
testId="move-to-trash"
|
data-testid="move-to-trash"
|
||||||
onItemClick={() => {
|
onItemClick={() => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
}}
|
}}
|
||||||
|
@ -26,13 +26,13 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => {
|
|||||||
export const DisablePublicSharing = ({
|
export const DisablePublicSharing = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
onItemClick,
|
onItemClick,
|
||||||
testId,
|
...props
|
||||||
}: CommonMenuItemProps) => {
|
}: CommonMenuItemProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StyledMenuItem
|
<StyledMenuItem
|
||||||
data-testid={testId}
|
{...props}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onItemClick?.();
|
onItemClick?.();
|
||||||
onSelect?.();
|
onSelect?.();
|
||||||
|
@ -8,14 +8,14 @@ import type { CommonMenuItemProps } from './types';
|
|||||||
export const MoveToTrash = ({
|
export const MoveToTrash = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
onItemClick,
|
onItemClick,
|
||||||
testId,
|
...props
|
||||||
}: CommonMenuItemProps) => {
|
}: CommonMenuItemProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
data-testid={testId}
|
{...props}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onItemClick?.();
|
onItemClick?.();
|
||||||
onSelect?.();
|
onSelect?.();
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import type { HTMLAttributes } from 'react';
|
||||||
|
|
||||||
export type CommonMenuItemProps<SelectParams = undefined> = {
|
export type CommonMenuItemProps<SelectParams = undefined> = {
|
||||||
// onItemClick is triggered when the item is clicked, sometimes after item click, it still has some internal logic to run(like popover a new menu), so we need to have a separate callback for that
|
// onItemClick is triggered when the item is clicked, sometimes after item click, it still has some internal logic to run(like popover a new menu), so we need to have a separate callback for that
|
||||||
onItemClick?: () => void;
|
onItemClick?: () => void;
|
||||||
// onSelect is triggered when the item is selected, it's the final callback for the item click
|
// onSelect is triggered when the item is selected, it's the final callback for the item click
|
||||||
onSelect?: (params?: SelectParams) => void;
|
onSelect?: (params?: SelectParams) => void;
|
||||||
testId?: string;
|
} & HTMLAttributes<HTMLButtonElement>;
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user