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

Add support :target filter option on :link selector #2656

Merged
merged 1 commit into from Apr 2, 2023

Conversation

ydah
Copy link
Contributor

@ydah ydah commented Mar 28, 2023

This PR add support :target filter option on :link selector.

Motivation

When wanting to write a test that checks whether the HTML < a > target attribute has been set to _blank or not, it is currently not possible to use matchers like has_link?. If passing it as an option raises an invalid option error.

Failures:

  1) something something test
     Failure/Error: expect(page).to have_link(target: '_blank')

     ArgumentError:
       Invalid option(s) :target, should be one of :above, :below, :left_of, :right_of, :near, :count, :minimum, :maximum, :between, :text, :id, :class, :style, :visible, :obscured, :exact, :exact_text, :normalize_ws, :match, :wait, :filter_set, :focused, :href, :alt, :title, :download

Therefore, we would like to support filtering by the target option. What do you think?

This PR add support `:target` filter option on `:link` selector.

## Motivation

When wanting to write a test that checks whether the [HTML <a> target attribute](https://www.w3schools.com/tags/att_a_target.asp) has been set to `_blank` or not, it is currently not possible to use matchers like `has_link?`.
If passing it as an option raises an invalid option error.

```
Failures:

  1) something something test
     Failure/Error: expect(page).to have_link(target: '_blank')

     ArgumentError:
       Invalid option(s) :target, should be one of :above, :below, :left_of, :right_of, :near, :count, :minimum, :maximum, :between, :text, :id, :class, :style, :visible, :obscured, :exact, :exact_text, :normalize_ws, :match, :wait, :filter_set, :focused, :href, :alt, :title, :download
```

Therefore, I would like to support filtering by the target option.
@twalpole twalpole merged commit 7cdbe96 into teamcapybara:master Apr 2, 2023
@ydah ydah deleted the support-target-for-link branch April 3, 2023 02:00
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

Successfully merging this pull request may close these issues.

None yet

2 participants