You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could replace all keys with their respective keyCodes in my tests, however since this method is specified in the official docs and it was working in version 1.1.3 and below, I belive this is a bug.
Steps to reproduce
Let's take a simple Vue component. In template: <div @keyup="$_handleKeyUp"> </div>
In script:
$_handleKeyUp(event) {
if (event.key === KEY_VALUE.SPACE || event.key === KEY_VALUE.ENTER) {
// do sth
}
}
In tests, I want to verify if that something happens. So, I trigger an event with key ENTER.
await root.trigger('keyup', {
key: 'Enter'
});
Expected behaviour
The test should pass.
Actual behaviour
The test fails. This also applies to any other keys I have tested (space - ' ', left - ArrowLeft, right - ArrowRight).
It's worth mentioning that replacing key with its respective keyCode does indeed make the test pass.
await root.trigger('keyup', {
keyCode: 13
});
Passing the key as a modifier also works:
await root.trigger('keyup.enter');
Downgrading to version 1.1.3 also makes the tests pass.
Possible Solution
I belive this could be because of the modifications done in #1808.
I also noticed you don't have any test for these type of key events (with key as a parameter), or at least I could only find ones with keyCodes or modifiers; it might be worth adding a tests for this case as well to prevent further issues.
The text was updated successfully, but these errors were encountered:
Subject of the issue
After the release of the 1.1.4 version, some of my tests that cover keyboard events fail. To be more specific, the tests in which I pass the key as a property of the event. This way is described in VTU documentation (https://vue-test-utils.vuejs.org/guides/dom-events.html#keyboard-example):
I could replace all keys with their respective keyCodes in my tests, however since this method is specified in the official docs and it was working in version 1.1.3 and below, I belive this is a bug.
Steps to reproduce
Let's take a simple Vue component. In template:
<div @keyup="$_handleKeyUp"> </div>
In script:
In tests, I want to verify if that something happens. So, I trigger an event with key ENTER.
Expected behaviour
The test should pass.
Actual behaviour
The test fails. This also applies to any other keys I have tested (space - ' ', left - ArrowLeft, right - ArrowRight).
It's worth mentioning that replacing key with its respective keyCode does indeed make the test pass.
Passing the key as a modifier also works:
Downgrading to version 1.1.3 also makes the tests pass.
Possible Solution
I belive this could be because of the modifications done in #1808.
I also noticed you don't have any test for these type of key events (with key as a parameter), or at least I could only find ones with keyCodes or modifiers; it might be worth adding a tests for this case as well to prevent further issues.
The text was updated successfully, but these errors were encountered: