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(VDialog): remove console error on escape keypress #7030

Merged
merged 4 commits into from
Apr 22, 2019
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
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()
})
})