[ADF-1805] rebased documentlist pagination removal (#2668)

* [ADF-1805] rebased documentlist pagination removal

* [ADF-1805] fixed some wrong changes]
This commit is contained in:
Vito
2017-11-20 10:40:05 +00:00
committed by Popovics András
parent 0f0f22634a
commit 141bc0f8b4
12 changed files with 198 additions and 249 deletions

View File

@@ -20,7 +20,7 @@ import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { By } from '@angular/platform-browser';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { ContentService, TranslationService, SearchService, SiteModel, SitesApiService } from '@alfresco/adf-core';
import { ContentService, TranslationService, SearchService, SiteModel, SitesApiService, UserPreferencesService } from '@alfresco/adf-core';
import { DataTableModule } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Rx';
import { MaterialModule } from '../material.module';
@@ -89,6 +89,7 @@ describe('ContentNodeSelectorComponent', () => {
DocumentListService,
SearchService,
ContentNodeSelectorService,
UserPreferencesService,
...plusProviders
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
@@ -164,19 +165,21 @@ describe('ContentNodeSelectorComponent', () => {
describe('Cancel button', () => {
let dummyMdDialogRef;
let fakePreference: UserPreferencesService = <UserPreferencesService> jasmine.createSpyObj('UserPreferencesService', ['paginationSize']);
fakePreference.paginationSize = 10;
beforeEach(() => {
dummyMdDialogRef = <MatDialogRef<ContentNodeSelectorComponent>> { close: () => {} };
});
it('should be shown if dialogRef is injected', () => {
const componentInstance = new ContentNodeSelectorComponent(null, null, data, dummyMdDialogRef);
const componentInstance = new ContentNodeSelectorComponent(null, null, fakePreference, data, dummyMdDialogRef);
expect(componentInstance.inDialog).toBeTruthy();
});
it('should should call the close method in the injected dialogRef', () => {
spyOn(dummyMdDialogRef, 'close');
const componentInstance = new ContentNodeSelectorComponent(null, null, data, dummyMdDialogRef);
const componentInstance = new ContentNodeSelectorComponent(null, null, fakePreference, data, dummyMdDialogRef);
componentInstance.close();
@@ -339,7 +342,7 @@ describe('ContentNodeSelectorComponent', () => {
skipCount,
rootNodeId,
nodeType: 'cm:folder',
maxItems: 10,
maxItems: 25,
orderBy: null
};
}
@@ -524,7 +527,7 @@ describe('ContentNodeSelectorComponent', () => {
it('should NOT be shown by default', () => {
fixture.detectChanges();
const pagination = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-pagination"]'));
const pagination = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]'));
expect(pagination).toBeNull();
});
@@ -539,19 +542,6 @@ describe('ContentNodeSelectorComponent', () => {
});
}));
it('should NOT be shown when modifying searchTerm to be less then 4 characters after search results have been diplayed', async(() => {
typeToSearchBox('shenron');
respondWithSearchResults(ONE_FOLDER_RESULT);
fixture.whenStable().then(() => {
typeToSearchBox('sh');
fixture.detectChanges();
const pagination = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-pagination"]'));
expect(pagination).toBeNull();
});
}));
it('button\'s callback should load the next batch of results by calling the search api', () => {
const skipCount = 8;
component.searchTerm = 'kakarot';