mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-10307] SR: Personal files: No confirmation announced when creating new folder or document (#5006)
This commit is contained in:
@@ -433,6 +433,10 @@
|
||||
"FAIL": "{{ failed }} couldn't be moved."
|
||||
}
|
||||
},
|
||||
"NODE_CREATE": {
|
||||
"FILE_FROM_TEMPLATE_SUCCESS": "File {{ name }} created from template",
|
||||
"FOLDER_FROM_TEMPLATE_SUCCESS": "Folder {{ name }} created from template"
|
||||
},
|
||||
"LIBRARY_DELETED": "Library deleted",
|
||||
"LEFT_LIBRARY": "You have left the library",
|
||||
"FAVORITE_NODE_ADDED": "Added {{ name }} to favorites",
|
||||
|
||||
@@ -46,6 +46,7 @@ describe('TemplateEffects', () => {
|
||||
let updateNodeSpy;
|
||||
let matDialog: MatDialog;
|
||||
let showErrorSpy;
|
||||
let showInfoSpy;
|
||||
|
||||
const node: Node = {
|
||||
name: 'node-name',
|
||||
@@ -98,6 +99,7 @@ describe('TemplateEffects', () => {
|
||||
|
||||
const notificationService = TestBed.inject(NotificationService);
|
||||
showErrorSpy = spyOn(notificationService, 'showError');
|
||||
showInfoSpy = spyOn(notificationService, 'showInfo');
|
||||
|
||||
spyOn(store, 'dispatch').and.callThrough();
|
||||
spyOn(documentListService, 'reload').and.stub();
|
||||
@@ -215,4 +217,32 @@ describe('TemplateEffects', () => {
|
||||
tick();
|
||||
expect(documentListService.reload).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should show success notification for file created from template', fakeAsync(() => {
|
||||
const fileNode: Node = {
|
||||
id: 'file-node-id',
|
||||
name: 'test-file.txt',
|
||||
isFolder: false,
|
||||
isFile: true
|
||||
} as Node;
|
||||
|
||||
store.dispatch(new CreateFromTemplateSuccess(fileNode));
|
||||
tick();
|
||||
|
||||
expect(showInfoSpy).toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_CREATE.FILE_FROM_TEMPLATE_SUCCESS', null, { name: 'test-file.txt' });
|
||||
}));
|
||||
|
||||
it('should show success notification for folder created from template', fakeAsync(() => {
|
||||
const folderNode: Node = {
|
||||
id: 'folder-node-id',
|
||||
name: 'test-folder',
|
||||
isFolder: true,
|
||||
isFile: false
|
||||
} as Node;
|
||||
|
||||
store.dispatch(new CreateFromTemplateSuccess(folderNode));
|
||||
tick();
|
||||
|
||||
expect(showInfoSpy).toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_CREATE.FOLDER_FROM_TEMPLATE_SUCCESS', null, { name: 'test-folder' });
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -112,7 +112,12 @@ export class TemplateEffects {
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType<CreateFromTemplateSuccess>(TemplateActionTypes.CreateFromTemplateSuccess),
|
||||
map(() => {
|
||||
map((action) => {
|
||||
const node = action.node;
|
||||
const messageKey = node.isFolder
|
||||
? 'APP.MESSAGES.INFO.NODE_CREATE.FOLDER_FROM_TEMPLATE_SUCCESS'
|
||||
: 'APP.MESSAGES.INFO.NODE_CREATE.FILE_FROM_TEMPLATE_SUCCESS';
|
||||
this.notificationService.showInfo(messageKey, null, { name: node.name });
|
||||
this.matDialog.closeAll();
|
||||
this.documentListService.reload();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user