[ADF-4371] Versioning - revert upload version on delete (#4572)

* revert upload version on delete

* methods return type
This commit is contained in:
Cilibiu Bogdan
2019-04-10 18:30:50 +03:00
committed by Denys Vuika
parent 1f6e868464
commit 8975d4b6a6
8 changed files with 300 additions and 65 deletions

View File

@@ -16,7 +16,7 @@
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FileModel, CoreModule } from '@alfresco/adf-core';
import { FileModel, CoreModule, FileUploadOptions } from '@alfresco/adf-core';
import { UploadModule } from '../upload.module';
import { FileUploadingListRowComponent } from './file-uploading-list-row.component';
@@ -37,20 +37,37 @@ describe('FileUploadingListRowComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(FileUploadingListRowComponent);
component = fixture.componentInstance;
component.file = file;
});
it('emits cancel event', () => {
spyOn(component.cancel, 'emit');
component.onCancel(component.file);
describe('events', () => {
beforeEach(() => {
component.file = file;
});
expect(component.cancel.emit).toHaveBeenCalledWith(file);
it('should emit cancel event', () => {
spyOn(component.cancel, 'emit');
component.onCancel(component.file);
expect(component.cancel.emit).toHaveBeenCalledWith(file);
});
it('should emit remove event', () => {
spyOn(component.remove, 'emit');
component.onRemove(component.file);
expect(component.remove.emit).toHaveBeenCalledWith(file);
});
});
it('emits remove event', () => {
spyOn(component.remove, 'emit');
component.onRemove(component.file);
it('should render node version when upload a version file', () => {
component.file = new FileModel(<File> { name: 'fake-name' });
component.file.options = <FileUploadOptions> { newVersion: true };
component.file.data = { entry: { properties: { 'cm:versionLabel': '1' } } };
expect(component.remove.emit).toHaveBeenCalledWith(file);
fixture.detectChanges();
expect(fixture.nativeElement.querySelector(
'.adf-file-uploading-row__version'
).textContent).toContain('1');
});
});