File tree 4 files changed +8
-12
lines changed
4 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ This component allows to increment/decrement the quantity using various keys.
101
101
const KEY_DOWN = 40
102
102
const KEY_UP = 38
103
103
const ESCAPE = 27
104
- const CHAR_A = 65
105
104
106
105
export default {
107
106
data () {
@@ -130,7 +129,7 @@ This component allows to increment/decrement the quantity using various keys.
130
129
if (e .keyCode === KEY_UP ) {
131
130
this .increment ()
132
131
}
133
- if (e .which === CHAR_A ) {
132
+ if (e .key === ' a ' ) {
134
133
this .quantity = 13
135
134
}
136
135
}
@@ -180,7 +179,7 @@ describe('Key event tests', () => {
180
179
it (' Magic character "a" sets quantity to 13' , () => {
181
180
const wrapper = mount (QuantityComponent)
182
181
wrapper .trigger (' keydown' , {
183
- which : 65
182
+ key : ' a '
184
183
})
185
184
expect (wrapper .vm .quantity ).toBe (13 )
186
185
})
Original file line number Diff line number Diff line change @@ -97,7 +97,6 @@ describe('Click event', () => {
97
97
const KEY_DOWN = 40
98
98
const KEY_UP = 38
99
99
const ESCAPE = 27
100
- const CHAR_A = 65
101
100
102
101
export default {
103
102
data () {
@@ -125,7 +124,7 @@ describe('Click event', () => {
125
124
if (e .keyCode === KEY_UP ) {
126
125
this .increment ()
127
126
}
128
- if (e .which === CHAR_A ) {
127
+ if (e .key === ' a ' ) {
129
128
this .quantity = 13
130
129
}
131
130
}
@@ -174,7 +173,7 @@ describe('Key event tests', () => {
174
173
it (' Magic character "a" sets quantity to 13' , () => {
175
174
const wrapper = mount (QuantityComponent)
176
175
wrapper .trigger (' keydown' , {
177
- which : 65
176
+ key : ' a '
178
177
})
179
178
expect (wrapper .vm .quantity ).toBe (13 )
180
179
})
Original file line number Diff line number Diff line change @@ -97,7 +97,6 @@ describe('Click event', () => {
97
97
const KEY_DOWN = 40
98
98
const KEY_UP = 38
99
99
const ESCAPE = 27
100
- const CHAR_A = 65
101
100
102
101
export default {
103
102
data () {
@@ -125,7 +124,7 @@ describe('Click event', () => {
125
124
if (e .keyCode === KEY_UP ) {
126
125
this .increment ()
127
126
}
128
- if (e .which === CHAR_A ) {
127
+ if (e .key === ' a ' ) {
129
128
this .quantity = 13
130
129
}
131
130
}
@@ -174,7 +173,7 @@ describe('Тестирование событий клавиш', () => {
174
173
it (' Магический символ "a" устанавливает quantity равным 13' , () => {
175
174
const wrapper = mount (QuantityComponent)
176
175
wrapper .trigger (' keydown' , {
177
- which : 65
176
+ key : ' a '
178
177
})
179
178
expect (wrapper .vm .quantity ).toBe (13 )
180
179
})
Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ describe('点击事件', () => {
101
101
const KEY_DOWN = 40
102
102
const KEY_UP = 38
103
103
const ESCAPE = 27
104
- const CHAR_A = 65
105
104
106
105
export default {
107
106
data () {
@@ -130,7 +129,7 @@ describe('点击事件', () => {
130
129
if (e .keyCode === KEY_UP ) {
131
130
this .increment ()
132
131
}
133
- if (e .which === CHAR_A ) {
132
+ if (e .key === ' a ' ) {
134
133
this .quantity = 13
135
134
}
136
135
}
@@ -180,7 +179,7 @@ describe('键盘事件测试', () => {
180
179
it (' 魔术字符 "a" 键将数量设置为 13' , () => {
181
180
const wrapper = mount (QuantityComponent)
182
181
wrapper .trigger (' keydown' , {
183
- which : 65
182
+ key : ' a '
184
183
})
185
184
expect (wrapper .vm .quantity ).toBe (13 )
186
185
})
You can’t perform that action at this time.
0 commit comments