[ADF-2975] New input for File Upload Button component (#3299)

* new nodeType input

* unit tests

* content type fix

* remove package-lock.json files
This commit is contained in:
Alex Bolboșenco
2018-05-10 21:36:31 +03:00
committed by Eugenio Romano
parent 97f888d49c
commit 4c7a63c95a
6 changed files with 61 additions and 20795 deletions

View File

@@ -24,7 +24,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@Component({
selector: 'adf-upload-button-test',
template: 'test componente';
template: 'test componente'
})
export class UploadTestComponent extends UploadBase {
@@ -214,11 +214,12 @@ describe('UploadBase', () => {
component.uploadFiles(files);
expect(addToQueueSpy).toHaveBeenCalledWith(new FileModel(files[0], {
comment: 'example-comment'
comment: 'example-comment',
newVersion: false,
majorVersion: false,
parentId: '-root-',
path: ''
path: '',
nodeType: 'cm:content'
}));
});
});
@@ -246,7 +247,8 @@ describe('UploadBase', () => {
newVersion: true,
majorVersion: true,
parentId: '-root-',
path: ''
path: '',
nodeType: 'cm:content'
}));
});
@@ -261,7 +263,49 @@ describe('UploadBase', () => {
newVersion: true,
majorVersion: false,
parentId: '-root-',
path: ''
path: '',
nodeType: 'cm:content'
}));
});
});
describe('Node Type', () => {
let addToQueueSpy;
const files: File[] = [
<File> { name: 'process.pbmn' }
];
beforeEach(() => {
addToQueueSpy = spyOn(uploadService, 'addToQueue');
});
it('should have custom nodeType if it is set', () => {
component.nodeType = 'ama:process';
component.uploadFiles(files);
expect(addToQueueSpy).toHaveBeenCalledWith(new FileModel(files[0], {
comment: undefined,
newVersion: false,
majorVersion: false,
parentId: '-root-',
path: '',
nodeType: 'ama:process'
}));
});
it('should have default nodeType if it is not set', () => {
component.uploadFiles(files);
expect(addToQueueSpy).toHaveBeenCalledWith(new FileModel(files[0], {
comment: undefined,
newVersion: false,
majorVersion: false,
parentId: '-root-',
path: '',
nodeType: 'cm:content'
}));
});
});