fix: trash restore (#1446)
Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com> Co-authored-by: Himself65 <himself65@outlook.com>
This commit is contained in:
@@ -118,7 +118,6 @@ export const TrashOperationCell: React.FC<TrashOperationCellProps> = ({
|
|||||||
pageMeta,
|
pageMeta,
|
||||||
onPermanentlyDeletePage,
|
onPermanentlyDeletePage,
|
||||||
onRestorePage,
|
onRestorePage,
|
||||||
onOpenPage,
|
|
||||||
}) => {
|
}) => {
|
||||||
const { id, title } = pageMeta;
|
const { id, title } = pageMeta;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -132,7 +131,6 @@ export const TrashOperationCell: React.FC<TrashOperationCellProps> = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
onRestorePage(id);
|
onRestorePage(id);
|
||||||
toast(t('restored', { title: title || 'Untitled' }));
|
toast(t('restored', { title: title || 'Untitled' }));
|
||||||
onOpenPage(id);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ResetIcon />
|
<ResetIcon />
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ test.describe('Local first delete page', () => {
|
|||||||
await newPage(page);
|
await newPage(page);
|
||||||
await getBlockSuiteEditorTitle(page).click();
|
await getBlockSuiteEditorTitle(page).click();
|
||||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
||||||
const originPageUrl = page.url();
|
|
||||||
const newPageId = page.url().split('/').reverse()[0];
|
const newPageId = page.url().split('/').reverse()[0];
|
||||||
await page.getByRole('link', { name: 'All pages' }).click();
|
await page.getByRole('link', { name: 'All pages' }).click();
|
||||||
const cell = page.getByRole('cell', {
|
const cell = page.getByRole('cell', {
|
||||||
@@ -33,6 +32,7 @@ test.describe('Local first delete page', () => {
|
|||||||
await page.getByRole('button', { name: 'Delete' }).click();
|
await page.getByRole('button', { name: 'Delete' }).click();
|
||||||
|
|
||||||
await page.getByRole('link', { name: 'Trash' }).click();
|
await page.getByRole('link', { name: 'Trash' }).click();
|
||||||
|
const trashPage = await page.url();
|
||||||
// restore it
|
// restore it
|
||||||
await page
|
await page
|
||||||
.getByTestId('more-actions-' + newPageId)
|
.getByTestId('more-actions-' + newPageId)
|
||||||
@@ -40,9 +40,8 @@ test.describe('Local first delete page', () => {
|
|||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
// go to page detail
|
// stay in trash page
|
||||||
expect(page.url()).toBe(originPageUrl);
|
expect(page.url()).toBe(trashPage);
|
||||||
|
|
||||||
await page.getByRole('link', { name: 'All pages' }).click();
|
await page.getByRole('link', { name: 'All pages' }).click();
|
||||||
const restoreCell = page.getByRole('cell', {
|
const restoreCell = page.getByRole('cell', {
|
||||||
name: 'this is a new page to restore',
|
name: 'this is a new page to restore',
|
||||||
|
|||||||
Reference in New Issue
Block a user