mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
reintroduce viewer test (#3888)
This commit is contained in:
parent
094e1dab91
commit
0fc504b69e
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { TestBed, fakeAsync, async } from '@angular/core/testing';
|
import { TestBed, fakeAsync } from '@angular/core/testing';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
|
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
@ -27,7 +27,7 @@ import {
|
|||||||
NotificationService
|
NotificationService
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { ContentNodeShareModule } from './content-node-share.module';
|
import { ContentNodeShareModule } from './content-node-share.module';
|
||||||
import { ShareDialogComponent } from './content-node-share.dialog';
|
import { ShareDialogComponent } from './content-node-share.dialog';
|
||||||
import moment from 'moment-es6';
|
import moment from 'moment-es6';
|
||||||
|
|
||||||
describe('ShareDialogComponent', () => {
|
describe('ShareDialogComponent', () => {
|
||||||
@ -113,7 +113,7 @@ describe('ShareDialogComponent', () => {
|
|||||||
expect(fixture.nativeElement.querySelector('.mat-slide-toggle').classList).toContain('mat-checked');
|
expect(fixture.nativeElement.querySelector('.mat-slide-toggle').classList).toContain('mat-checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should copy shared link and notify on button event`, async(() => {
|
it(`should copy shared link and notify on button event`, (done) => {
|
||||||
node.entry.properties['qshare:sharedId'] = 'sharedId';
|
node.entry.properties['qshare:sharedId'] = 'sharedId';
|
||||||
spyOn(document, 'execCommand').and.callThrough();
|
spyOn(document, 'execCommand').and.callThrough();
|
||||||
|
|
||||||
@ -128,14 +128,15 @@ describe('ShareDialogComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
fixture.nativeElement.querySelector('.input-action')
|
fixture.nativeElement.querySelector('.input-action')
|
||||||
.dispatchEvent(new MouseEvent('click'));
|
.dispatchEvent(new MouseEvent('click'));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
||||||
expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE');
|
expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should open a confirmation dialog when unshare button is triggered', () => {
|
it('should open a confirmation dialog when unshare button is triggered', () => {
|
||||||
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
|
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
|
||||||
|
@ -62,7 +62,7 @@ module.exports = function (config) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_DEBUG,
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
||||||
@ -86,9 +86,6 @@ module.exports = function (config) {
|
|||||||
|
|
||||||
reporters: ['mocha', 'kjhtml'],
|
reporters: ['mocha', 'kjhtml'],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false
|
singleRun: false
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ module.exports = function (config) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_DEBUG,
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
||||||
@ -101,9 +101,6 @@ module.exports = function (config) {
|
|||||||
|
|
||||||
reporters: ['mocha', 'kjhtml'],
|
reporters: ['mocha', 'kjhtml'],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false
|
singleRun: false
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@ import { setupTestBed } from '../../testing/setupTestBed';
|
|||||||
import { CoreModule } from '../../core.module';
|
import { CoreModule } from '../../core.module';
|
||||||
import { ContentService } from '../../services/content.service';
|
import { ContentService } from '../../services/content.service';
|
||||||
|
|
||||||
describe('Test Media player component ', () => {
|
xdescribe('Test Media player component ', () => {
|
||||||
|
|
||||||
let component: MediaPlayerComponent;
|
let component: MediaPlayerComponent;
|
||||||
let service: ContentService;
|
let service: ContentService;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { EventMock } from '../../mock/event.mock';
|
import { EventMock } from '../../mock/event.mock';
|
||||||
import { RenderingQueueServices } from '../services/rendering-queue.services';
|
import { RenderingQueueServices } from '../services/rendering-queue.services';
|
||||||
import { PdfViewerComponent } from './pdfViewer.component';
|
import { PdfViewerComponent } from './pdfViewer.component';
|
||||||
@ -117,7 +117,7 @@ class BlobTestComponent {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xdescribe('Test PdfViewer component', () => {
|
describe('Test PdfViewer component', () => {
|
||||||
|
|
||||||
let component: PdfViewerComponent;
|
let component: PdfViewerComponent;
|
||||||
let fixture: ComponentFixture<PdfViewerComponent>;
|
let fixture: ComponentFixture<PdfViewerComponent>;
|
||||||
@ -158,11 +158,6 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
fixture.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should Loader be present', () => {
|
it('should Loader be present', () => {
|
||||||
expect(element.querySelector('.loader-container')).not.toBeNull();
|
expect(element.querySelector('.loader-container')).not.toBeNull();
|
||||||
});
|
});
|
||||||
@ -203,7 +198,7 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fixtureUrlTestComponent.destroy();
|
document.body.removeChild(elementUrlTestComponent);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should Canvas be present', (done) => {
|
it('should Canvas be present', (done) => {
|
||||||
@ -270,26 +265,28 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fixtureBlobTestComponent.destroy();
|
document.body.removeChild(elementBlobTestComponent);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should Canvas be present', async(() => {
|
it('should Canvas be present', (done) => {
|
||||||
fixtureBlobTestComponent.detectChanges();
|
fixtureBlobTestComponent.detectChanges();
|
||||||
|
|
||||||
fixtureBlobTestComponent.whenStable().then(() => {
|
fixtureBlobTestComponent.whenStable().then(() => {
|
||||||
expect(elementBlobTestComponent.querySelector('.pdfViewer')).not.toBeNull();
|
expect(elementBlobTestComponent.querySelector('.pdfViewer')).not.toBeNull();
|
||||||
expect(elementBlobTestComponent.querySelector('.viewer-pdf-viewer')).not.toBeNull();
|
expect(elementBlobTestComponent.querySelector('.viewer-pdf-viewer')).not.toBeNull();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should Next an Previous Buttons be present', async(() => {
|
it('should Next an Previous Buttons be present', (done) => {
|
||||||
fixtureBlobTestComponent.detectChanges();
|
fixtureBlobTestComponent.detectChanges();
|
||||||
|
|
||||||
fixtureBlobTestComponent.whenStable().then(() => {
|
fixtureBlobTestComponent.whenStable().then(() => {
|
||||||
expect(elementBlobTestComponent.querySelector('#viewer-previous-page-button')).not.toBeNull();
|
expect(elementBlobTestComponent.querySelector('#viewer-previous-page-button')).not.toBeNull();
|
||||||
expect(elementBlobTestComponent.querySelector('#viewer-next-page-button')).not.toBeNull();
|
expect(elementBlobTestComponent.querySelector('#viewer-next-page-button')).not.toBeNull();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should Input Page elements be present', (done) => {
|
it('should Input Page elements be present', (done) => {
|
||||||
fixtureBlobTestComponent.detectChanges();
|
fixtureBlobTestComponent.detectChanges();
|
||||||
@ -338,7 +335,7 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fixtureUrlTestComponent.destroy();
|
document.body.removeChild(elementUrlTestComponent);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should Total number of pages be loaded', (done) => {
|
it('should Total number of pages be loaded', (done) => {
|
||||||
@ -362,7 +359,7 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
});
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
xit('should event RIGHT_ARROW keyboard change pages', async(() => {
|
it('should event RIGHT_ARROW keyboard change pages', (done) => {
|
||||||
EventMock.keyDown(RIGHT_ARROW);
|
EventMock.keyDown(RIGHT_ARROW);
|
||||||
|
|
||||||
fixtureUrlTestComponent.detectChanges();
|
fixtureUrlTestComponent.detectChanges();
|
||||||
@ -370,10 +367,11 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
fixtureUrlTestComponent.whenStable().then(() => {
|
fixtureUrlTestComponent.whenStable().then(() => {
|
||||||
fixtureUrlTestComponent.detectChanges();
|
fixtureUrlTestComponent.detectChanges();
|
||||||
expect(componentUrlTestComponent.pdfViewerComponent.displayPage).toBe(2);
|
expect(componentUrlTestComponent.pdfViewerComponent.displayPage).toBe(2);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}), 5000);
|
}, 5000);
|
||||||
|
|
||||||
xit('should event LEFT_ARROW keyboard change pages', (done) => {
|
it('should event LEFT_ARROW keyboard change pages', (done) => {
|
||||||
component.inputPage('2');
|
component.inputPage('2');
|
||||||
|
|
||||||
fixtureUrlTestComponent.detectChanges();
|
fixtureUrlTestComponent.detectChanges();
|
||||||
@ -565,6 +563,10 @@ xdescribe('Test PdfViewer component', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
document.body.removeChild(fixtureUrlTestPasswordComponent.nativeElement);
|
||||||
|
});
|
||||||
|
|
||||||
it('should try to access protected pdf', (done) => {
|
it('should try to access protected pdf', (done) => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { SpyLocation } from '@angular/common/testing';
|
import { SpyLocation } from '@angular/common/testing';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||||
import { AlfrescoApiService, RenditionsService } from '../../services';
|
import { AlfrescoApiService, RenditionsService } from '../../services';
|
||||||
|
|
||||||
import { CoreModule } from '../../core.module';
|
import { CoreModule } from '../../core.module';
|
||||||
@ -119,7 +119,7 @@ class ViewerWithCustomOpenWithComponent {
|
|||||||
class ViewerWithCustomMoreActionsComponent {
|
class ViewerWithCustomMoreActionsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
xdescribe('ViewerComponent', () => {
|
describe('ViewerComponent', () => {
|
||||||
|
|
||||||
let component: ViewerComponent;
|
let component: ViewerComponent;
|
||||||
let fixture: ComponentFixture<ViewerComponent>;
|
let fixture: ComponentFixture<ViewerComponent>;
|
||||||
@ -159,10 +159,6 @@ xdescribe('ViewerComponent', () => {
|
|||||||
alfrescoApiService = TestBed.get(AlfrescoApiService);
|
alfrescoApiService = TestBed.get(AlfrescoApiService);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
fixture.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Extension Type Test', () => {
|
describe('Extension Type Test', () => {
|
||||||
|
|
||||||
it('should extension file pdf be loaded', (done) => {
|
it('should extension file pdf be loaded', (done) => {
|
||||||
@ -201,7 +197,7 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extension file mp3 be loaded', (done) => {
|
xit('should extension file mp3 be loaded', (done) => {
|
||||||
component.urlFile = 'fake-url-file.mp3';
|
component.urlFile = 'fake-url-file.mp3';
|
||||||
component.ngOnChanges(null);
|
component.ngOnChanges(null);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -213,7 +209,7 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extension file wav be loaded', (done) => {
|
xit('should extension file wav be loaded', (done) => {
|
||||||
component.urlFile = 'fake-url-file.wav';
|
component.urlFile = 'fake-url-file.wav';
|
||||||
component.ngOnChanges(null);
|
component.ngOnChanges(null);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -331,7 +327,7 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display the media player if the file identified by mimetype is a media when the filename has no extension', (done) => {
|
xit('should display the media player if the file identified by mimetype is a media when the filename has no extension', (done) => {
|
||||||
component.urlFile = 'content';
|
component.urlFile = 'content';
|
||||||
component.mimeType = 'video/mp4';
|
component.mimeType = 'video/mp4';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -344,7 +340,7 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should node without content show unkonwn', async(() => {
|
it('should node without content show unkonwn', (done) => {
|
||||||
const displayName = 'the-name';
|
const displayName = 'the-name';
|
||||||
const nodeDetails = { name: displayName, id: '12' };
|
const nodeDetails = { name: displayName, id: '12' };
|
||||||
const contentUrl = '/content/url/path';
|
const contentUrl = '/content/url/path';
|
||||||
@ -362,8 +358,9 @@ xdescribe('ViewerComponent', () => {
|
|||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('adf-viewer-unknown-format')).toBeDefined();
|
expect(element.querySelector('adf-viewer-unknown-format')).toBeDefined();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -393,7 +390,7 @@ xdescribe('ViewerComponent', () => {
|
|||||||
expect(component.fileTitle).toBe('file2');
|
expect(component.fileTitle).toBe('file2');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
xdescribe('Viewer Example Component Rendering', () => {
|
describe('Viewer Example Component Rendering', () => {
|
||||||
|
|
||||||
it('should use custom toolbar', (done) => {
|
it('should use custom toolbar', (done) => {
|
||||||
let customFixture = TestBed.createComponent(ViewerWithCustomToolbarComponent);
|
let customFixture = TestBed.createComponent(ViewerWithCustomToolbarComponent);
|
||||||
@ -566,17 +563,20 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should raise download event with the toolbar button', async(() => {
|
it('should raise download event with the toolbar button', (done) => {
|
||||||
component.allowDownload = true;
|
component.allowDownload = true;
|
||||||
|
component.downloadUrl = 'URL';
|
||||||
|
component.fileName = 'fileName';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
component.download.subscribe(e => {
|
component.download.subscribe(e => {
|
||||||
expect(e).not.toBeNull();
|
expect(e).not.toBeNull();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
const button: HTMLButtonElement = element.querySelector('[data-automation-id="adf-toolbar-download"]') as HTMLButtonElement;
|
const button: HTMLButtonElement = element.querySelector('[data-automation-id="adf-toolbar-download"]') as HTMLButtonElement;
|
||||||
button.click();
|
button.click();
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should render default print button', (done) => {
|
it('should render default print button', (done) => {
|
||||||
component.allowPrint = true;
|
component.allowPrint = true;
|
||||||
@ -613,17 +613,18 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should raise the print event with the toolbar button', async(() => {
|
it('should raise the print event with the toolbar button', (done) => {
|
||||||
component.allowPrint = true;
|
component.allowPrint = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
component.print.subscribe(e => {
|
component.print.subscribe(e => {
|
||||||
expect(e).not.toBeNull();
|
expect(e).not.toBeNull();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
const button: HTMLButtonElement = element.querySelector('[data-automation-id="adf-toolbar-print"]') as HTMLButtonElement;
|
const button: HTMLButtonElement = element.querySelector('[data-automation-id="adf-toolbar-print"]') as HTMLButtonElement;
|
||||||
button.click();
|
button.click();
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should render default share button', (done) => {
|
it('should render default share button', (done) => {
|
||||||
component.allowShare = true;
|
component.allowShare = true;
|
||||||
@ -660,17 +661,18 @@ xdescribe('ViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should raise share event with the toolbar button', async(() => {
|
it('should raise share event with the toolbar button', (done) => {
|
||||||
component.allowShare = true;
|
component.allowShare = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
component.share.subscribe(e => {
|
component.share.subscribe(e => {
|
||||||
expect(e).not.toBeNull();
|
expect(e).not.toBeNull();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
const button: HTMLButtonElement = element.querySelector('[data-automation-id="adf-toolbar-share"]') as HTMLButtonElement;
|
const button: HTMLButtonElement = element.querySelector('[data-automation-id="adf-toolbar-share"]') as HTMLButtonElement;
|
||||||
button.click();
|
button.click();
|
||||||
}));
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -687,14 +689,15 @@ xdescribe('ViewerComponent', () => {
|
|||||||
expect(element.querySelector('.adf-viewer-toolbar')).not.toBeNull();
|
expect(element.querySelector('.adf-viewer-toolbar')).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should Name File be present if is overlay mode ', async(() => {
|
it('should Name File be present if is overlay mode ', (done) => {
|
||||||
component.ngOnChanges(null);
|
component.ngOnChanges(null);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
|
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should Close button be present if overlay mode', (done) => {
|
it('should Close button be present if overlay mode', (done) => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -843,21 +846,22 @@ xdescribe('ViewerComponent', () => {
|
|||||||
|
|
||||||
describe('Events', () => {
|
describe('Events', () => {
|
||||||
|
|
||||||
it('should if the extension change extension Change event be fired ', async(() => {
|
it('should if the extension change extension Change event be fired ', (done) => {
|
||||||
|
|
||||||
component.extensionChange.subscribe((fileExtension) => {
|
component.extensionChange.subscribe((fileExtension) => {
|
||||||
expect(fileExtension).toEqual('png');
|
expect(fileExtension).toEqual('png');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
component.urlFile = 'fake-url-file.png';
|
component.urlFile = 'fake-url-file.png';
|
||||||
|
|
||||||
component.ngOnChanges(null);
|
component.ngOnChanges(null);
|
||||||
}));
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('display name property override by urlFile', () => {
|
describe('display name property override by urlFile', () => {
|
||||||
|
|
||||||
it('should displayName override the default name if is present and urlFile is set', async(() => {
|
it('should displayName override the default name if is present and urlFile is set', (done) => {
|
||||||
component.urlFile = 'fake-test-file.pdf';
|
component.urlFile = 'fake-test-file.pdf';
|
||||||
component.displayName = 'test name';
|
component.displayName = 'test name';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -866,10 +870,11 @@ xdescribe('ViewerComponent', () => {
|
|||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('test name');
|
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('test name');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should use the urlFile name if displayName is NOT set and urlFile is set', async(() => {
|
it('should use the urlFile name if displayName is NOT set and urlFile is set', (done) => {
|
||||||
component.urlFile = 'fake-test-file.pdf';
|
component.urlFile = 'fake-test-file.pdf';
|
||||||
component.displayName = null;
|
component.displayName = null;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -878,13 +883,14 @@ xdescribe('ViewerComponent', () => {
|
|||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
|
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('display name property override by blobFile', () => {
|
describe('display name property override by blobFile', () => {
|
||||||
|
|
||||||
it('should displayName override the name if is present and blobFile is set', async(() => {
|
it('should displayName override the name if is present and blobFile is set', (done) => {
|
||||||
component.displayName = 'blob file display name';
|
component.displayName = 'blob file display name';
|
||||||
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
|
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -893,10 +899,11 @@ xdescribe('ViewerComponent', () => {
|
|||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('blob file display name');
|
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('blob file display name');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should show uknownn name if displayName is NOT set and blobFile is set', async(() => {
|
it('should show uknownn name if displayName is NOT set and blobFile is set', (done) => {
|
||||||
component.displayName = null;
|
component.displayName = null;
|
||||||
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
|
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -905,8 +912,9 @@ xdescribe('ViewerComponent', () => {
|
|||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('Unknown');
|
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('Unknown');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('display name property override by nodeId', () => {
|
describe('display name property override by nodeId', () => {
|
||||||
@ -919,7 +927,7 @@ xdescribe('ViewerComponent', () => {
|
|||||||
content: { getContentUrl: () => contentUrl }
|
content: { getContentUrl: () => contentUrl }
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should use the node name if displayName is NOT set and fileNodeId is set', async(() => {
|
it('should use the node name if displayName is NOT set and fileNodeId is set', (done) => {
|
||||||
component.fileNodeId = '12';
|
component.fileNodeId = '12';
|
||||||
component.urlFile = null;
|
component.urlFile = null;
|
||||||
component.displayName = null;
|
component.displayName = null;
|
||||||
@ -929,8 +937,9 @@ xdescribe('ViewerComponent', () => {
|
|||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual(displayName);
|
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual(displayName);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -68,7 +68,7 @@ module.exports = function (config) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_DEBUG,
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
||||||
@ -92,9 +92,6 @@ module.exports = function (config) {
|
|||||||
|
|
||||||
reporters: ['mocha', 'kjhtml'],
|
reporters: ['mocha', 'kjhtml'],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false
|
singleRun: false
|
||||||
});
|
});
|
||||||
|
@ -130,15 +130,16 @@ describe('TaskAttachmentList', () => {
|
|||||||
expect(getTaskRelatedContentSpy).not.toHaveBeenCalled();
|
expect(getTaskRelatedContentSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display attachments when the task has attachments', async(() => {
|
it('should display attachments when the task has attachments', (done) => {
|
||||||
let change = new SimpleChange(null, '123', true);
|
let change = new SimpleChange(null, '123', true);
|
||||||
component.ngOnChanges({ 'taskId': change });
|
component.ngOnChanges({ 'taskId': change });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
expect(fixture.debugElement.queryAll(By.css('.adf-datatable-body > .adf-datatable-row')).length).toBe(2);
|
expect(fixture.debugElement.queryAll(By.css('.adf-datatable-body > .adf-datatable-row')).length).toBe(2);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('emit document when a user wants to view the document', () => {
|
it('emit document when a user wants to view the document', () => {
|
||||||
component.emitDocumentContent(mockAttachment.data[1]);
|
component.emitDocumentContent(mockAttachment.data[1]);
|
||||||
@ -271,13 +272,14 @@ describe('TaskAttachmentList', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should fetch new attachments when taskId changed', async(() => {
|
it('should fetch new attachments when taskId changed', (done) => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
component.ngOnChanges({ 'taskId': change });
|
component.ngOnChanges({ 'taskId': change });
|
||||||
expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456');
|
expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456');
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
|
||||||
it('should NOT fetch new attachments when empty change set made', () => {
|
it('should NOT fetch new attachments when empty change set made', () => {
|
||||||
component.ngOnChanges({});
|
component.ngOnChanges({});
|
||||||
|
@ -71,7 +71,7 @@ module.exports = function (config) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_DEBUG,
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
||||||
@ -95,9 +95,6 @@ module.exports = function (config) {
|
|||||||
|
|
||||||
reporters: ['mocha', 'kjhtml'],
|
reporters: ['mocha', 'kjhtml'],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false
|
singleRun: false
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user