Skip to content

Commit

Permalink
fix(VDataTable): show correct items count after expanding group (#20347)
Browse files Browse the repository at this point in the history
fixes #20313
  • Loading branch information
huynhtehoa authored Jan 24, 2025
1 parent 568f71b commit 7dd5a20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,27 @@ describe('VDataTable', () => {
cy.get('.v-data-table').find('h2').should('exist')
cy.get('.v-data-table').find('h3').should('exist')
})

it('should have body slot and slot prop should show correct item count after group is expanded', () => {
cy.mount(() => (
<Application>
<VDataTable
items={ DESSERT_ITEMS }
headers={ DESSERT_HEADERS }
itemsPerPage={ -1 }
groupBy={[{ key: 'group', order: 'desc' }]}
>
{{
'body.append': ({ items }) => <div id="body-append">{ items.length }</div>,
}}
</VDataTable>
</Application>
))

cy.get('.v-data-table').find('div#body-append').should('have.text', DESSERT_ITEMS.length)
cy.get(':nth-child(1) > .v-data-table__td > .v-btn').click()
cy.get('.v-data-table').find('div#body-append').should('have.text', DESSERT_ITEMS.length)
})
})

describe('sort', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function provideGroupBy (options: {
}
}

return arr
return [...new Set(arr)]
}
return dive({ type: 'group', items, id: 'dummy', key: 'dummy', value: 'dummy', depth: 0 })
}
Expand Down

0 comments on commit 7dd5a20

Please sign in to comment.