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