mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-3384] Create automated tests for Version Component (#3631)
* fix version component restore and delete event * version manager actions * fix test * fix unit test * remove fdescribe * fix tslint * fix screenshot rewrite problem * remove fdescribe * multi instance try * remove fdescribe * try uncomment some test * error page * fix user preferences pagiantion * search page test include * fix type tslint e2e * restore code * default lang momentadapter * fix test * [ADF-3384] removed console log from test * [ADF-3384] adding some fixes for tests and code * [ADF-3384] fixed some test and code
This commit is contained in:
committed by
Eugenio Romano
parent
17074478e2
commit
a12662e7e2
@@ -27,8 +27,8 @@ import { MAT_DIALOG_DATA } from '@angular/material';
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<span class="spacer"></span>
|
||||
<button mat-button [mat-dialog-close]="true">{{ yesLabel | translate }}</button>
|
||||
<button mat-button color="primary" [mat-dialog-close]="false" cdkFocusInitial>{{ noLabel | translate }}</button>
|
||||
<button id="adf-confirm-accept" mat-button [mat-dialog-close]="true">{{ yesLabel | translate }}</button>
|
||||
<button id="adf-confirm-cancel" mat-button color="primary" [mat-dialog-close]="false" cdkFocusInitial>{{ noLabel | translate }}</button>
|
||||
</mat-dialog-actions>
|
||||
`,
|
||||
styles: [`
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<div *ngIf="isDialogActive"
|
||||
class="upload-dialog"
|
||||
id="upload-dialog"
|
||||
[class.upload-dialog--minimized]="isDialogMinimized"
|
||||
[class.upload-dialog--position-left]="position === 'left'"
|
||||
[class.upload-dialog--position-right]="position === 'right'">
|
||||
@@ -45,8 +46,7 @@
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<section
|
||||
class="upload-dialog__info"
|
||||
<section class="upload-dialog__info"
|
||||
*ngIf="totalErrors">
|
||||
{{
|
||||
(totalErrors > 1
|
||||
@@ -56,8 +56,7 @@
|
||||
}}
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="upload-dialog__content"
|
||||
<section class="upload-dialog__content"
|
||||
[class.upload-dialog--padding]="isConfirmation">
|
||||
<adf-file-uploading-list
|
||||
(error)="onError($event)"
|
||||
@@ -86,10 +85,10 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer
|
||||
class="upload-dialog__actions"
|
||||
[class.upload-dialog--hide]="isConfirmation">
|
||||
<footer class="upload-dialog__actions"
|
||||
*ngIf="!isConfirmation">
|
||||
<button
|
||||
id="adf-upload-dialog-cancel-all"
|
||||
color="primary"
|
||||
mat-button
|
||||
*ngIf="!uploadList.isUploadCompleted() && !uploadList.isUploadCancelled()"
|
||||
@@ -98,6 +97,7 @@
|
||||
</button>
|
||||
|
||||
<button
|
||||
id="adf-upload-dialog-close"
|
||||
*ngIf="uploadList.isUploadCompleted() || uploadList.isUploadCancelled()"
|
||||
mat-button
|
||||
color="primary"
|
||||
@@ -106,10 +106,10 @@
|
||||
</button>
|
||||
</footer>
|
||||
|
||||
<footer
|
||||
class="upload-dialog__actions"
|
||||
[class.upload-dialog--hide]="!isConfirmation">
|
||||
<footer class="upload-dialog__actions"
|
||||
*ngIf="isConfirmation">
|
||||
<button
|
||||
id="adf-upload-dialog-cancel"
|
||||
color="secondary"
|
||||
mat-button
|
||||
(click)="cancelAllUploads()">
|
||||
@@ -117,6 +117,7 @@
|
||||
</button>
|
||||
|
||||
<button
|
||||
id="adf-upload-dialog-confirm"
|
||||
mat-button
|
||||
color="primary"
|
||||
(click)="toggleConfirmation()">
|
||||
|
@@ -1,39 +1,40 @@
|
||||
<mat-list class="adf-version-list" *ngIf="!isLoading; else loading_template">
|
||||
<mat-list-item *ngFor="let version of versions; let idx = index">
|
||||
<mat-icon mat-list-icon>insert_drive_file</mat-icon>
|
||||
<h4 mat-line class="adf-version-list-item-name">{{version.entry.name}}</h4>
|
||||
<h4 mat-line class="adf-version-list-item-name" [id]="'adf-version-list-item-name-' + version.entry.id" >{{version.entry.name}}</h4>
|
||||
<p mat-line>
|
||||
<span class="adf-version-list-item-version">{{version.entry.id}}</span> -
|
||||
<span class="adf-version-list-item-date">{{version.entry.modifiedAt | date}}</span>
|
||||
<span class="adf-version-list-item-version" [id]="'adf-version-list-item-version-' + version.entry.id" >{{version.entry.id}}</span> -
|
||||
<span class="adf-version-list-item-date" [id]="'adf-version-list-item-date-' + version.entry.id" >{{version.entry.modifiedAt | date}}</span>
|
||||
</p>
|
||||
<p mat-line class="adf-version-list-item-comment" *ngIf="showComments">{{version.entry.versionComment}}</p>
|
||||
<p mat-line [id]="'adf-version-list-item-comment-'+ version.entry.id" class="adf-version-list-item-comment"
|
||||
*ngIf="showComments">{{version.entry.versionComment}}</p>
|
||||
|
||||
<div *ngIf="showActions">
|
||||
<mat-menu [id]="'adf-version-list-action-menu-'+idx"
|
||||
<mat-menu [id]="'adf-version-list-action-menu-'+version.entry.id"
|
||||
#versionMenu="matMenu" yPosition="below" xPosition="before">
|
||||
<button
|
||||
[id]="'adf-version-list-action-restore-'+idx"
|
||||
[id]="'adf-version-list-action-restore-'+version.entry.id"
|
||||
[disabled]="!canUpdate()"
|
||||
mat-menu-item
|
||||
(click)="restore(version.entry.id)">
|
||||
{{ 'ADF_VERSION_LIST.ACTIONS.RESTORE' | translate }}
|
||||
</button>
|
||||
<button *ngIf="allowDownload"
|
||||
[id]="'adf-version-list-action-download-'+idx"
|
||||
[id]="'adf-version-list-action-download-'+version.entry.id"
|
||||
mat-menu-item
|
||||
(click)="downloadVersion(version.entry.id)">
|
||||
{{ 'ADF_VERSION_LIST.ACTIONS.DOWNLOAD' | translate }}
|
||||
</button>
|
||||
<button
|
||||
[disabled]="!canDelete()"
|
||||
[id]="'adf-version-list-action-delete-'+idx"
|
||||
[id]="'adf-version-list-action-delete-'+version.entry.id"
|
||||
(click)="deleteVersion(version.entry.id)"
|
||||
mat-menu-item>
|
||||
{{ 'ADF_VERSION_LIST.ACTIONS.DELETE' | translate }}
|
||||
</button>
|
||||
</mat-menu>
|
||||
|
||||
<button mat-icon-button [matMenuTriggerFor]="versionMenu" [id]="'adf-version-list-action-menu-button-'+idx">
|
||||
<button mat-icon-button [matMenuTriggerFor]="versionMenu" [id]="'adf-version-list-action-menu-button-'+version.entry.id">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -33,6 +33,15 @@ describe('VersionListComponent', () => {
|
||||
const nodeId = 'test-id';
|
||||
const versionId = '1.0';
|
||||
|
||||
const versionTest = [
|
||||
{
|
||||
entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }
|
||||
},
|
||||
{
|
||||
entry: { name: 'test-file-name-two', id: '1.0', versionComment: 'test-version-comment' }
|
||||
}
|
||||
];
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
CoreModule.forRoot(),
|
||||
@@ -64,6 +73,9 @@ describe('VersionListComponent', () => {
|
||||
});
|
||||
|
||||
it('should raise confirmation dialog on delete', () => {
|
||||
fixture.detectChanges();
|
||||
component.versions = versionTest;
|
||||
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return Observable.of(false);
|
||||
@@ -76,7 +88,8 @@ describe('VersionListComponent', () => {
|
||||
});
|
||||
|
||||
it('should delete the version if user confirms', () => {
|
||||
spyOn(alfrescoApiService.versionsApi, 'listVersionHistory').and.returnValue(Promise.resolve({ list: { entries: [] } }));
|
||||
fixture.detectChanges();
|
||||
component.versions = versionTest;
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return Observable.of(true);
|
||||
@@ -92,6 +105,8 @@ describe('VersionListComponent', () => {
|
||||
});
|
||||
|
||||
it('should not delete version if user rejects', () => {
|
||||
component.versions = versionTest;
|
||||
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return Observable.of(false);
|
||||
@@ -106,21 +121,21 @@ describe('VersionListComponent', () => {
|
||||
expect(alfrescoApiService.versionsApi.deleteVersion).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reload and raise version-deleted DOM event', (done) => {
|
||||
it('should reload and raise deleted event', (done) => {
|
||||
spyOn(component, 'loadVersionHistory').and.stub();
|
||||
fixture.nativeElement.addEventListener('version-deleted', () => {
|
||||
component.deleted.subscribe(() => {
|
||||
expect(component.loadVersionHistory).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
fixture.detectChanges();
|
||||
component.onVersionDeleted();
|
||||
component.onVersionDeleted({});
|
||||
});
|
||||
|
||||
describe('Version history fetching', () => {
|
||||
|
||||
it('should use loading bar', () => {
|
||||
spyOn(alfrescoApiService.versionsApi, 'listVersionHistory').and
|
||||
.callFake(() => Promise.resolve({ list: { entries: [] } }));
|
||||
.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||
|
||||
let loadingProgressBar = fixture.debugElement.query(By.css('[data-automation-id="version-history-loading-bar"]'));
|
||||
expect(loadingProgressBar).toBeNull();
|
||||
@@ -134,7 +149,7 @@ describe('VersionListComponent', () => {
|
||||
|
||||
it('should load the versions for a given id', () => {
|
||||
spyOn(alfrescoApiService.versionsApi, 'listVersionHistory').and
|
||||
.callFake(() => Promise.resolve({ list: { entries: [] } }));
|
||||
.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
@@ -241,12 +256,12 @@ describe('VersionListComponent', () => {
|
||||
|
||||
it('should reload and raise version-restored DOM event', (done) => {
|
||||
spyOn(component, 'loadVersionHistory').and.stub();
|
||||
fixture.nativeElement.addEventListener('version-restored', () => {
|
||||
component.restored.subscribe(() => {
|
||||
expect(component.loadVersionHistory).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
fixture.detectChanges();
|
||||
component.onVersionRestored();
|
||||
component.onVersionRestored({});
|
||||
});
|
||||
|
||||
it('should restore version only when restore allowed', () => {
|
||||
@@ -258,8 +273,8 @@ describe('VersionListComponent', () => {
|
||||
|
||||
it('should load the versions for a given id', () => {
|
||||
fixture.detectChanges();
|
||||
spyOn(alfrescoApiService.versionsApi, 'listVersionHistory').and
|
||||
.callFake(() => Promise.resolve({ list: { entries: [] } }));
|
||||
component.versions = versionTest;
|
||||
|
||||
const spyOnRevertVersion = spyOn(alfrescoApiService.versionsApi, 'revertVersion').and
|
||||
.callFake(() => Promise.resolve(
|
||||
{ entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' } }));
|
||||
@@ -271,8 +286,10 @@ describe('VersionListComponent', () => {
|
||||
|
||||
it('should reload the version list after a version restore', (done) => {
|
||||
fixture.detectChanges();
|
||||
component.versions = versionTest;
|
||||
|
||||
const spyOnListVersionHistory = spyOn(alfrescoApiService.versionsApi, 'listVersionHistory').and
|
||||
.callFake(() => Promise.resolve({ list: { entries: [] } }));
|
||||
.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||
spyOn(alfrescoApiService.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve());
|
||||
|
||||
component.restore(versionId);
|
||||
@@ -307,12 +324,14 @@ describe('VersionListComponent', () => {
|
||||
});
|
||||
|
||||
it('should show Actions if showActions is true', (done) => {
|
||||
component.versions = versionTest;
|
||||
|
||||
component.showActions = true;
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let menuButton = fixture.debugElement.query(By.css('#adf-version-list-action-menu-button-0'));
|
||||
let menuButton = fixture.nativeElement.querySelector('[id="adf-version-list-action-menu-button-1.0"]');
|
||||
|
||||
expect(menuButton).not.toBeNull();
|
||||
done();
|
||||
@@ -325,7 +344,7 @@ describe('VersionListComponent', () => {
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let menuButton = fixture.debugElement.query(By.css('#adf-version-list-action-menu-button-0'));
|
||||
let menuButton = fixture.nativeElement.querySelector('[id="adf-version-list-action-menu-button-1.0"]');
|
||||
|
||||
expect(menuButton).toBeNull();
|
||||
done();
|
||||
@@ -342,6 +361,9 @@ describe('VersionListComponent', () => {
|
||||
return Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
entry: { name: 'test-file-two', id: '1.1', versionComment: 'test-version-comment' }
|
||||
},
|
||||
{
|
||||
entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }
|
||||
}
|
||||
@@ -356,12 +378,12 @@ describe('VersionListComponent', () => {
|
||||
it('should disable delete action if is not allowed', (done) => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let menuButton = fixture.debugElement.query(By.css('#adf-version-list-action-menu-button-0'));
|
||||
menuButton.nativeElement.click();
|
||||
let menuButton = fixture.nativeElement.querySelector('[id="adf-version-list-action-menu-button-1.1"]');
|
||||
menuButton.click();
|
||||
|
||||
let deleteButton = fixture.debugElement.query(By.css('#adf-version-list-action-delete-0'));
|
||||
let deleteButton: any = document.querySelector('[id="adf-version-list-action-delete-1.1"]');
|
||||
|
||||
expect(deleteButton.nativeElement.disabled).toBe(true);
|
||||
expect(deleteButton.disabled).toBe(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -369,12 +391,12 @@ describe('VersionListComponent', () => {
|
||||
it('should disable restore action if is not allowed', (done) => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let menuButton = fixture.debugElement.query(By.css('#adf-version-list-action-menu-button-0'));
|
||||
menuButton.nativeElement.click();
|
||||
let menuButton = fixture.nativeElement.querySelector('[id="adf-version-list-action-menu-button-1.1"]');
|
||||
menuButton.click();
|
||||
|
||||
let restoreButton = fixture.debugElement.query(By.css('#adf-version-list-action-restore-0'));
|
||||
let restoreButton: any = document.querySelector('[id="adf-version-list-action-restore-1.1"]');
|
||||
|
||||
expect(restoreButton.nativeElement.disabled).toBe(true);
|
||||
expect(restoreButton.disabled).toBe(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -389,6 +411,9 @@ describe('VersionListComponent', () => {
|
||||
return Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
entry: { name: 'test-file-name', id: '1.1', versionComment: 'test-version-comment' }
|
||||
},
|
||||
{
|
||||
entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }
|
||||
}
|
||||
@@ -403,12 +428,12 @@ describe('VersionListComponent', () => {
|
||||
it('should enable delete action if is allowed', (done) => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let menuButton = fixture.debugElement.query(By.css('#adf-version-list-action-menu-button-0'));
|
||||
menuButton.nativeElement.click();
|
||||
let menuButton = fixture.nativeElement.querySelector('[id="adf-version-list-action-menu-button-1.1"]');
|
||||
menuButton.click();
|
||||
|
||||
let deleteButton = fixture.debugElement.query(By.css('#adf-version-list-action-delete-0'));
|
||||
let deleteButton: any = document.querySelector('[id="adf-version-list-action-delete-1.1"]');
|
||||
|
||||
expect(deleteButton.nativeElement.disabled).toBe(false);
|
||||
expect(deleteButton.disabled).toBe(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -416,12 +441,12 @@ describe('VersionListComponent', () => {
|
||||
it('should enable restore action if is allowed', (done) => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let menuButton = fixture.debugElement.query(By.css('#adf-version-list-action-menu-button-0'));
|
||||
menuButton.nativeElement.click();
|
||||
let menuButton = fixture.nativeElement.querySelector('[id="adf-version-list-action-menu-button-1.1"]');
|
||||
menuButton.click();
|
||||
|
||||
let restoreButton = fixture.debugElement.query(By.css('#adf-version-list-action-restore-0'));
|
||||
let restoreButton: any = document.querySelector('[id="adf-version-list-action-restore-1.1"]');
|
||||
|
||||
expect(restoreButton.nativeElement.disabled).toBe(false);
|
||||
expect(restoreButton.disabled).toBe(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, ContentService } from '@alfresco/adf-core';
|
||||
import { Component, Input, OnChanges, ViewEncapsulation, ElementRef } from '@angular/core';
|
||||
import { Component, Input, OnChanges, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
||||
import { VersionsApi, MinimalNodeEntryEntity, VersionEntry } from 'alfresco-js-api';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { ConfirmDialogComponent } from '../dialogs/confirm.dialog';
|
||||
@@ -56,10 +56,17 @@ export class VersionListComponent implements OnChanges {
|
||||
@Input()
|
||||
showActions = true;
|
||||
|
||||
/** Emitted when a version is restored */
|
||||
@Output()
|
||||
restored: EventEmitter<MinimalNodeEntryEntity> = new EventEmitter<MinimalNodeEntryEntity>();
|
||||
|
||||
/** Emitted when a version is deleted */
|
||||
@Output()
|
||||
deleted: EventEmitter<MinimalNodeEntryEntity> = new EventEmitter<MinimalNodeEntryEntity>();
|
||||
|
||||
constructor(private alfrescoApi: AlfrescoApiService,
|
||||
private contentService: ContentService,
|
||||
private dialog: MatDialog,
|
||||
private el: ElementRef) {
|
||||
private dialog: MatDialog) {
|
||||
this.versionsApi = this.alfrescoApi.versionsApi;
|
||||
}
|
||||
|
||||
@@ -68,18 +75,18 @@ export class VersionListComponent implements OnChanges {
|
||||
}
|
||||
|
||||
canUpdate(): boolean {
|
||||
return this.contentService.hasPermission(this.node, 'update');
|
||||
return this.contentService.hasPermission(this.node, 'update') && this.versions.length > 1;
|
||||
}
|
||||
|
||||
canDelete(): boolean {
|
||||
return this.contentService.hasPermission(this.node, 'delete');
|
||||
return this.contentService.hasPermission(this.node, 'delete') && this.versions.length > 1;
|
||||
}
|
||||
|
||||
restore(versionId) {
|
||||
if (this.canUpdate()) {
|
||||
this.versionsApi
|
||||
.revertVersion(this.node.id, versionId, { majorVersion: true, comment: '' })
|
||||
.then(() => this.onVersionRestored());
|
||||
.then(() => this.onVersionRestored(this.node));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,24 +121,20 @@ export class VersionListComponent implements OnChanges {
|
||||
if (result === true) {
|
||||
this.alfrescoApi.versionsApi
|
||||
.deleteVersion(this.node.id, versionId)
|
||||
.then(() => this.onVersionDeleted());
|
||||
.then(() => this.onVersionDeleted(this.node));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onVersionDeleted() {
|
||||
onVersionDeleted(node: any) {
|
||||
this.loadVersionHistory();
|
||||
|
||||
const event = new CustomEvent('version-deleted', { bubbles: true });
|
||||
this.el.nativeElement.dispatchEvent(event);
|
||||
this.deleted.emit(node);
|
||||
}
|
||||
|
||||
onVersionRestored() {
|
||||
onVersionRestored(node: any) {
|
||||
this.loadVersionHistory();
|
||||
|
||||
const event = new CustomEvent('version-restored', { bubbles: true });
|
||||
this.el.nativeElement.dispatchEvent(event);
|
||||
this.restored.emit(node);
|
||||
}
|
||||
|
||||
private getVersionContentUrl(nodeId: string, versionId: string, attachment?: boolean) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<div class="adf-new-version-container">
|
||||
<div class="adf-new-version-uploader-container" fxLayout="row" fxLayoutAlign="end center" [@uploadToggle]="uploadState">
|
||||
<table class="adf-version-upload">
|
||||
<div class="adf-new-version-uploader-container" id="adf-new-version-uploader-container" fxLayout="row" fxLayoutAlign="end center" [@uploadToggle]="uploadState">
|
||||
<table class="adf-version-upload" *ngIf="uploadState !== 'close'">
|
||||
<tr>
|
||||
<td>
|
||||
<adf-version-upload
|
||||
@@ -8,7 +8,7 @@
|
||||
[node]="node"
|
||||
(success)="onUploadSuccess($event)"
|
||||
(cancel)="onUploadCancel()"
|
||||
(error)="uploadError.emit($event)">
|
||||
(error)="onUploadError($event)">
|
||||
</adf-version-upload>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -27,11 +27,14 @@
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<adf-version-list
|
||||
#versionList
|
||||
[node]="node"
|
||||
[allowDownload]="allowDownload"
|
||||
[showComments]="showComments">
|
||||
[showComments]="showComments"
|
||||
(deleted)="refresh($event)"
|
||||
(restored)="refresh($event)">
|
||||
</adf-version-list>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
float: left;
|
||||
position: relative;
|
||||
visibility: hidden;
|
||||
display: hidden;
|
||||
}
|
||||
|
||||
.adf-new-version-container {
|
||||
|
@@ -102,7 +102,7 @@ describe('VersionManagerComponent', () => {
|
||||
|
||||
const emittedData = { value: { entry: node }};
|
||||
component.uploadSuccess.subscribe(event => {
|
||||
expect(event).toBe(emittedData);
|
||||
expect(event).toBe(node);
|
||||
});
|
||||
component.onUploadSuccess(emittedData);
|
||||
}));
|
||||
|
@@ -57,11 +57,11 @@ export class VersionManagerComponent {
|
||||
|
||||
/** Emitted when a file is uploaded successfully. */
|
||||
@Output()
|
||||
uploadSuccess = new EventEmitter();
|
||||
uploadSuccess: EventEmitter<MinimalNodeEntryEntity> = new EventEmitter<MinimalNodeEntryEntity>();
|
||||
|
||||
/** Emitted when an error occurs during upload. */
|
||||
@Output()
|
||||
uploadError = new EventEmitter();
|
||||
uploadError: EventEmitter<MinimalNodeEntryEntity> = new EventEmitter<MinimalNodeEntryEntity>();
|
||||
|
||||
@ViewChild('versionList')
|
||||
versionListComponent: VersionListComponent;
|
||||
@@ -73,13 +73,24 @@ export class VersionManagerComponent {
|
||||
private alfrescoApiService: AlfrescoApiService) {
|
||||
}
|
||||
|
||||
onUploadSuccess(event) {
|
||||
refresh(node: MinimalNodeEntryEntity) {
|
||||
this.alfrescoApiService.nodeUpdated.next(node);
|
||||
this.versionListComponent.loadVersionHistory();
|
||||
this.uploadSuccess.emit(node);
|
||||
this.uploadState = 'close';
|
||||
}
|
||||
|
||||
onUploadSuccess(event: any) {
|
||||
this.alfrescoApiService.nodeUpdated.next(event.value.entry);
|
||||
this.versionListComponent.loadVersionHistory();
|
||||
this.uploadSuccess.emit(event);
|
||||
this.uploadSuccess.emit(event.value.entry);
|
||||
this.uploadState = 'close';
|
||||
}
|
||||
|
||||
onUploadError(event: any) {
|
||||
this.uploadError.emit(event);
|
||||
}
|
||||
|
||||
onUploadCancel() {
|
||||
this.uploadState = 'close';
|
||||
}
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<div class="adf-new-version-max-width">
|
||||
<mat-radio-group class="adf-new-version-radio-group" [(ngModel)]="semanticVersion">
|
||||
<mat-radio-button class="adf-new-version-radio-button" [value]="'minor'">{{
|
||||
<mat-radio-button class="adf-new-version-radio-button" id="adf-new-version-minor"[value]="'minor'">{{
|
||||
'ADF_VERSION_LIST.ACTIONS.UPLOAD.MINOR' |
|
||||
translate }}
|
||||
</mat-radio-button>
|
||||
<mat-radio-button class="adf-new-version-radio-button" [value]="'major'">{{
|
||||
<mat-radio-button class="adf-new-version-radio-button" id="adf-new-version-major" [value]="'major'">{{
|
||||
'ADF_VERSION_LIST.ACTIONS.UPLOAD.MAJOR' |
|
||||
translate }}
|
||||
</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<mat-form-field class="adf-new-version-max-width">
|
||||
<textarea matInput [(ngModel)]="comment" class="adf-new-version-text-area"
|
||||
<textarea matInput [(ngModel)]="comment" class="adf-new-version-text-area" id="adf-new-version-text-area"
|
||||
placeholder="{{ 'ADF_VERSION_LIST.ACTIONS.UPLOAD.COMMENT' | translate }}"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
(success)="success.emit($event)"
|
||||
(error)="error.emit($event)">
|
||||
</adf-upload-version-button>
|
||||
<button mat-raised-button (click)="cancelUpload()">{{
|
||||
<button mat-raised-button (click)="cancelUpload()" id="adf-new-version-cancel" >{{
|
||||
'ADF_VERSION_LIST.ACTIONS.UPLOAD.CANCEL'| translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user