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