Basic Sass tests for $theme-colors customization
#34967
Open
+187
−0
Conversation
|
Would there be a way to output boolean values, and maybe handle exit codes for proper CI & test integration? Can't play around this for now but even if this is a great step already, it requires we read the output, doesn't it? |
|
This is definitely a spike I want to revisit with @if map.get($theme-colors, "primary") != blue {
@error "That's not the right color.";
}Which would output: Error: "That's not the right color."
╷
29 │ @error "That's not the right color.";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
test/index.scss 29:3 root stylesheet |
|
Latest commits include new tests @ffoodd that use $expected-theme-colors: (
"primary": "",
"secondary": "",
"success": "",
"info": "",
"warning": "",
"danger": "",
"light": "",
"dark": "",
"custom": ""
);
@if map.keys($theme-colors) != map.keys($expected-theme-colors) {
@warn "Keys in $theme-colors don't match expected output.";
@debug "Expected: " + map.keys($expected-theme-colors);
@debug "Actual: " + map.keys($theme-colors);
}
@if map.keys($theme-colors-rgb) != map.keys($expected-theme-colors) {
@warn "Keys in $theme-colors-rgb don't match expected output.";
@debug "Expected: " + map.keys($expected-theme-colors);
@debug "Actual: " + map.keys($theme-colors-rgb);
}
@if map.keys($utilities-colors) != map.keys($expected-theme-colors) {
@warn "Keys in $utilities-colors don't match expected output.";
@debug "Expected: " + map.keys($expected-theme-colors);
@debug "Actual: " + map.keys($utilities-colors);
}➜ ~/work/bootstrap (basic-sass-tests) npm run css-test
> bootstrap@5.1.1 css-test /Users/mdo/work/bootstrap
> sass --style expanded --source-map --embed-sources --no-error-css test/index.scss:test/output.css
Warning: Keys in $theme-colors-rgb don't match expected output.
test/index.scss 61:3 root stylesheet
test/index.scss:62 Debug: Expected: "primary", "secondary", "success", "info", "warning", "danger", "light", "dark", "custom"
test/index.scss:63 Debug: Actual: "primary", "secondary", "success", "info", "warning", "danger", "light", "dark"
Warning: Keys in $utilities-colors don't match expected output.
test/index.scss 66:3 root stylesheet
test/index.scss:67 Debug: Expected: "primary", "secondary", "success", "info", "warning", "danger", "light", "dark", "custom"
test/index.scss:68 Debug: Actual: "primary", "secondary", "success", "info", "warning", "danger", "light", "dark"
Warning: Keys in $utilities-text-colors don't match expected output.
test/index.scss 92:3 root stylesheet
test/index.scss:93 Debug: Expected: "primary", "secondary", "success", "info", "warning", "danger", "light", "dark", "custom", "black", "white", "body"
test/index.scss:94 Debug: Actual: "primary", "secondary", "success", "info", "warning", "danger", "light", "dark", "black", "white", "body" |
XhmikosR
reviewed
Sep 15, 2021
9cb4a6d
to
ec552ae
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a super simple Sass test to demonstrate if our maps are working as intended.
The text was updated successfully, but these errors were encountered: