angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.37k stars 6.75k forks source link

help(ComponentHarness): TestElement.sendKeys() on disabled inputs #26577

Closed alvaromartmart closed 1 year ago

alvaromartmart commented 1 year ago

What are you trying to do?

I expect TestElement.sendKeys to respect the disabled status of input elements, however they don't seem to. The input is properly disabled on the application, the harness properly detects its disabled status... but sendKeys seems to bypass it.

Maybe I misunderstood something, any help would be appreciated.

What troubleshooting steps have you tried?

I tried running extra change detection cycles, etc. to no avail.

Reproduction

Steps to reproduce:

  1. In the Stackblitz demo below, the test CustomInputHarness > should not fill disabled input should pass

https://stackblitz.com/edit/node-g4jhab?file=harness-sendkeys-demo/src/app/custom-input-component/custom-input-component.harness.ts

Environment

crisbeto commented 1 year ago

We can't do this across all the environments we support (TestBed, Protractor and WebDriver), because the e2e testing framework won't send keyboard events to disabled elements. We could make it work on TestBed, but then the behavior will be inconsistent.

angular-automatic-lock-bot[bot] commented 1 year ago

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.