Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 13 additions & 85 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "^2.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-spec-tags": "^2.0.0",
"karma-junit-reporter": "^2.0.1",
"karma-parallel": "^0.3.1",
"karma-spec-reporter": "^0.0.36",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
} else if (this.minWidth && newSize <= this.userSetMinWidthPx) {
this.widthConstrained = true;
return this.userSetMinWidthPx;
} else if (!this.minWidth && (!this.widthSetByUser || this.width === 'fit-content') && !this.grid.columnWidthSetByUser && (!newSize || newSize <= this.grid.minColumnWidth)) {
} else if ((this.columnLayout || !this.columnGroup) && !this.minWidth && (!this.widthSetByUser || this.width === 'fit-content') && !this.grid.columnWidthSetByUser && (!newSize || newSize <= this.grid.minColumnWidth)) {
return this.grid.minColumnWidth;
} else {
this.widthConstrained = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,53 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import {
CollapsibleColumnGroupTestComponent,
CollapsibleGroupsTemplatesTestComponent,
CollapsibleGroupsDynamicColComponent
CollapsibleGroupsDynamicColComponent,
CollapsibleColumnGroupWithExplicitWidthsComponent
} from '../../../test-utils/grid-samples.spec';
import { GridFunctions } from '../../../test-utils/grid-functions.spec';
import { UIInteractions, wait } from '../../../test-utils/ui-interactions.spec';
import { DropPosition } from 'igniteui-angular/grids/core';
import { IgxColumnGroupComponent } from 'igniteui-angular/grids/core';
import { SortingDirection } from 'igniteui-angular/core';

describe('IgxGrid - collapsible column group with explicit widths regression #17042 #grid', () => {
let fixture;
let grid: IgxGridComponent;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
CollapsibleColumnGroupWithExplicitWidthsComponent
]
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(CollapsibleColumnGroupWithExplicitWidthsComponent);
fixture.detectChanges();
grid = fixture.componentInstance.grid;
});

it('collapsed column group calcPixelWidth should equal the sum of visible children calcPixelWidth when columns have explicit widths smaller than minColumnWidth', () => {
const colGroup = grid.getColumnByName('ID').parent as IgxColumnGroupComponent;
const visibleChild = grid.getColumnByName('ID');

// Group is collapsed by default (expanded=false in the template)
expect(colGroup.collapsible).toBeTrue();
expect(colGroup.expanded).toBeFalse();

// The visible child has explicit width 100px, which is less than the grid's MINIMUM_COLUMN_WIDTH (136px).
// The column group's calcPixelWidth should equal its visible child's calcPixelWidth,
// NOT be inflated to the grid's minimum column width.
const visibleChildWidth = visibleChild.calcPixelWidth;
const groupWidth = colGroup.calcPixelWidth;

expect(visibleChildWidth).toBe(100);
expect(groupWidth).toBe(visibleChildWidth);
});
});

describe('IgxGrid - multi-column headers #grid', () => {
let contactInf;
let countryInf;
Expand Down
28 changes: 28 additions & 0 deletions projects/igniteui-angular/test-utils/grid-samples.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,34 @@ export class CollapsibleGroupsDynamicColComponent {
}
}

/**
* Test component for verifying that a collapsed collapsible column group with explicit column widths
* smaller than the grid's MINIMUM_COLUMN_WIDTH does not cause header/cell misalignment.
* Regression test for: https://github.com/IgniteUI/igniteui-angular/issues/17042
*/
@Component({
template: `
<igx-grid #grid [data]="data" height="500px" width="900px">
<igx-column-group header="Customer Information" [collapsible]="true" [expanded]="false">
<igx-column field="ID" width="100px" [visibleWhenCollapsed]="true"></igx-column>
<igx-column field="CompanyName" width="100px" [visibleWhenCollapsed]="false"></igx-column>
<igx-column field="ContactName" width="100px" [visibleWhenCollapsed]="false"></igx-column>
</igx-column-group>
<igx-column field="ContactTitle"></igx-column>
<igx-column field="Address"></igx-column>
<igx-column field="City"></igx-column>
<igx-column field="Country"></igx-column>
<igx-column field="Phone"></igx-column>
</igx-grid>
`,
imports: [IgxGridComponent, IgxColumnComponent, IgxColumnGroupComponent]
})
export class CollapsibleColumnGroupWithExplicitWidthsComponent {
@ViewChild(IgxGridComponent, { read: IgxGridComponent, static: true })
public grid: IgxGridComponent;
public data = SampleTestData.contactInfoDataFull();
}

@Component({
template: `
<igx-grid #grid [data]="data" height="500px" width="1300px" columnWidth="100px">
Expand Down
Loading