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 VTU don't return key property to event when use trigger.('eventName.key') #1808

Merged

Conversation

voskresla
Copy link
Contributor

@voskresla voskresla commented Mar 20, 2021

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Other, please describe: fix test convert a registered key name to a key code in test/specs/wrapper/trigger.spec.js

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

The PR fulfills these requirements:

Other information:
If in our code exist check like this:

import { Key } from 'w3c-keys'
...
handleOnKeyDown(e: KeyboardEvent) {
	const tab = e.key === Key.Tab
	const escape = e.key === Key.Escape

	if (tab || escape) {
		...doSmth
	}
}

we can't test it by fire event like this

await input.trigger('keydown.tab')

Because VTU don't return key property in event when triggered by eventName.keyName.

Of course we can test it like this )

await input.trigger('keydown', {
	key: 'Tab',
})

voskresla and others added 4 commits March 15, 2021 23:36
When trigger 'keydown.tab` - key does not exists.  This affect case when in components we use w3c-keys for compare
Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sorry it took so long to review! I will do a release this week probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants