Skip to content

Commit

Permalink
fix(overlayable): avoid overlay generation toggle if not active
Browse files Browse the repository at this point in the history
fixes #8142
  • Loading branch information
johnleider committed Oct 15, 2019
1 parent 2165628 commit 4c61674
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,26 @@ describe('Overlayable.ts', () => {

expect(wrapper.vm.overlay.zIndex).toBe(8)
})

// https://github.com/vuetifyjs/vuetify/issues/8142
it('should not update overlay state if not active', () => {
const cb = jest.fn()
const wrapper = mountFunction({
methods: {
removeOverlay: cb,
genOVerlay: cb,
},
})

wrapper.setProps({ hideOverlay: true })
wrapper.setProps({ hideOverlay: false })

expect(cb).not.toHaveBeenCalled()

wrapper.setData({ isActive: true })
wrapper.setProps({ hideOverlay: true })
wrapper.setProps({ hideOverlay: false })

expect(cb).toHaveBeenCalledTimes(1)
})
})
2 changes: 2 additions & 0 deletions packages/vuetify/src/mixins/overlayable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export default Vue.extend<Vue & Toggleable & Stackable & options>().extend({

watch: {
hideOverlay (value) {
if (!this.isActive) return

if (value) this.removeOverlay()
else this.genOverlay()
},
Expand Down

0 comments on commit 4c61674

Please sign in to comment.