@@ -403,4 +403,58 @@ describe('row details', () => {
403403 expect ( detailsCell . hidden ) . to . be . false ;
404404 } ) ;
405405 } ) ;
406+
407+ describe ( 'details cell height change' , ( ) => {
408+ let bodyRow ;
409+ let updateDetailsCellHeight ;
410+
411+ beforeEach ( async ( ) => {
412+ grid = fixtureSync ( `
413+ <vaadin-grid>
414+ <vaadin-grid-column path="name"></vaadin-grid-column>
415+ </vaadin-grid>
416+ ` ) ;
417+ grid . rowDetailsRenderer = ( root , _ , { item } ) => {
418+ // Render the details cell with a height of 100px
419+ root . innerHTML = `<div style="height: 100px; background: yellow;">Details</div>` ;
420+ // Increase the details cell height to 200px in a microtask
421+ queueMicrotask ( ( ) => {
422+ root . firstElementChild . style . height = '150px' ;
423+ } ) ;
424+
425+ updateDetailsCellHeight = ( ) => {
426+ root . firstElementChild . style . height = '200px' ;
427+ } ;
428+ } ;
429+ grid . items = [ { name : 'foo' } ] ;
430+ await nextFrame ( ) ;
431+ bodyRow = getRows ( grid . $ . items ) [ 0 ] ;
432+ } ) ;
433+
434+ it ( 'should update the row height when opened items are updated' , async ( ) => {
435+ grid . detailsOpenedItems = [ ...grid . items ] ;
436+ await nextFrame ( ) ;
437+ const detailsRowHeight = bodyRow . offsetHeight ;
438+
439+ grid . detailsOpenedItems = [ ...grid . items ] ;
440+ await nextFrame ( ) ;
441+ expect ( bodyRow . offsetHeight ) . to . equal ( detailsRowHeight ) ;
442+ } ) ;
443+
444+ it ( 'should clear row padding bottom when opened items are cleared' , async ( ) => {
445+ grid . detailsOpenedItems = [ ...grid . items ] ;
446+ grid . detailsOpenedItems = [ ] ;
447+ await nextFrame ( ) ;
448+ expect ( bodyRow . style . paddingBottom ) . to . equal ( '' ) ;
449+ } ) ;
450+
451+ it ( 'should update the row height when details cell height changes' , async ( ) => {
452+ grid . detailsOpenedItems = [ ...grid . items ] ;
453+ await nextFrame ( ) ;
454+ const detailsRowHeight = bodyRow . offsetHeight ;
455+ updateDetailsCellHeight ( ) ;
456+ await nextFrame ( ) ;
457+ expect ( bodyRow . offsetHeight ) . to . equal ( detailsRowHeight + 50 ) ;
458+ } ) ;
459+ } ) ;
406460} ) ;
0 commit comments