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

feat: Enable name attribute as an independent selector config #6

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

mike-plummer
Copy link

Currently, the name attribute would only be utilized in a generated selector if a class-based option cannot be created. For UI Coverage several issues exist where we need to generate selectors around form fields and those can be identified in a more stable manner using the name attribute in situations where id is not present.

https://cypress-io.atlassian.net/browse/CYCLOUD-2174?focusedCommentId=30643
https://cypress-io.atlassian.net/browse/CYCLOUD-2111

I've chosen to break this out as a separate option in parallel with the existing attributes option - using that existing option would require elevating attributes above class and would have a much broader impact on the style & structure of generated selectors beyond the very targeted behavior change I'm looking for.

Reviewer note: I think I don't have to do a CSS.escape on the attribute value here since it's inside quotes, but correct me if I'm wrong

@CLAassistant
Copy link

CLAassistant commented Jan 17, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 This should be considered a breaking change since we're changing the default selectorTypes, right?

@mike-plummer
Copy link
Author

Looks good 👍 This should be considered a breaking change since we're changing the default selectorTypes, right?

Good point - is it enough to throw a "BREAKING CHANGE:" into the squash commit body?

@chrisbreiding
Copy link
Collaborator

Good point - is it enough to throw a "BREAKING CHANGE:" into the squash commit body?

I'd put some text after it just to be safe. I'm not sure how particular semantic-release is in regards to that. Something like this for the commit:

 feat: Enable name attribute as an independent selector config #6 
 
 BREAKING CHANGE: Default selectorTypes is now ['id', 'name', 'class', 'tag', 'nth-child']

@mike-plummer mike-plummer merged commit cdf1116 into master Jan 17, 2024
3 checks passed
@mike-plummer mike-plummer deleted the mikep/name-selector branch January 17, 2024 17:23
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants