bug(cdk/testing): harnesses treat tabs different depending on test environment
See original GitHub issueReproduction
https://travis-ci.org/github/e-hein/test-tabkey/branches
-
without tab everything works as expected: last-working-sample-without-tab
(build log|stackblitz) -
using tab will lead to different behavior: broken-by-using-the-tab-key
(build log|changes|stackblitz) -
workaround: workaround-with-emulate-tab
(build log|changes|stackblitz)
Expected Behavior
If I can switch from karma/jest to protractor I’d expect the same harness test to lead to the same results. In this case, I’d expected that senden TestKey.Tab to an TestElement it should select the next selectable element (or at least try to do so in the most common cases).
Alternative Behavior
Sending TestKey.Tab writes a \t into an input field in both environments.
Actual Behavior
- Sending
TestKey.Tabin ProtractorEnvironment selects the next input (=expected Behavior) - Sending
TestKey.Tabin TestbedEnvironment does nothing (not even write \t)
Environment
- Angular: 9.1.9
- CDK/Material: cdk 9.2.4, material 9.2.4
- Browser(s): Chrome, Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Angular CLI: 9.1.9 Node: 12.18.0 OS: darwin x64 / Linux
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
feat(@angular/cdk/testing): Component Harness Feedback
This is an open discussion aiming to regroup Component Harness feedback and improvement ideas. Most of the items below are focused on ...
Read more >Tidy up your tests using component test harnesses - YouTube
Angular CDK's test harnesses allow us to write component unit tests that are easier to create and maintain. In this talk, we'll cover...
Read more >Testing with component harnesses - Angular Material
The Angular CDK's component harnesses are designed to work in multiple different test environments. Support currently includes Angular's Testbed environment ...
Read more >Create a component harness for your tests with Angular CDK
Learn how to create and consume a custom component harness using Angular CDK. With a step-by-step case study, we run it in unit...
Read more >@angular/cdk | Yarn - Package Manager
bug fix, overlay: expand test environment check (#22927 ... New @angular/cdk/testing infrastructure and Angular Material test harnesses.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

As stated at the end of #19946 further emulation of browser behavior is currently not in scope of angular/cdk. If you got a similar issue, I published my solutions at github.com/e-hein/emulate-tab and github.com/e-hein/emulate-key-in-browser (MIT License).
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.