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

Remove Capybara/ClickLinkOrButtonStyle cop #81

Open
ydah opened this issue Nov 3, 2023 · 4 comments
Open

Remove Capybara/ClickLinkOrButtonStyle cop #81

ydah opened this issue Nov 3, 2023 · 4 comments
Milestone

Comments

@ydah
Copy link
Member

ydah commented Nov 3, 2023

#61 (comment)

@ydah ydah added this to the 3.0 milestone Nov 3, 2023
@Uaitt
Copy link

Uaitt commented Nov 8, 2023

Hey @ydah,

on the current latest release of rubocop-capybara, this cop default is strict. However, since #76 was merged a month ago, the documentation actually says that the default is link_or_button, even thought a release with that change has not been issued.

Even though you are planning to delete this cop, I think you should at least create a new release with the up to date default - this discrepancy between the cop and the documentation can be a pain to rationalise 😢

@zspencer
Copy link

zspencer commented Jan 5, 2024

@ydah I would prefer that we keep this cop; but perhaps have it turned off by default? My team loves that we can rely on it to help us make good accessibility decisions when writing end-to-end tests.

Of course, it's also possible that having this in the linter is "too much" and people who like it can make a rubocop-capybara-accessibility gem and include it!

@ydah
Copy link
Member Author

ydah commented Jan 15, 2024

@zspencer I think proceeding in the direction of deleting Capybara/ClickLinkOrButtonStyle while creating a transition destination as follows. If you have any opinions, I would like to hear them.

@zspencer
Copy link

@ydah This is great! I love it!

jgarber623 pushed a commit to CargoSense/rubocop-cargosense that referenced this issue May 6, 2024
This rule's default enforce style, `link_or_button` [1], introduced a
number of problems [2]. Specifically, I noticed issues switching to
`click_on` from `click_button` [3]. The hack solution is to ignore or
disable the rule in some places but not in others. Not great.

As a result, the rule is slated for removal [4] and replacement [5] by
a new rule. In the interim, configuring this rule to enforce a strict
use of `click_button` and `click_link` is preferential (and, honestly,
more communicative).

In this author's opinion, user interface specs should be explicit about
the markup under test.

[1] https://docs.rubocop.org/rubocop-capybara/cops_capybara.html#capybaraclicklinkorbuttonstyle
[2] rubocop/rubocop-capybara#61
[3] rubocop/rubocop-capybara#61 (comment)
[4] rubocop/rubocop-capybara#81
[5] rubocop/rubocop-capybara#99
jgarber623 pushed a commit to CargoSense/rubocop-cargosense that referenced this issue May 6, 2024
## Description

This rule's default enforce style, `link_or_button` [1], introduced a
number of problems [2]. Specifically, I noticed issues switching to
`click_on` from `click_button` [3]. The hack solution is to ignore or
disable the rule in some places but not in others. Not great.

As a result, the rule is slated for removal [4] and replacement [5] by a
new rule. In the interim, configuring this rule to enforce a strict use
of `click_button` and `click_link` is preferential (and, honestly, more
communicative).

In this author's opinion, user interface specs should be explicit about
the markup under test.

[1]
https://docs.rubocop.org/rubocop-capybara/cops_capybara.html#capybaraclicklinkorbuttonstyle
[2] rubocop/rubocop-capybara#61
[3] rubocop/rubocop-capybara#61 (comment)
[4] rubocop/rubocop-capybara#81
[5] rubocop/rubocop-capybara#99

## Commits

- Configure `Capybara/ClickLinkOrButtonStyle`
- Bump version to v1.1.0
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

No branches or pull requests

3 participants