mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
fix: always show workspace list modal when no workspaces (#1321)
This commit is contained in:
@@ -67,6 +67,7 @@ export const WorkspaceDeleteModal = ({
|
|||||||
<StyledInputContent>
|
<StyledInputContent>
|
||||||
<Input
|
<Input
|
||||||
onChange={setDeleteStr}
|
onChange={setDeleteStr}
|
||||||
|
data-testid="delete-workspace-input"
|
||||||
placeholder={t('Delete Workspace placeholder')}
|
placeholder={t('Delete Workspace placeholder')}
|
||||||
value={deleteStr}
|
value={deleteStr}
|
||||||
width={284}
|
width={284}
|
||||||
@@ -78,6 +79,7 @@ export const WorkspaceDeleteModal = ({
|
|||||||
{t('Cancel')}
|
{t('Cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
data-testid="delete-workspace-confirm-button"
|
||||||
disabled={!allowDelete}
|
disabled={!allowDelete}
|
||||||
onClick={handleDelete}
|
onClick={handleDelete}
|
||||||
type="danger"
|
type="danger"
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ export const GeneralPanel: React.FC<PanelProps> = ({
|
|||||||
type="danger"
|
type="danger"
|
||||||
shape="circle"
|
shape="circle"
|
||||||
style={{ borderRadius: '40px' }}
|
style={{ borderRadius: '40px' }}
|
||||||
|
data-testid="delete-workspace-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDelete(true);
|
setShowDelete(true);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export function Modals() {
|
|||||||
user={user}
|
user={user}
|
||||||
workspaces={workspaces}
|
workspaces={workspaces}
|
||||||
currentWorkspaceId={currentWorkspaceId}
|
currentWorkspaceId={currentWorkspaceId}
|
||||||
open={openWorkspacesModal}
|
open={openWorkspacesModal || workspaces.length === 0}
|
||||||
onClose={useCallback(() => {
|
onClose={useCallback(() => {
|
||||||
setOpenWorkspacesModal(false);
|
setOpenWorkspacesModal(false);
|
||||||
}, [setOpenWorkspacesModal])}
|
}, [setOpenWorkspacesModal])}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { Page } from '@playwright/test';
|
||||||
|
|
||||||
|
export async function clickSideBarSettingButton(page: Page) {
|
||||||
|
await page.getByTestId('slider-bar-workspace-setting-button').click();
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
|
import { loadPage } from './libs/load-page';
|
||||||
|
import { test } from './libs/playwright';
|
||||||
|
import { clickSideBarSettingButton } from './libs/sidebar';
|
||||||
|
|
||||||
|
loadPage();
|
||||||
|
|
||||||
|
test.describe('Local first delete workspace', () => {
|
||||||
|
test('New a workspace , then delete it in all workspaces, permanently delete it', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await clickSideBarSettingButton(page);
|
||||||
|
await page.getByTestId('delete-workspace-button').click();
|
||||||
|
await page.getByTestId('delete-workspace-input').type('delete');
|
||||||
|
await page.getByTestId('delete-workspace-confirm-button').click();
|
||||||
|
expect(await page.getByTestId('workspace-card').count()).toBe(0);
|
||||||
|
await page.mouse.click(1, 1);
|
||||||
|
expect(await page.getByTestId('workspace-card').count()).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user