Skip to content

Commit

Permalink
fix(VExpansionPanel): don't boot before showing if opened externally
Browse files Browse the repository at this point in the history
fixes #10140
  • Loading branch information
KaelWD committed Jun 2, 2021
1 parent 988fe04 commit 0b8fc27
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ export default mixins(
this.isReadonly || this.isDisabled || this.toggle()
},
toggle () {
/* istanbul ignore else */
if (this.content) this.content.isBooted = true
this.$nextTick(() => this.$emit('change'))
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,28 @@ interface options extends ExtractVue<typeof baseMixins> {
export default baseMixins.extend<options>().extend({
name: 'v-expansion-panel-content',

data: () => ({
isActive: false,
}),

computed: {
isActive (): boolean {
parentIsActive (): boolean {
return this.expansionPanel.isActive
},
},

watch: {
parentIsActive: {
immediate: true,
handler (val, oldVal) {
if (val) this.isBooted = true

if (oldVal == null) this.isActive = val
else this.$nextTick(() => this.isActive = val)
},
},
},

created () {
this.expansionPanel.registerContent(this)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ describe('VExpansionPanel', () => {
expect(wrapper.vm.content).toBeNull()
})

it('should toggle, boot content and emit a change', async () => {
// TODO: actual behaviour relies on VExpansionPanels, this was faking it with vm.toggle()
it.skip('should toggle, boot content and emit a change', async () => {
const change = jest.fn()
const wrapper = mountFunction({
slots: {
Expand Down

0 comments on commit 0b8fc27

Please sign in to comment.