mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
test: cover share page e2e (#4126)
This commit is contained in:
@@ -9,6 +9,7 @@ import type { Page } from '@blocksuite/store';
|
||||
import { Button } from '@toeverything/components/button';
|
||||
import { Divider } from '@toeverything/components/divider';
|
||||
import { useAtom } from 'jotai';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { Menu } from '../../ui/menu/menu';
|
||||
import * as styles from './index.css';
|
||||
@@ -62,15 +63,15 @@ export const ShareMenu = (props: ShareMenuProps) => {
|
||||
trigger={['click']}
|
||||
width={410}
|
||||
disablePortal={true}
|
||||
onClickAway={() => {
|
||||
onClickAway={useCallback(() => {
|
||||
setOpen(false);
|
||||
}}
|
||||
}, [setOpen])}
|
||||
>
|
||||
<Button
|
||||
data-testid="share-menu-button"
|
||||
onClick={() => {
|
||||
setOpen(!open);
|
||||
}}
|
||||
onClick={useCallback(() => {
|
||||
setOpen(value => !value);
|
||||
}, [setOpen])}
|
||||
type={'plain'}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -132,13 +132,18 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
||||
readOnly
|
||||
/>
|
||||
{isPublic ? (
|
||||
<Button onClick={onClickCopyLink} style={{ padding: '4px 12px' }}>
|
||||
<Button
|
||||
onClick={onClickCopyLink}
|
||||
data-testid="share-menu-copy-link-button"
|
||||
style={{ padding: '4px 12px' }}
|
||||
>
|
||||
{t.Copy()}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
onClick={onClickCreateLink}
|
||||
type="primary"
|
||||
data-testid="share-menu-create-link-button"
|
||||
style={{ padding: '4px 12px' }}
|
||||
>
|
||||
{t.Create()}
|
||||
|
||||
Reference in New Issue
Block a user