Skip to content

Do not throw an error when clicking on a disabled element #1100

@lolmaus

Description

@lolmaus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions