diff --git a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx index 89535931f7a..8529294be27 100644 --- a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx +++ b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx @@ -5,6 +5,9 @@ import { VListGroup } from '../VListGroup' import { VListItem } from '../VListItem' import { VList } from '../VList' +// Utilities +import { ref } from 'vue' + describe('VListGroup', () => { function mountFunction (content: JSX.Element) { return cy.mount(() => content) @@ -49,4 +52,43 @@ describe('VListGroup', () => { wrapper.get('.v-list-item-title').contains('Group') }) + + it('should not remove opened when unmounted', () => { + const visible = ref(true) + const opened = ref(['Users']) + const wrapper = mountFunction(( + +

ListGroup

+ + + { + visible.value && ( + + {{ + default: () => ( + <> + + + + ), + }} + + ) + } + +
+ )) + + wrapper.get('.v-list .v-list-group').should('exist') + .get('.v-list-group__items').should('be.visible') + .then(() => { + visible.value = false + }) + .get('.v-list.v-list-group').should('not.exist') + .then(() => { + visible.value = true + }) + .get('.v-list-group').should('exist') + .get('.v-list-group__items').should('be.visible') + }) }) diff --git a/packages/vuetify/src/composables/nested/nested.ts b/packages/vuetify/src/composables/nested/nested.ts index 51adb784e56..86c12677489 100644 --- a/packages/vuetify/src/composables/nested/nested.ts +++ b/packages/vuetify/src/composables/nested/nested.ts @@ -227,7 +227,6 @@ export const useNested = (props: NestedProps) => { children.value.set(parent, list.filter(child => child !== id)) } parents.value.delete(id) - opened.value.delete(id) }, open: (id, value, event) => { vm.emit('click:open', { id, value, path: getPath(id), event })