-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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 SCSS testing of the utilities API #36029
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e88afcb
Set up CSS testing using sass-true and mocha
romaricpascal 93b5113
Add CSS tests to workflow
romaricpascal 7abcb51
Add tests for the generate-utility mixin
romaricpascal f0c60ef
Add tests for utilities generation
romaricpascal 90b6ad8
Fix linting issues
romaricpascal 00ef988
Fix test contents
romaricpascal b9f1696
Remove unnecessary entry in package.json
romaricpascal 4eb2151
Move to Jasmine for running the tests
romaricpascal ba4d397
Move running of CSS tests before CSS build
romaricpascal 11e0ce3
Update linting set up
romaricpascal 5dd8cbf
Remove irrelevant option for sass-true
romaricpascal 2c26d14
Fix linting issues after rebase
romaricpascal 11830d8
Merge branch 'main' into pr/36029
mdo efbee0a
Add color mode tests
mdo b9c8a96
Fix linter
mdo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-env node */ | ||
|
||
const path = require('node:path') | ||
|
||
module.exports = { | ||
spec_dir: 'scss' /* eslint-disable-line camelcase */, | ||
|
||
// Make Mocha look for `.test.scss` files | ||
spec_files: ['**/*.{test,spec}.scss'] /* eslint-disable-line camelcase */, | ||
|
||
// Compile them into JS scripts running `sass-true` | ||
requires: [path.join(__dirname, 'sass-true/register')], | ||
|
||
// Ensure we use `require` so that the require.extensions works | ||
// as `import` completely bypasses it | ||
jsLoader: 'require' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// stylelint-disable selector-attribute-quotes | ||
|
||
@import "../../functions"; | ||
@import "../../variables"; | ||
@import "../../variables-dark"; | ||
@import "../../maps"; | ||
@import "../../mixins"; | ||
|
||
@include describe("global $color-mode-type: data") { | ||
@include it("generates data attribute selectors for dark mode") { | ||
@include assert() { | ||
@include output() { | ||
@include color-mode(dark) { | ||
.element { | ||
color: var(--bs-primary-text); | ||
background-color: var(--bs-primary-bg-subtle); | ||
} | ||
} | ||
@include color-mode(dark, true) { | ||
--custom-color: #{mix($indigo, $blue, 50%)}; | ||
} | ||
} | ||
@include expect() { | ||
[data-bs-theme=dark] .element { | ||
color: var(--bs-primary-text); | ||
background-color: var(--bs-primary-bg-subtle); | ||
} | ||
[data-bs-theme=dark] { | ||
--custom-color: #3a3ff8; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@include describe("global $color-mode-type: media-query") { | ||
@include it("generates media queries for dark mode") { | ||
$color-mode-type: media-query !global; | ||
|
||
@include assert() { | ||
@include output() { | ||
@include color-mode(dark) { | ||
.element { | ||
color: var(--bs-primary-text); | ||
background-color: var(--bs-primary-bg-subtle); | ||
} | ||
} | ||
@include color-mode(dark, true) { | ||
--custom-color: #{mix($indigo, $blue, 50%)}; | ||
} | ||
} | ||
@include expect() { | ||
@media (prefers-color-scheme: dark) { | ||
.element { | ||
color: var(--bs-primary-text); | ||
background-color: var(--bs-primary-bg-subtle); | ||
} | ||
} | ||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--custom-color: #3a3ff8; | ||
} | ||
} | ||
} | ||
} | ||
|
||
$color-mode-type: data !global; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about using the latest jasmine 3.x so that we don't use duplicate packages? We can update to 4.x when karma-jasmine is updated too.
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.
Damn, I'm very confused as to which packages get pulled now. I had originally found a 3.x (3.6 I think), then this morning I looked in the node-modules before adding Jasmine and
jasmine-core
was 4.0.1. I'll double check on the main branch after clearing node-modules 😄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.
Oh, so on main, there's two
jasmine-core
pulled:karma-jasmine
, which is 3.99.1 (brought from it requiring^3.6.0
)4.0.1
(this one I'm not sure of the origin, but I'd guesskarma-jasmine-html-reporter
with>=3.8
)I'll try and align if I can 😄
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.
You should stick to 3.x which is what we specify. The v4.x is a dependency of a dependency, not a direct one.