mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +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:
@@ -20,7 +20,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PathElementEntity } from 'alfresco-js-api';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { fakeNodeWithCreatePermission } from '../mock';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DocumentListService, DocumentListComponent } from '../document-list';
|
||||
import { BreadcrumbComponent } from './breadcrumb.component';
|
||||
|
||||
@@ -35,8 +34,7 @@ describe('Breadcrumb', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent,
|
||||
|
@@ -20,7 +20,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { fakeNodeWithCreatePermission } from '../mock';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DocumentListComponent, DocumentListService } from '../document-list';
|
||||
import { DropdownBreadcrumbComponent } from './dropdown-breadcrumb.component';
|
||||
|
||||
@@ -33,8 +32,7 @@ describe('DropdownBreadcrumb', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent,
|
||||
|
@@ -29,7 +29,6 @@ import {
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { EmptyFolderContentDirective, DocumentListComponent, DocumentListService } from '../document-list';
|
||||
import { DropdownSitesComponent } from '../site-dropdown';
|
||||
import { DropdownBreadcrumbComponent } from '../breadcrumb';
|
||||
@@ -78,8 +77,7 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
function setupTestbed(plusProviders) {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent,
|
||||
|
@@ -23,7 +23,6 @@ import { ContentNodeSelectorComponent } from './content-node-selector.component'
|
||||
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
||||
import { ContentNodeSelectorService } from './content-node-selector.service';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import {
|
||||
EmptyFolderContentDirective,
|
||||
@@ -41,7 +40,6 @@ describe('ContentNodeSelectorDialogComponent', () => {
|
||||
function setupTestbed(plusProviders) {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
ContentNodeSelectorComponent,
|
||||
|
@@ -19,7 +19,6 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatDialogRef } from '@angular/material';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@@ -42,7 +41,6 @@ describe('FolderDialogComponent', () => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
BrowserDynamicTestingModule
|
||||
|
@@ -21,7 +21,6 @@ import { MatDialog } from '@angular/material';
|
||||
import { Component, DebugElement } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DialogModule } from '../dialogs/dialog.module';
|
||||
import { NodeDownloadDirective } from './node-download.directive';
|
||||
|
||||
@@ -44,8 +43,7 @@ describe('NodeDownloadDirective', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DialogModule,
|
||||
MaterialModule
|
||||
DialogModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent,
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { ContentActionModel } from './../../models/content-action.model';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
@@ -32,8 +31,7 @@ describe('ContentColumnList', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -20,7 +20,6 @@ import { EventEmitter } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { ContentService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { FileNode } from '../../../mock';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { ContentActionHandler } from './../../models/content-action.model';
|
||||
@@ -45,8 +44,7 @@ describe('ContentAction', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
providers: [
|
||||
DocumentListService
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataColumn, DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
@@ -34,8 +33,7 @@ describe('ContentColumnList', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -19,7 +19,6 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { ContentColumnListComponent } from './content-column-list.component';
|
||||
@@ -34,8 +33,7 @@ describe('ContentColumn', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -31,7 +31,6 @@ import {
|
||||
fakeGetSitesAnswer,
|
||||
fakeGetSiteMembership
|
||||
} from '../../mock';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { ContentActionModel } from '../models/content-action.model';
|
||||
import { NodeMinimal, NodeMinimalEntry, NodePaging } from '../models/document-library.model';
|
||||
import { ImageResolver } from './../data/image-resolver.model';
|
||||
@@ -56,8 +55,7 @@ describe('DocumentList', () => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent, DataTableModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
@@ -32,8 +31,7 @@ describe('EmptyFolderContent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MaterialModule
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
|
@@ -19,7 +19,6 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { MatProgressSpinnerModule } from '@angular/material';
|
||||
import { DataTableComponent, DataTableModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { MaterialModule } from '../../../material.module';
|
||||
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { NoPermissionContentDirective } from './no-permission-content.directive';
|
||||
@@ -32,7 +31,6 @@ describe('NoPermissionContentDirective', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
DataTableModule,
|
||||
MatProgressSpinnerModule
|
||||
],
|
||||
|
@@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataColumn, DataRow, DataSorting } from '@alfresco/adf-core';
|
||||
import { DataColumn, DataRow, DataSorting, ContentService } from '@alfresco/adf-core';
|
||||
import { FileNode, FolderNode } from './../../mock';
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
import { ShareDataRow } from './share-data-row.model';
|
||||
@@ -26,17 +25,11 @@ describe('ShareDataTableAdapter', () => {
|
||||
|
||||
let documentListService: DocumentListService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
let imageUrl: string = 'http://<addresss>';
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
documentListService = new DocumentListService(null, contentService, null, null, null);
|
||||
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
|
||||
});
|
||||
|
||||
it('should setup rows and columns with constructor', () => {
|
||||
@@ -194,13 +187,15 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should generate fallback icon for a file thumbnail with missing mime type', () => {
|
||||
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneouse.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
file.entry.content.mimeType = null;
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_miscellaneous`);
|
||||
@@ -208,13 +203,15 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should generate fallback icon for a file with no content entry', () => {
|
||||
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneouse.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
file.entry.content = null;
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_miscellaneous`);
|
||||
@@ -229,17 +226,19 @@ describe('ShareDataTableAdapter', () => {
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: 'icon'};
|
||||
let col = <DataColumn> { type: 'image', key: 'icon' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toBe(imageUrl);
|
||||
});
|
||||
|
||||
it('should resolve folder icon', () => {
|
||||
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let row = new ShareDataRow(new FolderNode(), documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_folder`);
|
||||
@@ -247,15 +246,13 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should resolve file thumbnail', () => {
|
||||
let imageUrl: string = 'http://<addresss>';
|
||||
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
|
||||
|
||||
let imageUrl = 'http://<addresss>';
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
adapter.thumbnails = true;
|
||||
|
||||
let file = new FileNode();
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toBe(imageUrl);
|
||||
@@ -263,6 +260,8 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should resolve fallback file icon for unknown node', () => {
|
||||
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
|
||||
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
@@ -271,7 +270,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
file.entry.content = null;
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_miscellaneous`);
|
||||
@@ -279,6 +278,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should resolve file icon for content type', () => {
|
||||
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_raster_image.svg`);
|
||||
let adapter = new ShareDataTableAdapter(documentListService, null);
|
||||
|
||||
let file = new FileNode();
|
||||
@@ -287,7 +287,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
file.entry.content.mimeType = 'image/png';
|
||||
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
let col = <DataColumn> {type: 'image', key: '$thumbnail'};
|
||||
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
|
||||
|
||||
let value = adapter.getValue(row, col);
|
||||
expect(value).toContain(`assets/images/ft_ic_raster_image`);
|
||||
@@ -299,7 +299,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
let file2 = new FileNode('file2');
|
||||
let folder = new FolderNode();
|
||||
|
||||
let col = <DataColumn> {key: 'name'};
|
||||
let col = <DataColumn> { key: 'name' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
adapter.setSorting(new DataSorting('name', 'asc'));
|
||||
|
||||
@@ -322,7 +322,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
let file2 = new FileNode('file2');
|
||||
file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2);
|
||||
|
||||
let col = <DataColumn> {key: 'dateProp'};
|
||||
let col = <DataColumn> { key: 'dateProp' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
|
||||
adapter.setRows([
|
||||
@@ -352,7 +352,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
file3.entry.content.sizeInBytes = 4224120; // 4.03 MB
|
||||
file4.entry.content.sizeInBytes = 2852791665; // 2.66 GB
|
||||
|
||||
let col = <DataColumn> {key: 'content.sizeInBytes'};
|
||||
let col = <DataColumn> { key: 'content.sizeInBytes' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
|
||||
adapter.setRows([
|
||||
@@ -385,7 +385,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
let file5 = new FileNode('a');
|
||||
let file6 = new FileNode('b');
|
||||
|
||||
let col = <DataColumn> {key: 'name'};
|
||||
let col = <DataColumn> { key: 'name' };
|
||||
let adapter = new ShareDataTableAdapter(documentListService, [col]);
|
||||
|
||||
adapter.setRows([
|
||||
@@ -415,71 +415,57 @@ describe('ShareDataTableAdapter', () => {
|
||||
expect((<ShareDataRow> rows[4]).node).toBe(file6);
|
||||
expect((<ShareDataRow> rows[5]).node).toBe(file5);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ShareDataRow', () => {
|
||||
describe('ShareDataRow', () => {
|
||||
|
||||
let documentListService: DocumentListService;
|
||||
it('should wrap node', () => {
|
||||
let file = new FileNode();
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.node).toBe(file);
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
it('should require object source', () => {
|
||||
expect(() => {
|
||||
return new ShareDataRow(null, documentListService, null);
|
||||
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
});
|
||||
it('should resolve value from node entry', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.getValue('name')).toBe('test');
|
||||
});
|
||||
|
||||
it('should wrap node', () => {
|
||||
let file = new FileNode();
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.node).toBe(file);
|
||||
});
|
||||
it('should check value', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should require object source', () => {
|
||||
expect(() => {
|
||||
return new ShareDataRow(null, documentListService, null);
|
||||
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
|
||||
});
|
||||
expect(row.hasValue('name')).toBeTruthy();
|
||||
expect(row.hasValue('missing')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should resolve value from node entry', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.getValue('name')).toBe('test');
|
||||
});
|
||||
it('should be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
file.entry['allowableOperations'] = ['create'];
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should check value', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.isDropTarget).toBeTruthy();
|
||||
});
|
||||
|
||||
expect(row.hasValue('name')).toBeTruthy();
|
||||
expect(row.hasValue('missing')).toBeFalsy();
|
||||
});
|
||||
it('should not be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
file.entry['allowableOperations'] = ['create'];
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
expect(row.isDropTarget).toBeTruthy();
|
||||
});
|
||||
it('should not be set as drop target when element is not a Folder', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
it('should not be set as drop target when user has permission for that node', () => {
|
||||
let file = new FolderNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not be set as drop target when element is not a Folder', () => {
|
||||
let file = new FileNode('test');
|
||||
let row = new ShareDataRow(file, documentListService, null);
|
||||
|
||||
expect(row.isDropTarget).toBeFalsy();
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -15,16 +15,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { DocumentListModule } from '../document-list.module';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { DocumentActionsService } from './document-actions.service';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
import { DialogModule } from '../../dialogs/dialog.module';
|
||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
describe('DocumentActionsService', () => {
|
||||
@@ -33,22 +34,12 @@ describe('DocumentActionsService', () => {
|
||||
let documentListService: DocumentListService;
|
||||
let nodeActionsService: NodeActionsService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DialogModule,
|
||||
DocumentListModule
|
||||
],
|
||||
providers: [
|
||||
ContentNodeDialogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
nodeActionsService = TestBed.get(NodeActionsService);
|
||||
service = TestBed.get(DocumentActionsService);
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
|
||||
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
|
||||
|
||||
service = new DocumentActionsService(null, documentListService, contentService);
|
||||
});
|
||||
|
||||
it('should register default download action', () => {
|
||||
|
@@ -15,9 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { CookieService, LogService } from '@alfresco/adf-core';
|
||||
import { CookieServiceMock } from '@alfresco/adf-core';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -87,19 +90,10 @@ describe('DocumentListService', () => {
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
LogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(DocumentListService);
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
|
||||
service = new DocumentListService(null, contentService, alfrescoApiService, null, null);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
|
@@ -15,41 +15,32 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TranslationService, AppConfigService, NotificationService } from '@alfresco/adf-core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService
|
||||
} from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { FolderActionsService } from './folder-actions.service';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||
|
||||
describe('FolderActionsService', () => {
|
||||
|
||||
let service: FolderActionsService;
|
||||
let documentListService: DocumentListService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
FolderActionsService,
|
||||
NodeActionsService,
|
||||
TranslationService,
|
||||
NotificationService,
|
||||
ContentNodeDialogService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
service = TestBed.get(FolderActionsService);
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
let contentService = new ContentService(null, null, null, null);
|
||||
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
|
||||
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
|
||||
service = new FolderActionsService(null, documentListService, contentService);
|
||||
});
|
||||
|
||||
it('should register custom action handler', () => {
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { async, discardPeriodicTasks, fakeAsync, ComponentFixture, TestBed, tick } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AuthenticationService, SearchService } from '@alfresco/adf-core';
|
||||
import { ThumbnailService } from '@alfresco/adf-core';
|
||||
@@ -41,9 +40,6 @@ describe('SearchControlComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
SearchControlComponent,
|
||||
SearchComponent,
|
||||
@@ -271,7 +267,7 @@ describe('SearchControlComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should close the autocomplete when user press ESCAPE', async(() => {
|
||||
it('should close the autocomplete when user press ESCAPE', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
fixture.detectChanges();
|
||||
@@ -290,11 +286,12 @@ describe('SearchControlComponent', () => {
|
||||
fixture.detectChanges();
|
||||
resultElement = <HTMLElement> element.querySelector('#result_option_0');
|
||||
expect(resultElement).toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should close the autocomplete when user press ENTER on input', async(() => {
|
||||
it('should close the autocomplete when user press ENTER on input', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
fixture.detectChanges();
|
||||
@@ -313,9 +310,10 @@ describe('SearchControlComponent', () => {
|
||||
fixture.detectChanges();
|
||||
resultElement = <HTMLElement> element.querySelector('#result_option_0');
|
||||
expect(resultElement).toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should focus input element when autocomplete list is cancelled', async(() => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
@@ -383,7 +381,7 @@ describe('SearchControlComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should focus the input search when ARROW UP is pressed on the first list item', async(() => {
|
||||
it('should focus the input search when ARROW UP is pressed on the first list item', (done) => {
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
fixture.detectChanges();
|
||||
let inputDebugElement = debugElement.query(By.css('#adf-control-input'));
|
||||
@@ -404,9 +402,10 @@ describe('SearchControlComponent', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(document.activeElement.id).toBe('adf-control-input');
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -509,7 +508,7 @@ describe('SearchControlComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should set deactivate the search after element is clicked', async(() => {
|
||||
it('should set deactivate the search after element is clicked', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
spyOn(searchService, 'search').and.returnValue(Observable.of(results));
|
||||
component.optionClicked.subscribe((item) => {
|
||||
@@ -525,8 +524,9 @@ describe('SearchControlComponent', () => {
|
||||
fixture.detectChanges();
|
||||
let firstOption: DebugElement = debugElement.query(By.css('#result_name_0'));
|
||||
firstOption.triggerEventHandler('click', null);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should NOT reset the search term after element is clicked', async(() => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { DropdownSitesComponent } from './sites-dropdown.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -34,9 +33,6 @@ describe('DropdownSitesComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
DropdownSitesComponent
|
||||
]
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { LikeComponent } from './like.component';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { RatingService } from './services/rating.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -30,7 +29,6 @@ describe('Like component', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ MaterialModule ],
|
||||
declarations: [ LikeComponent ],
|
||||
providers: [ RatingService ]
|
||||
}).compileComponents();
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { RatingComponent } from './rating.component';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { RatingService } from './services/rating.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -30,9 +29,7 @@ describe('Rating component', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
RatingComponent
|
||||
],
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||
import { RatingService } from './rating.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -24,17 +24,8 @@ describe('Rating service', () => {
|
||||
|
||||
let service;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [
|
||||
RatingService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(RatingService);
|
||||
service = new RatingService(new AlfrescoApiService(new AppConfigService(null), new StorageService()));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||
import { TagService } from './tag.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
@@ -25,22 +24,8 @@ describe('TagService', () => {
|
||||
|
||||
let service: TagService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule
|
||||
],
|
||||
providers: [
|
||||
TagService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
service = TestBed.get(TagService);
|
||||
service = new TagService(new AlfrescoApiService(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null)));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -53,58 +38,6 @@ describe('TagService', () => {
|
||||
|
||||
describe('Content tests', () => {
|
||||
|
||||
it('removeTag should perform a call against the server', (done) => {
|
||||
service.removeTag('fake-node-id', 'fake-tag').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/fake-tag');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('addTag should perform a call against the server', (done) => {
|
||||
service.addTag('fake-node-id', 'fake-tag').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getAllTheTags should perform a call against the server', (done) => {
|
||||
service.getAllTheTags().subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/tags');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getTagsByNodeId should perform a call against the server', (done) => {
|
||||
service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getTagsByNodeId catch errors call', (done) => {
|
||||
service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
||||
}, () => {
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TagActionsComponent } from './tag-actions.component';
|
||||
import { TagService } from './services/tag.service';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -31,10 +30,6 @@ describe('TagActionsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
declarations: [
|
||||
TagActionsComponent
|
||||
],
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TagService } from './services/tag.service';
|
||||
import { TagListComponent } from '././tag-list.component';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -48,10 +47,6 @@ describe('TagList', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
declarations: [
|
||||
TagListComponent
|
||||
],
|
||||
|
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TagNodeListComponent } from './tag-node-list.component';
|
||||
import { TagService } from './services/tag.service';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -48,10 +47,7 @@ describe('TagNodeList', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
TagNodeListComponent
|
||||
],
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { ContentService, UploadService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { UploadButtonComponent } from './upload-button.component';
|
||||
@@ -50,9 +49,6 @@ describe('UploadButtonComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
UploadButtonComponent
|
||||
],
|
||||
|
@@ -18,9 +18,8 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { VersionListComponent } from './version-list.component';
|
||||
import { AlfrescoApiService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
|
||||
describe('VersionListComponent', () => {
|
||||
let component: VersionListComponent;
|
||||
@@ -31,10 +30,6 @@ describe('VersionListComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
MaterialModule
|
||||
],
|
||||
declarations: [
|
||||
VersionListComponent
|
||||
],
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { WebscriptComponent } from './webscript.component';
|
||||
|
||||
@@ -31,7 +31,6 @@ describe('WebscriptComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
|
Reference in New Issue
Block a user