mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA] Shared link - update functionality (#713)
* toggle expiration input field * expiration input field animation * update node on value changed * cleanup code * test * fix test * remove event parameter * remove event parameter
This commit is contained in:
committed by
Denys Vuika
parent
4802656d79
commit
b9591ea37f
@@ -28,6 +28,7 @@ import {
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeShareModule } from './content-node-share.module';
|
||||
import { ShareDialogComponent } from './content-node-share.dialog';
|
||||
import moment from 'moment-es6';
|
||||
|
||||
describe('ShareDialogComponent', () => {
|
||||
let node;
|
||||
@@ -36,6 +37,7 @@ describe('ShareDialogComponent', () => {
|
||||
openSnackMessage: jasmine.createSpy('openSnackMessage')
|
||||
};
|
||||
let sharedLinksApiService: SharedLinksApiService;
|
||||
let nodesApiService: NodesApiService;
|
||||
let fixture;
|
||||
let component;
|
||||
|
||||
@@ -58,6 +60,7 @@ describe('ShareDialogComponent', () => {
|
||||
fixture = TestBed.createComponent(ShareDialogComponent);
|
||||
matDialog = TestBed.get(MatDialog);
|
||||
sharedLinksApiService = TestBed.get(SharedLinksApiService);
|
||||
nodesApiService = TestBed.get(NodesApiService);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
@@ -176,7 +179,7 @@ describe('ShareDialogComponent', () => {
|
||||
|
||||
it('should unshare file when confirmation dialog returns true', fakeAsync(() => {
|
||||
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(true) });
|
||||
spyOn(sharedLinksApiService, 'deleteSharedLink');
|
||||
spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of(null));
|
||||
node.entry.properties['qshare:sharedId'] = 'sharedId';
|
||||
|
||||
component.data = {
|
||||
@@ -242,4 +245,31 @@ describe('ShareDialogComponent', () => {
|
||||
.disabled
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should update node expiration date with selected date and time', () => {
|
||||
const date = moment();
|
||||
node.entry.properties['qshare:sharedId'] = 'sharedId';
|
||||
node.entry.allowableOperations = [];
|
||||
spyOn(nodesApiService, 'updateNode').and.returnValue(of({}));
|
||||
fixture.componentInstance.form.controls['time'].setValue(null);
|
||||
|
||||
component.data = {
|
||||
node,
|
||||
permission: true,
|
||||
baseShareUrl: 'some-url/'
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.nativeElement
|
||||
.querySelector('mat-slide-toggle[data-automation-id="adf-expire-toggle"]')
|
||||
.dispatchEvent(new MouseEvent('click'));
|
||||
|
||||
fixture.componentInstance.form.controls['time'].setValue(date);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', {
|
||||
properties: { 'qshare:expiryDate': date.utc().format() }
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user