@@ -4,7 +4,8 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
44import {
55 CollapsibleColumnGroupTestComponent ,
66 CollapsibleGroupsTemplatesTestComponent ,
7- CollapsibleGroupsDynamicColComponent
7+ CollapsibleGroupsDynamicColComponent ,
8+ CollapsibleGroupWithExplicitChildWidthsComponent
89} from '../../test-utils/grid-samples.spec' ;
910import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
1011import { UIInteractions , wait } from '../../test-utils/ui-interactions.spec' ;
@@ -28,7 +29,8 @@ describe('IgxGrid - multi-column headers #grid', () => {
2829 NoopAnimationsModule ,
2930 CollapsibleColumnGroupTestComponent ,
3031 CollapsibleGroupsTemplatesTestComponent ,
31- CollapsibleGroupsDynamicColComponent
32+ CollapsibleGroupsDynamicColComponent ,
33+ CollapsibleGroupWithExplicitChildWidthsComponent
3234 ]
3335 } ) . compileComponents ( ) ;
3436 } ) ) ;
@@ -617,6 +619,28 @@ describe('IgxGrid - multi-column headers #grid', () => {
617619 expect ( spans . length ) . toBe ( 2 ) ;
618620 } ) ;
619621
622+ it ( 'should not constrain collapsed column group width by default min width when children have explicit widths (#17042)' , ( ) => {
623+ const fix = TestBed . createComponent ( CollapsibleGroupWithExplicitChildWidthsComponent ) ;
624+ fix . detectChanges ( ) ;
625+ const g : IgxGridComponent = fix . componentInstance . grid ;
626+
627+ const customerInfoGroup = GridFunctions . getColGroup ( g , 'Customer Information' ) ;
628+ expect ( customerInfoGroup . expanded ) . toBe ( false ) ;
629+ expect ( customerInfoGroup . collapsible ) . toBe ( true ) ;
630+
631+ // The only visible child when collapsed is CompanyName with width 100px.
632+ const visibleChildren = customerInfoGroup . children
633+ . filter ( c => ! c . hidden ) ;
634+ expect ( visibleChildren . length ) . toBe ( 1 ) ;
635+
636+ const visibleChildWidth = visibleChildren
637+ . reduce ( ( sum , c ) => sum + c . calcPixelWidth , 0 ) ;
638+
639+ const groupWidth = customerInfoGroup . calcPixelWidth ;
640+ expect ( groupWidth ) . toBe ( visibleChildWidth ) ;
641+ expect ( groupWidth ) . toBe ( 100 ) ;
642+ } ) ;
643+
620644 it ( 'Group By: test when group by a column' , ( ) => {
621645 addressInf . expanded = false ;
622646 countryCol . visibleWhenCollapsed = false ;
0 commit comments