Skip to content

Commit

Permalink
Merge pull request #11209 from IgniteUI/VDyulgerov/fix-columnsAreaMax…
Browse files Browse the repository at this point in the history
…Height-input-propert-13.1.x

fix(gridToolbarHiding): fix columnsAreaMaxHeight input property
  • Loading branch information
hanastasov authored Mar 14, 2022
2 parents 6654a2d + 311c512 commit 023ecf8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Component, ViewChild } from '@angular/core';
import { TestBed, fakeAsync, ComponentFixture } from '@angular/core/testing';
import { TestBed, fakeAsync, ComponentFixture, tick } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { AbsoluteScrollStrategy, GlobalPositionStrategy, IgxCsvExporterService, IgxExcelExporterService } from '../../services/public_api';
import { IgxGridModule } from './public_api';
import { configureTestSuite } from '../../test-utils/configure-suite';
import { GridFunctions } from "../../test-utils/grid-functions.spec";
import { By } from "@angular/platform-browser";


const TOOLBAR_TAG = 'igx-grid-toolbar';
Expand Down Expand Up @@ -170,6 +172,24 @@ describe('IgxGrid - Grid Toolbar #grid - ', () => {
expect(defaultFiltSettings).not.toEqual(instance.advancedFiltAction.overlaySettings);
expect(defaultExportSettings).not.toEqual(instance.exporterAction.overlaySettings);
});

it('should initialize input property columnsAreaMaxHeight properly', fakeAsync(() => {
expect(instance.pinningAction.columnsAreaMaxHeight).toEqual('100%');

instance.pinningAction.columnsAreaMaxHeight = '10px';
fixture.detectChanges();

expect(instance.pinningAction.columnsAreaMaxHeight).toEqual('10px');

const pinningButton = GridFunctions.getColumnPinningButton(fixture);
pinningButton.click();
tick();
fixture.detectChanges()
const element = fixture.debugElement.query(By.css('.igx-column-actions__columns'));
expect(element.attributes.style).toBe('max-height: 10px;');

expect(instance.pinningAction.columnsAreaMaxHeight).toEqual('10px');
}));
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ export abstract class BaseToolbarDirective implements OnDestroy {
if (actions) {
this._setupListeners(toggleRef, actions);
const setHeight = () =>
actions.columnsAreaMaxHeight = this.columnListHeight ?? `${Math.max(this.grid.calcHeight * 0.5, 200)}px`;
actions.columnsAreaMaxHeight = actions.columnsAreaMaxHeight !== '100%'
? actions.columnsAreaMaxHeight :
this.columnListHeight ??
`${Math.max(this.grid.calcHeight * 0.5, 200)}px`;
toggleRef.opening.pipe(first()).subscribe(setHeight);
}
toggleRef.toggle({ ...this.overlaySettings, ...{ target: anchorElement, outlet: this.grid.outlet,
Expand Down

0 comments on commit 023ecf8

Please sign in to comment.