[ADF-2563] Upload new version information dialog (#3235)

* add majorVersion param
move common part in base class

* refactor upload queue

* fix after refactoring

* add comment functionality in versioning
add minor and major option in versioning
add animation in versioning
add new functionality in demo shell

* add animation test

* add missing properties test and base upload class

* fix reload after new version upload [ADF-2582]

* update documentation

* update doc and fix minor style issues

* fix tslint error

* change cachebuster

* ADF-2672 version manager disable buttons

* [ADF-2649] hide show actions in version list

* fix tests
This commit is contained in:
Eugenio Romano
2018-04-26 14:57:55 +01:00
committed by GitHub
parent b2b3625929
commit 8872706eab
37 changed files with 17315 additions and 449 deletions

View File

@@ -22,11 +22,13 @@ import { AlfrescoApiService, setupTestBed, CoreModule, AlfrescoApiServiceMock }
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { VersionManagerComponent } from './version-manager.component';
import { VersionListComponent } from './version-list.component';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
describe('VersionManagerComponent', () => {
let component: VersionManagerComponent;
let fixture: ComponentFixture<VersionManagerComponent>;
let spyOnListVersionHistory: jasmine.Spy;
let alfrescoApiService: AlfrescoApiService;
const expectedComment = 'test-version-comment';
const node: MinimalNodeEntryEntity = {
@@ -44,7 +46,8 @@ describe('VersionManagerComponent', () => {
setupTestBed({
imports: [
CoreModule.forRoot()
CoreModule.forRoot(),
NoopAnimationsModule
],
declarations: [
VersionManagerComponent,
@@ -61,7 +64,7 @@ describe('VersionManagerComponent', () => {
component = fixture.componentInstance;
component.node = node;
const alfrescoApiService = TestBed.get(AlfrescoApiService);
alfrescoApiService = TestBed.get(AlfrescoApiService);
spyOnListVersionHistory = spyOn(alfrescoApiService.versionsApi, 'listVersionHistory').and
.callFake(() => Promise.resolve({ list: { entries: [ versionEntry ] }}));
});
@@ -94,7 +97,7 @@ describe('VersionManagerComponent', () => {
});
}));
it('should emit success event upon successful upload of a new version', () => {
it('should emit success event upon successful upload of a new version', async(() => {
fixture.detectChanges();
const emittedData = { value: { entry: node }};
@@ -102,5 +105,35 @@ describe('VersionManagerComponent', () => {
expect(event).toBe(emittedData);
});
component.onUploadSuccess(emittedData);
}));
it('should emit nodeUpdated event upon successful upload of a new version', (done) => {
fixture.detectChanges();
alfrescoApiService.nodeUpdated.subscribe(() => {
done();
});
const emittedData = { value: { entry: node }};
component.onUploadSuccess(emittedData);
});
describe('Animation', () => {
it('should upload button be hide by default', () => {
fixture.detectChanges();
expect(component.uploadState).toEqual('close');
});
it('should upload button be visible after click on add new version button', () => {
fixture.detectChanges();
let showUploadButton = fixture.debugElement.query(By.css('#adf-show-version-upload-button'));
showUploadButton.nativeElement.click();
expect(component.uploadState).toEqual('open');
});
});
});