Remove success notification after file rename (#19149)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import type { UmbRenameServerFileDataSource, UmbRenameServerFileDataSourceConstructor } from './types.js';
|
||||
import type { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
|
||||
import type { UmbDetailStore } from '@umbraco-cms/backoffice/store';
|
||||
import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository';
|
||||
import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';
|
||||
@@ -43,11 +42,6 @@ export abstract class UmbRenameServerFileRepositoryBase<
|
||||
We need to remove the old item and append the new item */
|
||||
detailStore.removeItem(unique);
|
||||
detailStore.append(data);
|
||||
|
||||
const notificationContext = await this.getContext(UMB_NOTIFICATION_CONTEXT);
|
||||
if (!notificationContext) throw new Error('Notification context is missing');
|
||||
const notification = { data: { message: `Renamed` } };
|
||||
notificationContext.peek('positive', notification);
|
||||
}
|
||||
|
||||
return { data, error };
|
||||
|
||||
@@ -82,7 +82,7 @@ test('can rename a partial view', {tag: '@smoke'}, async ({umbracoApi, umbracoUi
|
||||
await umbracoUi.partialView.rename(partialViewName);
|
||||
|
||||
// Assert
|
||||
await umbracoUi.partialView.doesSuccessNotificationHaveText(NotificationConstantHelper.success.renamed);
|
||||
await umbracoUi.partialView.isErrorNotificationVisible(false);
|
||||
expect(await umbracoApi.partialView.doesNameExist(partialViewFileName)).toBeTruthy();
|
||||
expect(await umbracoApi.partialView.doesNameExist(wrongPartialViewFileName)).toBeFalsy();
|
||||
// Verify the old partial view is NOT displayed under the Partial Views section
|
||||
|
||||
@@ -100,7 +100,7 @@ test('can rename a script', async ({umbracoApi, umbracoUi}) => {
|
||||
await umbracoUi.script.rename(scriptName);
|
||||
|
||||
// Assert
|
||||
await umbracoUi.script.doesSuccessNotificationHaveText(NotificationConstantHelper.success.renamed);
|
||||
await umbracoUi.script.isErrorNotificationVisible(false);
|
||||
expect(await umbracoApi.script.doesNameExist(scriptName)).toBeTruthy();
|
||||
expect(await umbracoApi.script.doesNameExist(wrongScriptName)).toBeFalsy();
|
||||
});
|
||||
|
||||
@@ -103,7 +103,7 @@ test('can rename a stylesheet', {tag: '@smoke'}, async ({umbracoApi, umbracoUi})
|
||||
await umbracoUi.stylesheet.rename(stylesheetName);
|
||||
|
||||
// Assert
|
||||
await umbracoUi.stylesheet.doesSuccessNotificationHaveText(NotificationConstantHelper.success.renamed);
|
||||
await umbracoUi.stylesheet.isErrorNotificationVisible(false);
|
||||
expect(await umbracoApi.stylesheet.doesNameExist(stylesheetName)).toBeTruthy();
|
||||
expect(await umbracoApi.stylesheet.doesNameExist(wrongStylesheetName)).toBeFalsy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user