Skip to content

docs: update key event example #1165

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

Merged
merged 1 commit into from
Mar 3, 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
5 changes: 2 additions & 3 deletions docs/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ This component allows to increment/decrement the quantity using various keys.
const KEY_DOWN = 40
const KEY_UP = 38
const ESCAPE = 27
const CHAR_A = 65

export default {
data() {
Expand Down Expand Up @@ -130,7 +129,7 @@ This component allows to increment/decrement the quantity using various keys.
if (e.keyCode === KEY_UP) {
this.increment()
}
if (e.which === CHAR_A) {
if (e.key === 'a') {
this.quantity = 13
}
}
Expand Down Expand Up @@ -180,7 +179,7 @@ describe('Key event tests', () => {
it('Magic character "a" sets quantity to 13', () => {
const wrapper = mount(QuantityComponent)
wrapper.trigger('keydown', {
which: 65
key: 'a'
})
expect(wrapper.vm.quantity).toBe(13)
})
Expand Down
5 changes: 2 additions & 3 deletions docs/ja/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ describe('Click event', () => {
const KEY_DOWN = 40
const KEY_UP = 38
const ESCAPE = 27
const CHAR_A = 65

export default {
data() {
Expand Down Expand Up @@ -125,7 +124,7 @@ describe('Click event', () => {
if (e.keyCode === KEY_UP) {
this.increment()
}
if (e.which === CHAR_A) {
if (e.key === 'a') {
this.quantity = 13
}
}
Expand Down Expand Up @@ -174,7 +173,7 @@ describe('Key event tests', () => {
it('Magic character "a" sets quantity to 13', () => {
const wrapper = mount(QuantityComponent)
wrapper.trigger('keydown', {
which: 65
key: 'a'
})
expect(wrapper.vm.quantity).toBe(13)
})
Expand Down
5 changes: 2 additions & 3 deletions docs/ru/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ describe('Click event', () => {
const KEY_DOWN = 40
const KEY_UP = 38
const ESCAPE = 27
const CHAR_A = 65

export default {
data() {
Expand Down Expand Up @@ -125,7 +124,7 @@ describe('Click event', () => {
if (e.keyCode === KEY_UP) {
this.increment()
}
if (e.which === CHAR_A) {
if (e.key === 'a') {
this.quantity = 13
}
}
Expand Down Expand Up @@ -174,7 +173,7 @@ describe('Тестирование событий клавиш', () => {
it('Магический символ "a" устанавливает quantity равным 13', () => {
const wrapper = mount(QuantityComponent)
wrapper.trigger('keydown', {
which: 65
key: 'a'
})
expect(wrapper.vm.quantity).toBe(13)
})
Expand Down
5 changes: 2 additions & 3 deletions docs/zh/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('点击事件', () => {
const KEY_DOWN = 40
const KEY_UP = 38
const ESCAPE = 27
const CHAR_A = 65

export default {
data() {
Expand Down Expand Up @@ -130,7 +129,7 @@ describe('点击事件', () => {
if (e.keyCode === KEY_UP) {
this.increment()
}
if (e.which === CHAR_A) {
if (e.key === 'a') {
this.quantity = 13
}
}
Expand Down Expand Up @@ -180,7 +179,7 @@ describe('键盘事件测试', () => {
it('魔术字符 "a" 键将数量设置为 13', () => {
const wrapper = mount(QuantityComponent)
wrapper.trigger('keydown', {
which: 65
key: 'a'
})
expect(wrapper.vm.quantity).toBe(13)
})
Expand Down