Skip to content

Commit

Permalink
docs: update key event example (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
eostrom authored and eddyerburgh committed Mar 3, 2019
1 parent 124a6e7 commit 4cc79e1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
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

0 comments on commit 4cc79e1

Please sign in to comment.