-
Notifications
You must be signed in to change notification settings - Fork 115
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
Component-Specific CSS Selector Tests #1574
Conversation
🦋 Changeset detectedLatest commit: fa62e91 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Let's do this one in a separate PR |
…s, by component class
.github/workflows/test_css.yml
Outdated
cancel-in-progress: true | ||
|
||
jobs: | ||
selectors: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this to the test.yml
file?
.github/workflows/test_css.yml
Outdated
name: Component-specific selectors | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the fail-fast
is doing anything here outside of the matrix context
Co-authored-by: Jon Rohan <[email protected]>
…-css-selector-tests
|
…or-tests' into mxriverlynn/component-css-selector-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
/* &:focus { | ||
@mixin focusOutline; | ||
} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this commented out, PCSS copies it as a literal comment with no parsing into the final css output. this was causing test/components/component_css_test.rb
to fail in the test suite, because that test looks for the presence of any &
regardless of context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it
Description
This PR adds component-specific CSS selector tests to PVC. It looks at the css created for a specific component, and compares it to the CSS selectors that are produced by the various lookbook previews for the component. selectors that are not found in the immediate previews (not counting preview params) will fail the component-specific selector CI test and list the components that need additional previews.
some custom selectors are not applicable to this test and can be ignored by modifying the
IGNORED_SELECTORS
const intest/css/component_specific_selectors_test.rb
. these often include selectors based on state, such as:hover
or a specificaria
tag.Current Failures
This PR contains a few known failures in the CI step for testing selectors. This is caused by existing components with many selectors that either need to be ignored or for which previews need to be built. Because of the current volatility in these selectors and failures, the CI step for testing selectors is left as optional. This should allow the PR to land as-is, and let future PRs add the needed ignores and previews.
These components are currently known to be failing:
Primer::Alpha::ActionList
Primer::Beta::BlankSlate
Primer::Beta::Button
Primer::Beta::Label
Once these components are passing successfully, it's recommended the CI step for testing custom selectors be marked as required.
PR Task List:
Component Preview Groups
There was a need to add many new previews that only differ by one param. Rather than exploding the list of items in the left hand navigation, preview groups are being added to the components where it makes sense.
For example, this is the new preview for
Primer::Alpha::SegmentedControl
, looking at the "Full Width" group:The full list of components that have grouped previews, added in this PR:
Primer::Alpha::Banner
Primer::Alpha::SegmentedControl
Primer::Beta::Counter
Primer::Beta::ProgressBar
Integration
no. this primarily applies to CI builds of PVC while incidentally improving lookbook previews for some components
Merge checklist
Run Component-Specific Selector tests
Example Output from Failed Run: