mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3384] Create automated tests for Version Component (#3631)
* fix version component restore and delete event * version manager actions * fix test * fix unit test * remove fdescribe * fix tslint * fix screenshot rewrite problem * remove fdescribe * multi instance try * remove fdescribe * try uncomment some test * error page * fix user preferences pagiantion * search page test include * fix type tslint e2e * restore code * default lang momentadapter * fix test * [ADF-3384] removed console log from test * [ADF-3384] adding some fixes for tests and code * [ADF-3384] fixed some test and code
This commit is contained in:
committed by
Eugenio Romano
parent
17074478e2
commit
a12662e7e2
@@ -232,6 +232,8 @@ describe('PaginationComponent', () => {
|
||||
|
||||
describe('Without pagination input', () => {
|
||||
it('has defaults', () => {
|
||||
component.ngOnInit();
|
||||
|
||||
const {
|
||||
current, lastPage, isFirstPage, isLastPage,
|
||||
next, previous, range, pages
|
||||
|
@@ -15,14 +15,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation,
|
||||
ChangeDetectorRef, OnDestroy, HostBinding } from '@angular/core';
|
||||
import {
|
||||
ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation,
|
||||
ChangeDetectorRef, OnDestroy, HostBinding
|
||||
} from '@angular/core';
|
||||
|
||||
import { Pagination } from 'alfresco-js-api';
|
||||
import { PaginatedComponent } from './paginated-component.interface';
|
||||
import { PaginationComponentInterface } from './pagination-component.interface';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { PaginationModel } from '../models/pagination.model';
|
||||
import { UserPreferencesService } from '../services/user-preferences.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-pagination',
|
||||
@@ -53,11 +56,11 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
|
||||
|
||||
/** An array of page sizes. */
|
||||
@Input()
|
||||
supportedPageSizes: number[] = [5, 25, 50, 100];
|
||||
supportedPageSizes: number[];
|
||||
|
||||
/** Pagination object. */
|
||||
@Input()
|
||||
pagination: PaginationModel = PaginationComponent.DEFAULT_PAGINATION;
|
||||
pagination: PaginationModel;
|
||||
|
||||
/** Emitted when pagination changes in any way. */
|
||||
@Output()
|
||||
@@ -81,10 +84,20 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
|
||||
|
||||
private paginationSubscription: Subscription;
|
||||
|
||||
constructor(private cdr: ChangeDetectorRef) {
|
||||
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (!this.pagination) {
|
||||
let defaultPagination = PaginationComponent.DEFAULT_PAGINATION;
|
||||
defaultPagination.maxItems = this.userPreferencesService.paginationSize;
|
||||
this.pagination = defaultPagination;
|
||||
}
|
||||
|
||||
if (!this.supportedPageSizes) {
|
||||
this.supportedPageSizes = this.userPreferencesService.getDefaultPageSizes();
|
||||
}
|
||||
|
||||
if (this.target) {
|
||||
this.paginationSubscription = this.target.pagination.subscribe((pagination: PaginationModel) => {
|
||||
|
||||
|
Reference in New Issue
Block a user