Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VListGroup): fix unmounting to clear opened #20215

Merged
merged 1 commit into from
Jul 23, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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((
<CenteredGrid width="200px">
<h2 class="mt-8">ListGroup</h2>

<VList opened={ opened.value }>
{
visible.value && (
<VListGroup value="Users">
{{
default: () => (
<>
<VListItem title="Foo" />
<VListItem title="Bar" />
</>
),
}}
</VListGroup>
)
}
</VList>
</CenteredGrid>
))

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')
})
})
1 change: 0 additions & 1 deletion packages/vuetify/src/composables/nested/nested.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
Loading