mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[AAE-3410] NodeSelector - Use user alias (-my-) name as default for upload of type Alfresco Content only (#6160)
* Use as default folder root in case is only ACS * Fix and improve unit test * Use user alias -my- for Content Service only
This commit is contained in:
@@ -379,7 +379,29 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-root-', 'single', true);
|
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-root-', 'single', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to set default alias as rootNodeId if destinationFolderPath contains wrong alias', async () => {
|
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and single upload for Alfresco Content + Locale', async () => {
|
||||||
|
widget.field = new FormFieldModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.UPLOAD,
|
||||||
|
value: []
|
||||||
|
});
|
||||||
|
widget.field.id = 'attach-file-alfresco';
|
||||||
|
widget.field.params = <FormFieldMetadata> allSourceWithWrongAliasParams;
|
||||||
|
widget.field.params.multiple = false;
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
const attachButton: HTMLButtonElement = element.querySelector('#attach-file-alfresco');
|
||||||
|
|
||||||
|
expect(attachButton).not.toBeNull();
|
||||||
|
|
||||||
|
attachButton.click();
|
||||||
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(widget.rootNodeId).toEqual('-my-');
|
||||||
|
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and multiple upload for Alfresco Content + Locale', async () => {
|
||||||
widget.field = new FormFieldModel(new FormModel(), {
|
widget.field = new FormFieldModel(new FormModel(), {
|
||||||
type: FormFieldTypes.UPLOAD,
|
type: FormFieldTypes.UPLOAD,
|
||||||
value: []
|
value: []
|
||||||
@@ -401,7 +423,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'multiple', true);
|
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'multiple', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to set default alias as rootNodeId if destinationFolderPath does not have alias', async () => {
|
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath does not have alias for Alfresco Content + Locale', async () => {
|
||||||
widget.field = new FormFieldModel(new FormModel(), {
|
widget.field = new FormFieldModel(new FormModel(), {
|
||||||
type: FormFieldTypes.UPLOAD,
|
type: FormFieldTypes.UPLOAD,
|
||||||
value: []
|
value: []
|
||||||
@@ -439,8 +461,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('FilesSource', () => {
|
describe('FilesSource', () => {
|
||||||
|
it('Should set default user alias (-my-) as rootNodeId if fileSource set only to Alfresco Content', async () => {
|
||||||
it('should be able to set myFiles folderId as rootNodeId if fileSource set only to content', async () => {
|
|
||||||
widget.field = new FormFieldModel(new FormModel(), {
|
widget.field = new FormFieldModel(new FormModel(), {
|
||||||
type: FormFieldTypes.UPLOAD,
|
type: FormFieldTypes.UPLOAD,
|
||||||
value: []
|
value: []
|
||||||
@@ -461,28 +482,6 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', false);
|
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to set root folderId as rootNodeId if fileSource set to content and local', async () => {
|
|
||||||
widget.field = new FormFieldModel(new FormModel(), {
|
|
||||||
type: FormFieldTypes.UPLOAD,
|
|
||||||
value: []
|
|
||||||
});
|
|
||||||
widget.field.id = 'attach-file-alfresco';
|
|
||||||
widget.field.params = <FormFieldMetadata> allSourceWithWrongAliasParams;
|
|
||||||
widget.field.params.multiple = false;
|
|
||||||
fixture.detectChanges();
|
|
||||||
await fixture.whenStable();
|
|
||||||
const attachButton: HTMLButtonElement = element.querySelector('#attach-file-alfresco');
|
|
||||||
|
|
||||||
expect(attachButton).not.toBeNull();
|
|
||||||
|
|
||||||
attachButton.click();
|
|
||||||
await fixture.whenStable();
|
|
||||||
fixture.detectChanges();
|
|
||||||
|
|
||||||
expect(widget.rootNodeId).toEqual('-my-');
|
|
||||||
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display tooltip when tooltip is set', async(() => {
|
it('should display tooltip when tooltip is set', async(() => {
|
||||||
widget.field = new FormFieldModel(new FormModel(), {
|
widget.field = new FormFieldModel(new FormModel(), {
|
||||||
id: 'attach-file-attach',
|
id: 'attach-file-attach',
|
||||||
|
@@ -54,9 +54,13 @@ import { DestinationFolderPathModel } from '../../../models/form-cloud-represent
|
|||||||
})
|
})
|
||||||
export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent implements OnInit {
|
export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent implements OnInit {
|
||||||
|
|
||||||
|
static ALIAS_ROOT_FOLDER = '-root-';
|
||||||
static ALIAS_USER_FOLDER = '-my-';
|
static ALIAS_USER_FOLDER = '-my-';
|
||||||
static APP_NAME = '-appname-';
|
static APP_NAME = '-appname-';
|
||||||
static VALID_ALIAS = ['-root-', AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER, '-shared-'];
|
static VALID_ALIAS = [
|
||||||
|
AttachFileCloudWidgetComponent.ALIAS_ROOT_FOLDER,
|
||||||
|
AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER, '-shared-'
|
||||||
|
];
|
||||||
static RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
static RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
||||||
|
|
||||||
typeId = 'AttachFileCloudWidgetComponent';
|
typeId = 'AttachFileCloudWidgetComponent';
|
||||||
|
Reference in New Issue
Block a user