emberjs / emberjs/ember-test-helpers
Do not throw an error when clicking on a disabled element
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 254
- PR merge metrics
- No merged PRs in 30d
Description
The current behavior of the `click` helper is to throw an error "Can not click disabled element" when trying to do so.
The problem is that clicking on a disabled element is something that a user is perfectly capable of doing. Simulating this behavior in an acceptance test should not be punished.
When I make my test click a disabled button, I expect the test not to crash. I expect the test to proceed and to assert that nothing has changed.
Instead of clicking a disabled element, `@ember/test-helpers` forces me into asserting that the element contains the `disabled` attribute. This has two problems:
1. It's not the same thing. Asserting for an element's attribute does not guarantee lack of behavior on click.
2. The Cucumber BDD framework has a test matrix feature (aka `Examples` aka `Where`) which is intentionally limited: it does not have loops and conditionals for the sake of simplicity and readability. The fact that I need to use a different assertion depending on whether the button is disabled or not — makes it impossible to put it into a Cucumber test matrix.
Contributor guide
Assessment
This issue has not been assessed yet.