Skip to content

Commit

Permalink
fix(VDialog): remove console error on escape keypress (#7030)
Browse files Browse the repository at this point in the history
* fix(VDialog): pass event parameter

* test(VDialog): add test on escape keydown

* fix(VDialog): remove consoleError
  • Loading branch information
kuromoka authored and MajesticPotatoe committed Apr 22, 2019
1 parent 415f8ca commit f2303f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VDialog/VDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default {
if (el) return el
}

consoleError('No activator found')
return null
},
genActivator () {
if (!this.hasActivator) return null
Expand Down
14 changes: 14 additions & 0 deletions packages/vuetify/test/unit/components/VDialog/VDialog.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import VDialog from '@/components/VDialog'
import { test } from '@/test'
import { keyCodes } from '@/util/helpers'
import Vue from 'vue'

test('VDialog.js', ({ mount, compileToFunctions }) => {
Expand Down Expand Up @@ -252,4 +253,17 @@ test('VDialog.js', ({ mount, compileToFunctions }) => {

expect('Unable to locate target [data-app]').toHaveBeenTipped()
})

it('should close dialog on escape keydown', () => {
const wrapper = mount(VDialog, {
propsData: { value: true }
})

const escape = new Event('keydown')
escape.keyCode = keyCodes.esc
wrapper.vm.$refs.content.dispatchEvent(escape)
expect(wrapper.vm.isActive).toBe(false)

expect('Unable to locate target [data-app]').toHaveBeenTipped()
})
})

0 comments on commit f2303f1

Please sign in to comment.