mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[no-issue] speed up test CS part 2 (#3009)
* remove tag and rating service the testbed * remove unused import in modules * pdf viewer async * viewer test fixed * remove testbed share datatable * remove unused dependencies * add missing parameter * remove testbed from folder actions service * TaskHeaderComponent async * remove testbed from document actions and list * remove unused import * use done for nested test * fast finish false
This commit is contained in:
@@ -54,4 +54,4 @@ install:
|
||||
# Don't actually build.
|
||||
build: off
|
||||
matrix:
|
||||
fast_finish: true
|
||||
fast_finish: false
|
||||
|
@@ -20,7 +20,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PathElementEntity } from 'alfresco-js-api';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { fakeNodeWithCreatePermission } from '../mock';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DocumentListService, DocumentListComponent } from '../document-list';
|
||||
import { BreadcrumbComponent } from './breadcrumb.component';
|
||||
|
||||
@@ -35,8 +34,7 @@ describe('Breadcrumb', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent,
|
||||
|
@@ -20,7 +20,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { fakeNodeWithCreatePermission } from '../mock';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DocumentListComponent, DocumentListService } from '../document-list';
|
||||
import { DropdownBreadcrumbComponent } from './dropdown-breadcrumb.component';
|
||||
|
||||
@@ -33,8 +32,7 @@ describe('DropdownBreadcrumb', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent,
|
||||
|
@@ -29,7 +29,6 @@ import {
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { EmptyFolderContentDirective, DocumentListComponent, DocumentListService } from '../document-list';
|
||||
import { DropdownSitesComponent } from '../site-dropdown';
|
||||
import { DropdownBreadcrumbComponent } from '../breadcrumb';
|
||||
@@ -78,8 +77,7 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
function setupTestbed(plusProviders) {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent,
|
||||
|
@@ -23,7 +23,6 @@ import { ContentNodeSelectorComponent } from './content-node-selector.component'
|
||||
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
||||
import { ContentNodeSelectorService } from './content-node-selector.service';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import {
|
||||
EmptyFolderContentDirective,
|
||||
@@ -41,7 +40,6 @@ describe('ContentNodeSelectorDialogComponent', () => {
|
||||
function setupTestbed(plusProviders) {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
ContentNodeSelectorComponent,
|
||||
|
@@ -19,7 +19,6 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatDialogRef } from '@angular/material';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@@ -42,7 +41,6 @@ describe('FolderDialogComponent', () => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
BrowserDynamicTestingModule
|
||||
|
@@ -21,7 +21,6 @@ import { MatDialog } from '@angular/material';
|
||||
import { Component, DebugElement } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DialogModule } from '../dialogs/dialog.module';
|
||||
import { NodeDownloadDirective } from './node-download.directive';
|
||||
|
||||
@@ -44,8 +43,7 @@ describe('NodeDownloadDirective', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DialogModule,
|
||||
MaterialModule
|
||||
DialogModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent,
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { ContentActionModel } from './../../models/content-action.model';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
@@ -32,8 +31,7 @@ describe('ContentColumnList', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -20,7 +20,6 @@ import { EventEmitter } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { ContentService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { FileNode } from '../../../mock';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { ContentActionHandler } from './../../models/content-action.model';
|
||||
@@ -45,8 +44,7 @@ describe('ContentAction', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
providers: [
|
||||
DocumentListService
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataColumn, DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
@@ -34,8 +33,7 @@ describe('ContentColumnList', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -19,7 +19,6 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { ContentColumnListComponent } from './content-column-list.component';
|
||||
@@ -34,8 +33,7 @@ describe('ContentColumn', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -31,7 +31,6 @@ import {
|
||||
fakeGetSitesAnswer,
|
||||
fakeGetSiteMembership
|
||||
} from '../../mock';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { ContentActionModel } from '../models/content-action.model';
|
||||
import { NodeMinimal, NodeMinimalEntry, NodePaging } from '../models/document-library.model';
|
||||
import { ImageResolver } from './../data/image-resolver.model';
|
||||
@@ -56,8 +55,7 @@ describe('DocumentList', () => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent, DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
@@ -32,8 +31,7 @@ describe('EmptyFolderContent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -19,7 +19,6 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { MatProgressSpinnerModule } from '@angular/material';
|
||||
import { DataTableComponent, DataTableModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { NoPermissionContentDirective } from './no-permission-content.directive';
|
||||
@@ -32,7 +31,6 @@ describe('NoPermissionContentDirective', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
DataTableModule,
|
||||
MatProgressSpinnerModule
|
||||
],
|
||||
|
@@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataColumn, DataRow, DataSorting } from '@alfresco/adf-core';
|
||||
import { DataColumn, DataRow, DataSorting, ContentService } from '@alfresco/adf-core';
|
||||
import { FileNode, FolderNode } from './../../mock';
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
import { ShareDataRow } from './share-data-row.model';
|
||||
@@ -26,17 +25,11 @@ describe('ShareDataTableAdapter', () => {
|
||||
|
||||
let documentListService: DocumentListService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
let imageUrl: string = 'http://<addresss>';
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
documentListService = new DocumentListService(null, contentService, null, null, null);
|
||||
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
|
||||
});
|
||||
|
||||
it('should setup rows and columns with constructor', () => {
|
||||
@@ -194,13 +187,15 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should generate fallback icon for a file thumbnail with missing mime type', () => {
|
||||
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneouse.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
file.entry.content.mimeType = null;
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_miscellaneous`);
|
||||
@@ -208,13 +203,15 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should generate fallback icon for a file with no content entry', () => {
|
||||
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneouse.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
file.entry.content = null;
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_miscellaneous`);
|
||||
@@ -229,17 +226,19 @@ describe('ShareDataTableAdapter', () => {
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: 'icon'};
|
||||
let col = <DataColumn> { type: 'image', key: 'icon' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toBe(imageUrl);
|
||||
});
|
||||
|
||||
it('should resolve folder icon', () => {
|
||||
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let row = new ShareDataRow(new FolderNode(), documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_folder`);
|
||||
@@ -247,15 +246,13 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should resolve file thumbnail', () => {
|
||||
let imageUrl: string = 'http://<addresss>';
|
||||
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
|
||||
|
||||
let imageUrl = 'http://<addresss>';
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
adapter.thumbnails = true;
|
||||
|
||||
let file = new FileNode();
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toBe(imageUrl);
|
||||
@@ -263,6 +260,8 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should resolve fallback file icon for unknown node', () => {
|
||||
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
@@ -271,7 +270,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
file.entry.content = null;
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_miscellaneous`);
|
||||
@@ -279,6 +278,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should resolve file icon for content type', () => {
|
||||
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_raster_image.svg`);
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
@@ -287,7 +287,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
file.entry.content.mimeType = 'image/png';
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_raster_image`);
|
||||
@@ -299,7 +299,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
let file2 = new FileNode('file2');
|
||||
let folder = new FolderNode();
|
||||
|
||||
let col = <DataColumn> {key: 'name'};
|
||||
let col = <DataColumn> { key: 'name' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
adapter.setSorting(new DataSorting('name', 'asc'));
|
||||
|
||||
@@ -322,7 +322,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
let file2 = new FileNode('file2');
|
||||
file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2);
|
||||
|
||||
let col = <DataColumn> {key: 'dateProp'};
|
||||
let col = <DataColumn> { key: 'dateProp' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
|
||||
adapter.setRows([
|
||||
@@ -352,7 +352,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
file3.entry.content.sizeInBytes = 4224120; // 4.03 MB
|
||||
file4.entry.content.sizeInBytes = 2852791665; // 2.66 GB
|
||||
|
||||
let col = <DataColumn> {key: 'content.sizeInBytes'};
|
||||
let col = <DataColumn> { key: 'content.sizeInBytes' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
|
||||
adapter.setRows([
|
||||
@@ -385,7 +385,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
let file5 = new FileNode('a');
|
||||
let file6 = new FileNode('b');
|
||||
|
||||
let col = <DataColumn> {key: 'name'};
|
||||
let col = <DataColumn> { key: 'name' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
|
||||
adapter.setRows([
|
||||
@@ -415,71 +415,57 @@ describe('ShareDataTableAdapter', () => {
|
||||
expect((<ShareDataRow> rows[4]).node).toBe(file6);
|
||||
expect((<ShareDataRow> rows[5]).node).toBe(file5);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ShareDataRow', () => {
|
||||
describe('ShareDataRow', () => {
|
||||
|
||||
let documentListService: DocumentListService;
|
||||
it('should wrap node', () => {
|
||||
let file = new FileNode();
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.node).toBe(file);
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
it('should require object source', () => {
|
||||
expect(() => {
|
||||
return new ShareDataRow(null, documentListService, null);
|
||||
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
});
|
||||
it('should resolve value from node entry', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.getValue('name')).toBe('test');
|
||||
});
|
||||
|
||||
it('should wrap node', () => {
|
||||
let file = new FileNode();
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.node).toBe(file);
|
||||
});
|
||||
it('should check value', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should require object source', () => {
|
||||
expect(() => {
|
||||
return new ShareDataRow(null, documentListService, null);
|
||||
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
|
||||
});
|
||||
expect(row.hasValue('name')).toBeTruthy();
|
||||
expect(row.hasValue('missing')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should resolve value from node entry', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.getValue('name')).toBe('test');
|
||||
});
|
||||
it('should be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
file.entry['allowableOperations'] = ['create'];
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should check value', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.isDropTarget).toBeTruthy();
|
||||
});
|
||||
|
||||
expect(row.hasValue('name')).toBeTruthy();
|
||||
expect(row.hasValue('missing')).toBeFalsy();
|
||||
});
|
||||
it('should not be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
file.entry['allowableOperations'] = ['create'];
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
expect(row.isDropTarget).toBeTruthy();
|
||||
});
|
||||
it('should not be set as drop target when element is not a Folder', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should not be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not be set as drop target when element is not a Folder', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -15,16 +15,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { DocumentListModule } from '../document-list.module';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { DocumentActionsService } from './document-actions.service';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
import { DialogModule } from '../../dialogs/dialog.module';
|
||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
describe('DocumentActionsService', () => {
|
||||
@@ -33,22 +34,12 @@ describe('DocumentActionsService', () => {
|
||||
let documentListService: DocumentListService;
|
||||
let nodeActionsService: NodeActionsService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DialogModule,
|
||||
DocumentListModule
|
||||
],
|
||||
providers: [
|
||||
ContentNodeDialogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
nodeActionsService = TestBed.get(NodeActionsService);
|
||||
service = TestBed.get(DocumentActionsService);
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
|
||||
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
|
||||
|
||||
service = new DocumentActionsService(null, documentListService, contentService);
|
||||
});
|
||||
|
||||
it('should register default download action', () => {
|
||||
|
@@ -15,9 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { CookieService, LogService } from '@alfresco/adf-core';
|
||||
import { CookieServiceMock } from '@alfresco/adf-core';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -87,19 +90,10 @@ describe('DocumentListService', () => {
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
LogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(DocumentListService);
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
|
||||
service = new DocumentListService(null, contentService, alfrescoApiService, null, null);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
|
@@ -15,41 +15,32 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TranslationService, AppConfigService, NotificationService } from '@alfresco/adf-core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { FolderActionsService } from './folder-actions.service';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||
|
||||
describe('FolderActionsService', () => {
|
||||
|
||||
let service: FolderActionsService;
|
||||
let documentListService: DocumentListService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
FolderActionsService,
|
||||
NodeActionsService,
|
||||
TranslationService,
|
||||
NotificationService,
|
||||
ContentNodeDialogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
service = TestBed.get(FolderActionsService);
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
|
||||
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
|
||||
service = new FolderActionsService(null, documentListService, contentService);
|
||||
});
|
||||
|
||||
it('should register custom action handler', () => {
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { async, discardPeriodicTasks, fakeAsync, ComponentFixture, TestBed, tick } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AuthenticationService, SearchService } from '@alfresco/adf-core';
|
||||
import { ThumbnailService } from '@alfresco/adf-core';
|
||||
@@ -41,9 +40,6 @@ describe('SearchControlComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
SearchControlComponent,
|
||||
SearchComponent,
|
||||
@@ -271,7 +267,7 @@ describe('SearchControlComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should close the autocomplete when user press ESCAPE', async(() => {
|
||||
it('should close the autocomplete when user press ESCAPE', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
fixture.detectChanges();
|
||||
@@ -290,11 +286,12 @@ describe('SearchControlComponent', () => {
|
||||
fixture.detectChanges();
|
||||
resultElement = <HTMLElement> element.querySelector('#result_option_0');
|
||||
expect(resultElement).toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should close the autocomplete when user press ENTER on input', async(() => {
|
||||
it('should close the autocomplete when user press ENTER on input', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
fixture.detectChanges();
|
||||
@@ -313,9 +310,10 @@ describe('SearchControlComponent', () => {
|
||||
fixture.detectChanges();
|
||||
resultElement = <HTMLElement> element.querySelector('#result_option_0');
|
||||
expect(resultElement).toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should focus input element when autocomplete list is cancelled', async(() => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
@@ -383,7 +381,7 @@ describe('SearchControlComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should focus the input search when ARROW UP is pressed on the first list item', async(() => {
|
||||
it('should focus the input search when ARROW UP is pressed on the first list item', (done) => {
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
fixture.detectChanges();
|
||||
let inputDebugElement = debugElement.query(By.css('#adf-control-input'));
|
||||
@@ -404,9 +402,10 @@ describe('SearchControlComponent', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(document.activeElement.id).toBe('adf-control-input');
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -509,7 +508,7 @@ describe('SearchControlComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should set deactivate the search after element is clicked', async(() => {
|
||||
it('should set deactivate the search after element is clicked', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
component.optionClicked.subscribe((item) => {
|
||||
@@ -525,8 +524,9 @@ describe('SearchControlComponent', () => {
|
||||
fixture.detectChanges();
|
||||
let firstOption: DebugElement = debugElement.query(By.css('#result_name_0'));
|
||||
firstOption.triggerEventHandler('click', null);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should NOT reset the search term after element is clicked', async(() => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DropdownSitesComponent } from './sites-dropdown.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -34,9 +33,6 @@ describe('DropdownSitesComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
DropdownSitesComponent
|
||||
]
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { LikeComponent } from './like.component';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { RatingService } from './services/rating.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -30,7 +29,6 @@ describe('Like component', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ MaterialModule ],
|
||||
declarations: [ LikeComponent ],
|
||||
providers: [ RatingService ]
|
||||
}).compileComponents();
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { RatingComponent } from './rating.component';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { RatingService } from './services/rating.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -30,9 +29,7 @@ describe('Rating component', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
RatingComponent
|
||||
],
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||
import { RatingService } from './rating.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -24,17 +24,8 @@ describe('Rating service', () => {
|
||||
|
||||
let service;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
RatingService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(RatingService);
|
||||
service = new RatingService(new AlfrescoApiService(new AppConfigService(null), new StorageService()));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||
import { TagService } from './tag.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -25,22 +24,8 @@ describe('TagService', () => {
|
||||
|
||||
let service: TagService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule
|
||||
],
|
||||
providers: [
|
||||
TagService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
service = TestBed.get(TagService);
|
||||
service = new TagService(new AlfrescoApiService(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null)));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -53,58 +38,6 @@ describe('TagService', () => {
|
||||
|
||||
describe('Content tests', () => {
|
||||
|
||||
it('removeTag should perform a call against the server', (done) => {
|
||||
service.removeTag('fake-node-id', 'fake-tag').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/fake-tag');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('addTag should perform a call against the server', (done) => {
|
||||
service.addTag('fake-node-id', 'fake-tag').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getAllTheTags should perform a call against the server', (done) => {
|
||||
service.getAllTheTags().subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/tags');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getTagsByNodeId should perform a call against the server', (done) => {
|
||||
service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getTagsByNodeId catch errors call', (done) => {
|
||||
service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
||||
}, () => {
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TagActionsComponent } from './tag-actions.component';
|
||||
import { TagService } from './services/tag.service';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -31,10 +30,6 @@ describe('TagActionsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
declarations: [
|
||||
TagActionsComponent
|
||||
],
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TagService } from './services/tag.service';
|
||||
import { TagListComponent } from '././tag-list.component';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -48,10 +47,6 @@ describe('TagList', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
declarations: [
|
||||
TagListComponent
|
||||
],
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TagNodeListComponent } from './tag-node-list.component';
|
||||
import { TagService } from './services/tag.service';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -48,10 +47,7 @@ describe('TagNodeList', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
TagNodeListComponent
|
||||
],
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { ContentService, UploadService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { UploadButtonComponent } from './upload-button.component';
|
||||
@@ -50,9 +49,6 @@ describe('UploadButtonComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
UploadButtonComponent
|
||||
],
|
||||
|
@@ -18,9 +18,8 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { VersionListComponent } from './version-list.component';
|
||||
import { AlfrescoApiService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
|
||||
describe('VersionListComponent', () => {
|
||||
let component: VersionListComponent;
|
||||
@@ -31,10 +30,6 @@ describe('VersionListComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
VersionListComponent
|
||||
],
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { WebscriptComponent } from './webscript.component';
|
||||
|
||||
@@ -31,7 +31,6 @@ describe('WebscriptComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
|
@@ -80,7 +80,6 @@ describe('DataTable', () => {
|
||||
[new ObjectDataColumn({ key: 'name' })]
|
||||
);
|
||||
|
||||
|
||||
dataTable.ngOnChanges({
|
||||
data: new SimpleChange(null, newData, false)
|
||||
});
|
||||
|
@@ -72,7 +72,7 @@ describe('Test PdfViewer component', () => {
|
||||
'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' +
|
||||
'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
|
||||
'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G');
|
||||
return new Blob([pdfData], {type: 'application/pdf'});
|
||||
return new Blob([pdfData], { type: 'application/pdf' });
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -183,22 +183,23 @@ describe('Test PdfViewer component', () => {
|
||||
|
||||
describe('User interaction', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async(() => {
|
||||
component.urlFile = require('../assets/fake-test-file.pdf');
|
||||
fixture.detectChanges();
|
||||
component.inputPage('1');
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
component.inputPage('1');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should Total number of pages be loaded', (done) => {
|
||||
component.ngOnChanges(null).then(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
|
||||
expect(component.totalPages).toEqual(6);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
it('should right arrow move to the next page', (done) => {
|
||||
component.ngOnChanges(null).then(() => {
|
||||
@@ -210,9 +211,8 @@ describe('Test PdfViewer component', () => {
|
||||
expect(component.displayPage).toBe(2);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
it('should nextPage move to the next page', (done) => {
|
||||
let nextPageButton: any = element.querySelector('#viewer-next-page-button');
|
||||
@@ -230,7 +230,7 @@ describe('Test PdfViewer component', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should left arrow move to the previous page', (done) => {
|
||||
it('should event keyboard change pages', (done) => {
|
||||
component.ngOnChanges(null).then(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -292,62 +292,70 @@ describe('Test PdfViewer component', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Zoom', () => {
|
||||
describe('Zoom', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async(() => {
|
||||
component.urlFile = require('../assets/fake-test-file.pdf');
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
component.inputPage('1');
|
||||
component.currentScale = 1;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should zoom in increment the scale value', (done) => {
|
||||
let zoomInButton: any = element.querySelector('#viewer-zoom-in-button');
|
||||
it('should zoom in increment the scale value', (done) => {
|
||||
let zoomInButton: any = element.querySelector('#viewer-zoom-in-button');
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
let zoomBefore = component.currentScale;
|
||||
zoomInButton.click();
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
let currentZoom = component.currentScale;
|
||||
expect(zoomBefore < currentZoom).toBe(true);
|
||||
done();
|
||||
});
|
||||
component.ngOnChanges(null).then(() => {
|
||||
let zoomBefore = component.currentScale;
|
||||
zoomInButton.click();
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
let currentZoom = component.currentScale;
|
||||
expect(zoomBefore < currentZoom).toBe(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should zoom out decrement the scale value', (done) => {
|
||||
let zoomOutButton: any = element.querySelector('#viewer-zoom-out-button');
|
||||
it('should zoom out decrement the scale value', (done) => {
|
||||
let zoomOutButton: any = element.querySelector('#viewer-zoom-out-button');
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
let zoomBefore = component.currentScale;
|
||||
zoomOutButton.click();
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
let currentZoom = component.currentScale;
|
||||
expect(zoomBefore > currentZoom).toBe(true);
|
||||
done();
|
||||
});
|
||||
component.ngOnChanges(null).then(() => {
|
||||
let zoomBefore = component.currentScale;
|
||||
zoomOutButton.click();
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
let currentZoom = component.currentScale;
|
||||
expect(zoomBefore > currentZoom).toBe(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should fit-in button toggle page-fit and auto scale mode', (done) => {
|
||||
let fitPage: any = element.querySelector('#viewer-scale-page-button');
|
||||
it('should fit-in button toggle page-fit and auto scale mode', (done) => {
|
||||
let fitPage: any = element.querySelector('#viewer-scale-page-button');
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
fitPage.click();
|
||||
expect(component.currentScaleMode).toBe('page-fit');
|
||||
fitPage.click();
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
done();
|
||||
});
|
||||
}, 5000);
|
||||
component.ngOnChanges(null).then(() => {
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
fitPage.click();
|
||||
expect(component.currentScaleMode).toBe('page-fit');
|
||||
fitPage.click();
|
||||
expect(component.currentScaleMode).toBe('auto');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Resize interaction', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async(() => {
|
||||
component.urlFile = require('../assets/fake-test-file.pdf');
|
||||
fixture.detectChanges();
|
||||
component.inputPage('1');
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
component.inputPage('1');
|
||||
component.currentScale = 1;
|
||||
});
|
||||
}));
|
||||
|
||||
it('should resize event trigger setScaleUpdatePages', (done) => {
|
||||
component.ngOnChanges(null).then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -364,10 +372,15 @@ describe('Test PdfViewer component', () => {
|
||||
|
||||
describe('scroll interaction', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async(() => {
|
||||
component.urlFile = require('../assets/fake-test-file.pdf');
|
||||
fixture.detectChanges();
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
component.inputPage('1');
|
||||
component.currentScale = 1;
|
||||
});
|
||||
}));
|
||||
|
||||
it('should scroll page return the current page', (done) => {
|
||||
component.ngOnChanges(null).then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -390,17 +403,19 @@ describe('Test PdfViewer component', () => {
|
||||
});
|
||||
|
||||
describe('Thumbnails', () => {
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
component.urlFile = require('../assets/fake-test-file.pdf');
|
||||
component.showThumbnails = false;
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
component.inputPage('1');
|
||||
});
|
||||
});
|
||||
|
||||
it('should have own context', (done) => {
|
||||
component.ngOnChanges(null).then(() => {
|
||||
fixture.detectChanges();
|
||||
return fixture.whenStable().then(() => {
|
||||
fixture.whenStable().then(() => {
|
||||
expect(component.pdfThumbnailsContext.viewer).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
@@ -412,7 +427,7 @@ describe('Test PdfViewer component', () => {
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
fixture.detectChanges();
|
||||
return fixture.whenStable().then(() => {
|
||||
fixture.whenStable().then(() => {
|
||||
component.toggleThumbnails();
|
||||
fixture.detectChanges();
|
||||
|
||||
|
@@ -18,8 +18,6 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ChartsModule } from 'ng2-charts';
|
||||
|
||||
import { MaterialModule } from '../../material.module';
|
||||
|
||||
import { DiagramsModule } from '../../diagram/diagram.module';
|
||||
import { Chart } from '../../diagram/models/chart/chart.model';
|
||||
import { ReportQuery } from '../../diagram/models/report/reportQuery.model';
|
||||
@@ -37,7 +35,6 @@ describe('AnalyticsGeneratorComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
ChartsModule,
|
||||
DiagramsModule,
|
||||
AnalyticsProcessModule
|
||||
|
@@ -19,7 +19,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DiagramsModule } from '../../diagram/diagram.module';
|
||||
import { AnalyticsReportHeatMapComponent } from '../components/analytics-report-heat-map.component';
|
||||
import { AnalyticsProcessModule } from '../analytics-process.module';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -41,7 +40,6 @@ describe('AnalyticsReportHeatMapComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DiagramsModule,
|
||||
MaterialModule,
|
||||
AnalyticsProcessModule
|
||||
]
|
||||
}).compileComponents();
|
||||
|
@@ -19,7 +19,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DiagramsModule } from '../../diagram/diagram.module';
|
||||
import { AnalyticsProcessModule } from '../analytics-process.module';
|
||||
import { AnalyticsReportListComponent } from '../components/analytics-report-list.component';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { ReportParametersModel } from '../../diagram/models/report/reportParameters.model';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -43,7 +42,6 @@ describe('AnalyticsReportListComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
DiagramsModule,
|
||||
AnalyticsProcessModule
|
||||
]
|
||||
|
@@ -21,7 +21,6 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
|
||||
import * as analyticParamsMock from '../../mock';
|
||||
import { AnalyticsReportParametersComponent } from '../components/analytics-report-parameters.component';
|
||||
import { AnalyticsProcessModule } from '../analytics-process.module';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -34,7 +33,6 @@ describe('AnalyticsReportParametersComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
AnalyticsProcessModule
|
||||
]
|
||||
}).compileComponents();
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { DiagramsService } from './diagrams.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -27,9 +27,6 @@ describe('DiagramsService', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule
|
||||
],
|
||||
providers: [
|
||||
DiagramsService
|
||||
]
|
||||
|
@@ -18,10 +18,9 @@
|
||||
import { DebugElement, Component } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AppsProcessService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppsProcessService } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { defaultApp, deployedApps, nonDeployedApps } from '../mock/apps-list.mock';
|
||||
import { AppsListComponent } from './apps-list.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -37,8 +36,6 @@ describe('AppsListComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
MaterialModule,
|
||||
TranslateModule
|
||||
],
|
||||
declarations: [
|
||||
@@ -273,9 +270,6 @@ describe('Custom CustomEmptyAppListTemplateComponent', () => {
|
||||
declarations: [
|
||||
AppsListComponent,
|
||||
CustomEmptyAppListTemplateComponent
|
||||
],
|
||||
imports: [
|
||||
MaterialModule
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
@@ -20,7 +20,6 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
@@ -70,7 +69,6 @@ describe('Select app dialog', () => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
BrowserDynamicTestingModule
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { ProcessContentService } from '@alfresco/adf-core';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { CreateProcessAttachmentComponent } from './create-process-attachment.component';
|
||||
@@ -51,7 +50,6 @@ describe('Activiti Process Create Attachment', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
CreateProcessAttachmentComponent
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { ProcessContentService } from '@alfresco/adf-core';
|
||||
@@ -33,7 +32,6 @@ describe('Activiti Task Create Attachment', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
AttachmentComponent
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { NgZone, SimpleChange, Component } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatProgressSpinnerModule } from '@angular/material';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { ProcessContentService } from '@alfresco/adf-core';
|
||||
@@ -325,7 +324,6 @@ describe('Custom CustomEmptyTemplateComponent', () => {
|
||||
CustomEmptyTemplateComponent
|
||||
],
|
||||
imports: [
|
||||
MaterialModule
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { SimpleChange, Component } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { TaskAttachmentListComponent } from './task-attachment-list.component';
|
||||
import { ProcessContentService } from '@alfresco/adf-core';
|
||||
@@ -35,9 +34,6 @@ describe('TaskAttachmentList', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
TaskAttachmentListComponent
|
||||
],
|
||||
@@ -327,9 +323,6 @@ describe('Custom CustomEmptyTemplateComponent', () => {
|
||||
declarations: [
|
||||
TaskAttachmentListComponent,
|
||||
CustomEmptyTemplateComponent
|
||||
],
|
||||
imports: [
|
||||
MaterialModule
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
@@ -33,7 +33,6 @@ import {
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeDialogService, DocumentListService } from '@alfresco/adf-content-services';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
|
||||
@@ -105,7 +104,6 @@ describe('AttachFileWidgetComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MaterialModule],
|
||||
declarations: [AttachFileWidgetComponent],
|
||||
providers: [
|
||||
FormService,
|
||||
|
@@ -29,7 +29,6 @@ import {
|
||||
NodesApiService
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeDialogService, DocumentListService } from '@alfresco/adf-content-services';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
|
||||
@@ -59,7 +58,6 @@ describe('AttachFolderWidgetComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MaterialModule],
|
||||
declarations: [AttachFolderWidgetComponent],
|
||||
providers: [
|
||||
FormService,
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { DebugElement, NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@@ -39,7 +38,6 @@ describe('ProcessInstanceDetailsComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
FormModule,
|
||||
TaskListModule
|
||||
],
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CardViewUpdateService } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
|
||||
import { ProcessInstance } from '../models/process-instance.model';
|
||||
import { exampleProcess } from '../../mock';
|
||||
@@ -32,9 +31,6 @@ describe('ProcessInstanceHeaderComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
ProcessInstanceHeaderComponent
|
||||
],
|
||||
|
@@ -20,7 +20,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListService } from '../services/tasklist.service';
|
||||
import { ChecklistComponent } from './checklist.component';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -40,7 +39,6 @@ describe('ChecklistComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
TranslateModule
|
||||
],
|
||||
declarations: [
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { TranslationService, TranslationMock } from '@alfresco/adf-core';
|
||||
import { PeopleSelectorComponent, PeopleSearchFieldComponent, PeopleListComponent } from '../../people';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
@@ -47,9 +46,6 @@ describe('StartTaskComponent', () => {
|
||||
let testUser = {id: 1001, firstName: 'fakeName', email: 'fake@app.activiti.com'};
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
StartTaskComponent,
|
||||
PeopleSearchFieldComponent,
|
||||
|
@@ -22,7 +22,6 @@ import { Observable } from 'rxjs/Observable';
|
||||
import { FilterParamsModel, FilterRepresentationModel } from '../models/filter.model';
|
||||
import { TaskListService } from '../services/tasklist.service';
|
||||
import { TaskFilterService } from '../services/task-filter.service';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { TaskFiltersComponent } from './task-filters.component';
|
||||
|
||||
describe('TaskFiltersComponent', () => {
|
||||
@@ -65,9 +64,6 @@ describe('TaskFiltersComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
TaskFiltersComponent
|
||||
],
|
||||
|
@@ -19,7 +19,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CardViewUpdateService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { BpmUserService } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import {
|
||||
completedTaskDetailsMock,
|
||||
@@ -27,7 +26,8 @@ import {
|
||||
claimableTaskDetailsMock,
|
||||
claimedTaskDetailsMock,
|
||||
claimedByGroupMemberMock,
|
||||
taskDetailsWithOutCandidateGroup } from '../../mock';
|
||||
taskDetailsWithOutCandidateGroup
|
||||
} from '../../mock';
|
||||
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListService } from './../services/tasklist.service';
|
||||
@@ -57,9 +57,6 @@ describe('TaskHeaderComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
TaskHeaderComponent
|
||||
],
|
||||
@@ -82,236 +79,303 @@ describe('TaskHeaderComponent', () => {
|
||||
appConfigService = TestBed.get(AppConfigService);
|
||||
});
|
||||
|
||||
it('should render empty component if no task details provided', () => {
|
||||
it('should render empty component if no task details provided', async(() => {
|
||||
component.taskDetails = undefined;
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.children.length).toBe(0);
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display assignee', () => {
|
||||
component.ngOnChanges({});
|
||||
it('should display assignee', async(() => {
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-property-value'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
|
||||
});
|
||||
|
||||
it('should display placeholder if no assignee', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-property-value'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display placeholder if no assignee', async(() => {
|
||||
component.taskDetails.assignee = null;
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT');
|
||||
});
|
||||
|
||||
it('should display created-by', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT');
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
it('should display created-by', async(() => {
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-created-by"] .adf-property-value'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
|
||||
});
|
||||
|
||||
it('should display priority', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-created-by"] .adf-property-value'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display priority', async(() => {
|
||||
component.taskDetails.priority = 27;
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('27');
|
||||
});
|
||||
|
||||
it('should set editable to false if the task has already completed', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
|
||||
expect(formNameEl.nativeElement.innerText).toBe('27');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should set editable to false if the task has already completed', async(() => {
|
||||
component.taskDetails.endDate = new Date('05/05/2002');
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
|
||||
let datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
|
||||
expect(datePicker).toBeNull('Datepicker should NOT be in DOM');
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
let datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
|
||||
expect(datePicker).toBeNull('Datepicker should NOT be in DOM');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should set editable to true if the task has not completed yet', () => {
|
||||
it('should set editable to true if the task has not completed yet', async(() => {
|
||||
component.taskDetails.endDate = undefined;
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
|
||||
let datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
|
||||
expect(datePicker).not.toBeNull('Datepicker should be in DOM');
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
let datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
|
||||
expect(datePicker).not.toBeNull('Datepicker should be in DOM');
|
||||
});
|
||||
}));
|
||||
|
||||
describe('Claiming', () => {
|
||||
|
||||
it('should display the claim button if no assignee', () => {
|
||||
it('should display the claim button if no assignee', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
||||
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display the claim button if the task is claimable', () => {
|
||||
it('should display the claim button if the task is claimable', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
expect(component.isTaskClaimable()).toBeTruthy();
|
||||
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
|
||||
});
|
||||
|
||||
it('should not display the claim/requeue button if the task is not claimable ', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
expect(component.isTaskClaimable()).toBeTruthy();
|
||||
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
it('should not display the claim/requeue button if the task is not claimable ', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutCandidateGroup);
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(component.isTaskClaimable()).toBeFalsy();
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
|
||||
expect(unclaimButton).toBeNull();
|
||||
expect(claimButton).toBeNull();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should display the requeue button if task is claimed by the current logged-in user', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeTruthy();
|
||||
expect(unclaimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.UNCLAIM');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not display the requeue button to logged in user if task is claimed by other candidate member', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(claimedByGroupMemberMock);
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(component.isTaskClaimable()).toBeFalsy();
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
|
||||
expect(unclaimButton).toBeNull();
|
||||
expect(claimButton).toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display the requeue button if task is claimed by the current logged-in user', () => {
|
||||
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeTruthy();
|
||||
expect(unclaimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.UNCLAIM');
|
||||
});
|
||||
|
||||
it('should not display the requeue button to logged in user if task is claimed by other candidate member', () => {
|
||||
component.taskDetails = new TaskDetailsModel(claimedByGroupMemberMock);
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
|
||||
expect(unclaimButton).toBeNull();
|
||||
});
|
||||
|
||||
it('should display the claime button if the task is claimable by candidates members', () => {
|
||||
it('should display the claime button if the task is claimable by candidates members', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
expect(component.isTaskClaimable()).toBeTruthy();
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
|
||||
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
|
||||
});
|
||||
|
||||
it('should not display the requeue button if the task is completed', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
expect(component.isTaskClaimable()).toBeTruthy();
|
||||
expect(component.isTaskClaimedByCandidateMember()).toBeFalsy();
|
||||
expect(claimButton.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.BUTTON.CLAIM');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not display the requeue button if the task is completed', async(() => {
|
||||
component.taskDetails = new TaskDetailsModel(completedTaskDetailsMock);
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(claimButton).toBeNull();
|
||||
expect(unclaimButton).toBeNull();
|
||||
});
|
||||
|
||||
it('should call the service\'s unclaim method on unclaiming', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let claimButton = fixture.debugElement.query(By.css('[data-automation-id="header-claim-button"]'));
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
expect(claimButton).toBeNull();
|
||||
expect(unclaimButton).toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should call the service\'s unclaim method on unclaiming', async(() => {
|
||||
spyOn(service, 'unclaimTask');
|
||||
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
unclaimButton.triggerEventHandler('click', {});
|
||||
fixture.whenStable().then(() => {
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
unclaimButton.triggerEventHandler('click', {});
|
||||
|
||||
expect(service.unclaimTask).toHaveBeenCalledWith('91');
|
||||
});
|
||||
expect(service.unclaimTask).toHaveBeenCalledWith('91');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should trigger the unclaim event on successfull unclaiming', () => {
|
||||
it('should trigger the unclaim event on successfull unclaiming', async(() => {
|
||||
let unclaimed: boolean = false;
|
||||
spyOn(service, 'unclaimTask').and.returnValue(Observable.of(true));
|
||||
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
component.unclaim.subscribe(() => { unclaimed = true; });
|
||||
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
unclaimButton.triggerEventHandler('click', {});
|
||||
fixture.whenStable().then(() => {
|
||||
component.unclaim.subscribe(() => {
|
||||
unclaimed = true;
|
||||
});
|
||||
|
||||
expect(unclaimed).toBeTruthy();
|
||||
});
|
||||
let unclaimButton = fixture.debugElement.query(By.css('[data-automation-id="header-unclaim-button"]'));
|
||||
unclaimButton.triggerEventHandler('click', {});
|
||||
|
||||
it('should display due date', () => {
|
||||
expect(unclaimed).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display due date', async(() => {
|
||||
component.taskDetails.dueDate = new Date('2016-11-03');
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('Nov 03 2016');
|
||||
});
|
||||
|
||||
it('should display placeholder if no due date', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('Nov 03 2016');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display placeholder if no due date', async(() => {
|
||||
component.taskDetails.dueDate = null;
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('ADF_TASK_LIST.PROPERTIES.DUE_DATE_DEFAULT');
|
||||
});
|
||||
|
||||
it('should display form name', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toBe('ADF_TASK_LIST.PROPERTIES.DUE_DATE_DEFAULT');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display form name', async(() => {
|
||||
component.formName = 'test form';
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('test form');
|
||||
});
|
||||
|
||||
it('should display the default parent value if is undefined', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('test form');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display the default parent value if is undefined', async(() => {
|
||||
component.taskDetails.processInstanceId = null;
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toEqual('ADF_TASK_LIST.PROPERTIES.PARENT_NAME_DEFAULT');
|
||||
});
|
||||
|
||||
it('should display the Parent name value', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toEqual('ADF_TASK_LIST.PROPERTIES.PARENT_NAME_DEFAULT');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display the Parent name value', async(() => {
|
||||
component.taskDetails.processInstanceId = '1';
|
||||
component.taskDetails.processDefinitionName = 'Parent Name';
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toEqual('Parent Name');
|
||||
});
|
||||
|
||||
it('should not display form name if no form name provided', () => {
|
||||
component.ngOnChanges({});
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText.trim()).toEqual('Parent Name');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not display form name if no form name provided', async(() => {
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
|
||||
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
|
||||
});
|
||||
}));
|
||||
|
||||
describe('Config Filtering', () => {
|
||||
|
||||
it('should show only the properties from the configuration file', () => {
|
||||
it('should show only the properties from the configuration file', async(() => {
|
||||
spyOn(appConfigService, 'get').and.returnValue(['assignee', 'status']);
|
||||
component.taskDetails.processInstanceId = '1';
|
||||
component.taskDetails.processDefinitionName = 'Parent Name';
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
|
||||
expect(propertyList).toBeDefined();
|
||||
expect(propertyList).not.toBeNull();
|
||||
expect(propertyList.length).toBe(2);
|
||||
expect(propertyList[0].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.ASSIGNEE');
|
||||
expect(propertyList[1].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.STATUS');
|
||||
});
|
||||
|
||||
it('should show all the default properties if there is no configuration', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
expect(propertyList).toBeDefined();
|
||||
expect(propertyList).not.toBeNull();
|
||||
expect(propertyList.length).toBe(2);
|
||||
expect(propertyList[0].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.ASSIGNEE');
|
||||
expect(propertyList[1].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.STATUS');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show all the default properties if there is no configuration', async(() => {
|
||||
spyOn(appConfigService, 'get').and.returnValue(null);
|
||||
component.taskDetails.processInstanceId = '1';
|
||||
component.taskDetails.processDefinitionName = 'Parent Name';
|
||||
component.ngOnChanges({});
|
||||
component.refreshData();
|
||||
fixture.detectChanges();
|
||||
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
|
||||
expect(propertyList).toBeDefined();
|
||||
expect(propertyList).not.toBeNull();
|
||||
expect(propertyList.length).toBe(component.properties.length);
|
||||
expect(propertyList[0].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.ASSIGNEE');
|
||||
expect(propertyList[1].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.STATUS');
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let propertyList = fixture.debugElement.queryAll(By.css('.adf-property-list .adf-property'));
|
||||
expect(propertyList).toBeDefined();
|
||||
expect(propertyList).not.toBeNull();
|
||||
expect(propertyList.length).toBe(component.properties.length);
|
||||
expect(propertyList[0].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.ASSIGNEE');
|
||||
expect(propertyList[1].nativeElement.textContent).toContain('ADF_TASK_LIST.PROPERTIES.STATUS');
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { DataRowEvent, ObjectDataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
|
||||
import { TaskListService } from '../services/tasklist.service';
|
||||
@@ -128,9 +127,7 @@ describe('TaskListComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
TaskListComponent
|
||||
],
|
||||
|
Reference in New Issue
Block a user