@abrasileirado/dsgovbr-bootstraped 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/THIRD_PARTY_NOTICES.md +29 -0
  2. package/package.json +8 -3
  3. package/src/scss/_bootstrap-settings.scss +45 -45
  4. package/src/scss/_tokens.scss +23 -23
  5. package/src/scss/index.scss +4 -3
  6. package/vendor/bootstrap/LICENSE +21 -0
  7. package/vendor/bootstrap/README.md +246 -0
  8. package/vendor/bootstrap/scss/_accordion.scss +153 -0
  9. package/vendor/bootstrap/scss/_alert.scss +68 -0
  10. package/vendor/bootstrap/scss/_badge.scss +38 -0
  11. package/vendor/bootstrap/scss/_breadcrumb.scss +40 -0
  12. package/vendor/bootstrap/scss/_button-group.scss +147 -0
  13. package/vendor/bootstrap/scss/_buttons.scss +216 -0
  14. package/vendor/bootstrap/scss/_card.scss +238 -0
  15. package/vendor/bootstrap/scss/_carousel.scss +226 -0
  16. package/vendor/bootstrap/scss/_close.scss +66 -0
  17. package/vendor/bootstrap/scss/_containers.scss +41 -0
  18. package/vendor/bootstrap/scss/_dropdown.scss +250 -0
  19. package/vendor/bootstrap/scss/_forms.scss +9 -0
  20. package/vendor/bootstrap/scss/_functions.scss +302 -0
  21. package/vendor/bootstrap/scss/_grid.scss +39 -0
  22. package/vendor/bootstrap/scss/_helpers.scss +12 -0
  23. package/vendor/bootstrap/scss/_images.scss +42 -0
  24. package/vendor/bootstrap/scss/_list-group.scss +199 -0
  25. package/vendor/bootstrap/scss/_maps.scss +174 -0
  26. package/vendor/bootstrap/scss/_mixins.scss +42 -0
  27. package/vendor/bootstrap/scss/_modal.scss +240 -0
  28. package/vendor/bootstrap/scss/_nav.scss +197 -0
  29. package/vendor/bootstrap/scss/_navbar.scss +289 -0
  30. package/vendor/bootstrap/scss/_offcanvas.scss +147 -0
  31. package/vendor/bootstrap/scss/_pagination.scss +109 -0
  32. package/vendor/bootstrap/scss/_placeholders.scss +51 -0
  33. package/vendor/bootstrap/scss/_popover.scss +196 -0
  34. package/vendor/bootstrap/scss/_progress.scss +68 -0
  35. package/vendor/bootstrap/scss/_reboot.scss +617 -0
  36. package/vendor/bootstrap/scss/_root.scss +187 -0
  37. package/vendor/bootstrap/scss/_spinners.scss +86 -0
  38. package/vendor/bootstrap/scss/_tables.scss +171 -0
  39. package/vendor/bootstrap/scss/_toasts.scss +73 -0
  40. package/vendor/bootstrap/scss/_tooltip.scss +119 -0
  41. package/vendor/bootstrap/scss/_transitions.scss +27 -0
  42. package/vendor/bootstrap/scss/_type.scss +106 -0
  43. package/vendor/bootstrap/scss/_utilities.scss +806 -0
  44. package/vendor/bootstrap/scss/_variables-dark.scss +102 -0
  45. package/vendor/bootstrap/scss/_variables.scss +1753 -0
  46. package/vendor/bootstrap/scss/bootstrap-grid.scss +62 -0
  47. package/vendor/bootstrap/scss/bootstrap-reboot.scss +10 -0
  48. package/vendor/bootstrap/scss/bootstrap-utilities.scss +19 -0
  49. package/vendor/bootstrap/scss/bootstrap.scss +52 -0
  50. package/vendor/bootstrap/scss/forms/_floating-labels.scss +97 -0
  51. package/vendor/bootstrap/scss/forms/_form-check.scss +189 -0
  52. package/vendor/bootstrap/scss/forms/_form-control.scss +214 -0
  53. package/vendor/bootstrap/scss/forms/_form-range.scss +91 -0
  54. package/vendor/bootstrap/scss/forms/_form-select.scss +80 -0
  55. package/vendor/bootstrap/scss/forms/_form-text.scss +11 -0
  56. package/vendor/bootstrap/scss/forms/_input-group.scss +132 -0
  57. package/vendor/bootstrap/scss/forms/_labels.scss +36 -0
  58. package/vendor/bootstrap/scss/forms/_validation.scss +12 -0
  59. package/vendor/bootstrap/scss/helpers/_clearfix.scss +3 -0
  60. package/vendor/bootstrap/scss/helpers/_color-bg.scss +7 -0
  61. package/vendor/bootstrap/scss/helpers/_colored-links.scss +30 -0
  62. package/vendor/bootstrap/scss/helpers/_focus-ring.scss +5 -0
  63. package/vendor/bootstrap/scss/helpers/_icon-link.scss +25 -0
  64. package/vendor/bootstrap/scss/helpers/_position.scss +36 -0
  65. package/vendor/bootstrap/scss/helpers/_ratio.scss +26 -0
  66. package/vendor/bootstrap/scss/helpers/_stacks.scss +15 -0
  67. package/vendor/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  68. package/vendor/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  69. package/vendor/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  70. package/vendor/bootstrap/scss/helpers/_vr.scss +8 -0
  71. package/vendor/bootstrap/scss/mixins/_alert.scss +18 -0
  72. package/vendor/bootstrap/scss/mixins/_backdrop.scss +14 -0
  73. package/vendor/bootstrap/scss/mixins/_banner.scss +7 -0
  74. package/vendor/bootstrap/scss/mixins/_border-radius.scss +78 -0
  75. package/vendor/bootstrap/scss/mixins/_box-shadow.scss +24 -0
  76. package/vendor/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  77. package/vendor/bootstrap/scss/mixins/_buttons.scss +70 -0
  78. package/vendor/bootstrap/scss/mixins/_caret.scss +69 -0
  79. package/vendor/bootstrap/scss/mixins/_clearfix.scss +9 -0
  80. package/vendor/bootstrap/scss/mixins/_color-mode.scss +21 -0
  81. package/vendor/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  82. package/vendor/bootstrap/scss/mixins/_container.scss +11 -0
  83. package/vendor/bootstrap/scss/mixins/_deprecate.scss +10 -0
  84. package/vendor/bootstrap/scss/mixins/_forms.scss +163 -0
  85. package/vendor/bootstrap/scss/mixins/_gradients.scss +47 -0
  86. package/vendor/bootstrap/scss/mixins/_grid.scss +151 -0
  87. package/vendor/bootstrap/scss/mixins/_image.scss +16 -0
  88. package/vendor/bootstrap/scss/mixins/_list-group.scss +26 -0
  89. package/vendor/bootstrap/scss/mixins/_lists.scss +7 -0
  90. package/vendor/bootstrap/scss/mixins/_pagination.scss +10 -0
  91. package/vendor/bootstrap/scss/mixins/_reset-text.scss +17 -0
  92. package/vendor/bootstrap/scss/mixins/_resize.scss +6 -0
  93. package/vendor/bootstrap/scss/mixins/_table-variants.scss +24 -0
  94. package/vendor/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  95. package/vendor/bootstrap/scss/mixins/_transition.scss +26 -0
  96. package/vendor/bootstrap/scss/mixins/_utilities.scss +97 -0
  97. package/vendor/bootstrap/scss/mixins/_visually-hidden.scss +38 -0
  98. package/vendor/bootstrap/scss/tests/jasmine.js +16 -0
  99. package/vendor/bootstrap/scss/tests/mixins/_auto-import-of-variables-dark.test.scss +7 -0
  100. package/vendor/bootstrap/scss/tests/mixins/_box-shadow.test.scss +188 -0
  101. package/vendor/bootstrap/scss/tests/mixins/_color-contrast.test.scss +139 -0
  102. package/vendor/bootstrap/scss/tests/mixins/_color-modes.test.scss +69 -0
  103. package/vendor/bootstrap/scss/tests/mixins/_media-query-color-mode-full.test.scss +8 -0
  104. package/vendor/bootstrap/scss/tests/mixins/_utilities.test.scss +393 -0
  105. package/vendor/bootstrap/scss/tests/sass-true/register.js +14 -0
  106. package/vendor/bootstrap/scss/tests/sass-true/runner.js +17 -0
  107. package/vendor/bootstrap/scss/tests/utilities/_api.test.scss +75 -0
  108. package/vendor/bootstrap/scss/utilities/_api.scss +47 -0
  109. package/vendor/bootstrap/scss/vendor/_rfs.scss +348 -0
@@ -0,0 +1,139 @@
1
+ @import "../../functions";
2
+ @import "../../variables";
3
+ @import "../../variables-dark";
4
+ @import "../../maps";
5
+ @import "../../mixins";
6
+
7
+ @include describe("color-contrast function") {
8
+ @include it("should return a color when contrast ratio equals minimum requirement (WCAG 2.1 compliance)") {
9
+ // Test case: Background color that produces contrast ratio close to 4.5:1
10
+ // This tests the WCAG 2.1 requirement that contrast should be "at least 4.5:1" (>= 4.5)
11
+ // rather than "strictly greater than 4.5:1" (> 4.5)
12
+
13
+ // #777777 produces 4.4776:1 contrast ratio with white text
14
+ // Since this is below the 4.5:1 threshold, it should return the highest available contrast color
15
+ $test-background: #777;
16
+ $result: color-contrast($test-background);
17
+
18
+ @include assert-equal($result, $black, "Should return black (highest available contrast) for background with 4.4776:1 contrast ratio (below threshold)");
19
+ }
20
+
21
+ @include it("should return a color when contrast ratio is above minimum requirement") {
22
+ // Test case: Background color that produces contrast ratio above 4.5:1
23
+ // #767676 produces 4.5415:1 contrast ratio with white text
24
+ $test-background: #767676;
25
+ $result: color-contrast($test-background);
26
+
27
+ @include assert-equal($result, $white, "Should return white for background with 4.5415:1 contrast ratio (above threshold)");
28
+ }
29
+
30
+ @include it("should return a color when contrast ratio is below minimum requirement") {
31
+ // Test case: Background color that produces contrast ratio below 4.5:1
32
+ // #787878 produces 4.4155:1 contrast ratio with white text
33
+ $test-background: #787878;
34
+ $result: color-contrast($test-background);
35
+
36
+ // Should return the color with the highest available contrast ratio
37
+ @include assert-equal($result, $black, "Should return black (highest available contrast) for background with 4.4155:1 contrast ratio (below threshold)");
38
+ }
39
+
40
+ @include it("should handle edge case with very light background") {
41
+ // Test case: Very light background that should return dark text
42
+ $test-background: #f8f9fa; // Very light gray
43
+ $result: color-contrast($test-background);
44
+
45
+ @include assert-equal($result, $color-contrast-dark, "Should return dark text for very light background");
46
+ }
47
+
48
+ @include it("should handle edge case with very dark background") {
49
+ // Test case: Very dark background that should return light text
50
+ $test-background: #212529; // Very dark gray
51
+ $result: color-contrast($test-background);
52
+
53
+ @include assert-equal($result, $color-contrast-light, "Should return light text for very dark background");
54
+ }
55
+
56
+ @include it("should work with custom minimum contrast ratio") {
57
+ // Test case: Using a custom minimum contrast ratio
58
+ $test-background: #666;
59
+ $result: color-contrast($test-background, $color-contrast-dark, $color-contrast-light, 3);
60
+
61
+ @include assert-equal($result, $white, "Should return white when using custom minimum contrast ratio of 3.0");
62
+ }
63
+
64
+ @include it("should test contrast ratio calculation accuracy") {
65
+ // Test case: Verify that contrast-ratio function works correctly
66
+ $background: #767676;
67
+ $foreground: $white;
68
+ $ratio: contrast-ratio($background, $foreground);
69
+ // Bootstrap's implementation calculates this as ~4.5415, not exactly 4.5, due to its luminance math.
70
+ // We use 4.54 as the threshold for this test to match the actual implementation.
71
+ @include assert-true($ratio >= 4.54 and $ratio <= 4.55, "Contrast ratio should be approximately 4.54:1 (Bootstrap's math)");
72
+ }
73
+
74
+ @include it("should test luminance calculation") {
75
+ // Test case: Verify luminance function works correctly
76
+ $white-luminance: luminance($white);
77
+ $black-luminance: luminance($black);
78
+
79
+ @include assert-equal($white-luminance, 1, "White should have luminance of 1");
80
+ @include assert-equal($black-luminance, 0, "Black should have luminance of 0");
81
+ }
82
+
83
+ @include it("should handle rgba colors correctly") {
84
+ // Test case: Test with rgba colors
85
+ $test-background: rgba(118, 118, 118, 1); // Same as #767676
86
+ $result: color-contrast($test-background);
87
+
88
+ @include assert-equal($result, $white, "Should handle rgba colors correctly");
89
+ }
90
+
91
+ @include it("should test the WCAG 2.1 boundary condition with color below threshold") {
92
+ // Test case: Background color that produces contrast ratio below 4.5:1
93
+ // #787878 produces 4.4155:1 contrast ratio with white
94
+ $test-background: #787878; // Produces 4.4155:1 contrast ratio
95
+ $contrast-ratio: contrast-ratio($test-background, $white);
96
+
97
+ // Verify the contrast ratio is below 4.5:1
98
+ @include assert-true($contrast-ratio < 4.5, "Contrast ratio should be below 4.5:1 threshold");
99
+
100
+ // The color-contrast function should return the color with highest available contrast
101
+ $result: color-contrast($test-background);
102
+ @include assert-equal($result, $black, "color-contrast should return black (highest available contrast) for below-threshold ratio");
103
+ }
104
+
105
+ @include it("should test the WCAG 2.1 boundary condition with color at threshold") {
106
+ // Test case: Background color that produces contrast ratio close to 4.5:1
107
+ // #777777 produces 4.4776:1 contrast ratio with white
108
+ $test-background: #777; // Produces 4.4776:1 contrast ratio
109
+ $contrast-ratio: contrast-ratio($test-background, $white);
110
+
111
+ // Verify the contrast ratio is below 4.5:1 threshold
112
+ @include assert-true($contrast-ratio < 4.5, "Contrast ratio is below threshold, function should handle gracefully");
113
+ }
114
+
115
+ @include it("should demonstrate the difference between > and >= operators") {
116
+ // Test case: Demonstrates the difference between > and >= operators
117
+ // Uses #767676 with a custom minimum contrast ratio that matches its actual ratio (4.5415)
118
+ // With > 4.5415: should return black (fallback to highest available)
119
+ // With >= 4.5415: should return white (meets threshold)
120
+
121
+ $test-background: #767676; // Produces 4.5415:1 contrast ratio
122
+ $actual-ratio: contrast-ratio($test-background, $white);
123
+
124
+ // Test with a custom minimum that matches the actual ratio
125
+ $result: color-contrast($test-background, $color-contrast-dark, $color-contrast-light, $actual-ratio);
126
+
127
+ // Should return white when using >= implementation
128
+ @include assert-equal($result, $white, "color-contrast should return white when using exact ratio as threshold (>= implementation)");
129
+ }
130
+
131
+ @include it("should test additional working colors above threshold") {
132
+ // Test case: Background color that produces contrast ratio well above 4.5:1
133
+ // #757575 produces 4.6047:1 contrast ratio with white text
134
+ $test-background: #757575; // Produces 4.6047:1 contrast ratio
135
+ $result: color-contrast($test-background);
136
+
137
+ @include assert-equal($result, $white, "Should return white for background with 4.6047:1 contrast ratio (well above threshold)");
138
+ }
139
+ }
@@ -0,0 +1,69 @@
1
+ // stylelint-disable selector-attribute-quotes
2
+
3
+ @import "../../functions";
4
+ @import "../../variables";
5
+ @import "../../variables-dark";
6
+ @import "../../maps";
7
+ @import "../../mixins";
8
+
9
+ @include describe("global $color-mode-type: data") {
10
+ @include it("generates data attribute selectors for dark mode") {
11
+ @include assert() {
12
+ @include output() {
13
+ @include color-mode(dark) {
14
+ .element {
15
+ color: var(--bs-primary-text-emphasis);
16
+ background-color: var(--bs-primary-bg-subtle);
17
+ }
18
+ }
19
+ @include color-mode(dark, true) {
20
+ --custom-color: #{mix($indigo, $blue, 50%)};
21
+ }
22
+ }
23
+ @include expect() {
24
+ [data-bs-theme=dark] .element {
25
+ color: var(--bs-primary-text-emphasis);
26
+ background-color: var(--bs-primary-bg-subtle);
27
+ }
28
+ [data-bs-theme=dark] {
29
+ --custom-color: #3a3ff8;
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+
36
+ @include describe("global $color-mode-type: media-query") {
37
+ @include it("generates media queries for dark mode") {
38
+ $color-mode-type: media-query !global;
39
+
40
+ @include assert() {
41
+ @include output() {
42
+ @include color-mode(dark) {
43
+ .element {
44
+ color: var(--bs-primary-text-emphasis);
45
+ background-color: var(--bs-primary-bg-subtle);
46
+ }
47
+ }
48
+ @include color-mode(dark, true) {
49
+ --custom-color: #{mix($indigo, $blue, 50%)};
50
+ }
51
+ }
52
+ @include expect() {
53
+ @media (prefers-color-scheme: dark) {
54
+ .element {
55
+ color: var(--bs-primary-text-emphasis);
56
+ background-color: var(--bs-primary-bg-subtle);
57
+ }
58
+ }
59
+ @media (prefers-color-scheme: dark) {
60
+ :root {
61
+ --custom-color: #3a3ff8;
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ $color-mode-type: data !global;
68
+ }
69
+ }
@@ -0,0 +1,8 @@
1
+ $color-mode-type: media-query;
2
+
3
+ @import "../../bootstrap";
4
+
5
+ @include describe("global $color-mode-type: media-query") {
6
+ @include it("compiles entirely Bootstrap CSS with media-query color mode") { // stylelint-disable-line block-no-empty
7
+ }
8
+ }
@@ -0,0 +1,393 @@
1
+ $prefix: bs-;
2
+ $enable-important-utilities: false;
3
+
4
+ // Important: Do not import rfs to check that the mixin just calls the appropriate functions from it
5
+ @import "../../mixins/utilities";
6
+
7
+ @mixin test-generate-utility($params...) {
8
+ @include assert() {
9
+ @include output() {
10
+ @include generate-utility($params...);
11
+ }
12
+
13
+ @include expect() {
14
+ @content;
15
+ }
16
+ }
17
+ }
18
+
19
+ @include describe(generate-utility) {
20
+ @include it("generates a utility class for each value") {
21
+ @include test-generate-utility(
22
+ (
23
+ property: "padding",
24
+ values: (small: .5rem, large: 2rem)
25
+ )
26
+ ) {
27
+ .padding-small {
28
+ padding: .5rem;
29
+ }
30
+
31
+ .padding-large {
32
+ padding: 2rem;
33
+ }
34
+ }
35
+ }
36
+
37
+ @include describe("global $enable-important-utilities: true") {
38
+ @include it("sets !important") {
39
+ $enable-important-utilities: true !global;
40
+
41
+ @include test-generate-utility(
42
+ (
43
+ property: "padding",
44
+ values: (small: .5rem, large: 2rem)
45
+ )
46
+ ) {
47
+ .padding-small {
48
+ padding: .5rem !important;
49
+ }
50
+
51
+ .padding-large {
52
+ padding: 2rem !important;
53
+ }
54
+ }
55
+
56
+ $enable-important-utilities: false !global;
57
+ }
58
+ }
59
+
60
+ @include describe("$utility") {
61
+ @include describe("values") {
62
+ @include it("supports null keys") {
63
+ @include test-generate-utility(
64
+ (
65
+ property: "padding",
66
+ values: (null: 1rem, small: .5rem, large: 2rem)
67
+ ),
68
+ ) {
69
+ .padding {
70
+ padding: 1rem;
71
+ }
72
+
73
+ .padding-small {
74
+ padding: .5rem;
75
+ }
76
+
77
+ .padding-large {
78
+ padding: 2rem;
79
+ }
80
+ }
81
+ }
82
+
83
+ @include it("ignores null values") {
84
+ @include test-generate-utility(
85
+ (
86
+ property: "padding",
87
+ values: (small: null, large: 2rem)
88
+ )
89
+ ) {
90
+ .padding-large {
91
+ padding: 2rem;
92
+ }
93
+ }
94
+ }
95
+
96
+ @include it("supports lists") {
97
+ @include test-generate-utility(
98
+ (
99
+ property: "padding",
100
+ values: 1rem 2rem
101
+ )
102
+ ) {
103
+ .padding-1rem {
104
+ padding: 1rem;
105
+ }
106
+
107
+ .padding-2rem {
108
+ padding: 2rem;
109
+ }
110
+ }
111
+ }
112
+
113
+ @include it("supports single values") {
114
+ @include test-generate-utility(
115
+ (
116
+ property: padding,
117
+ values: 1rem
118
+ )
119
+ ) {
120
+ .padding-1rem {
121
+ padding: 1rem;
122
+ }
123
+ }
124
+ }
125
+ }
126
+
127
+ @include describe("class & property") {
128
+ @include it("adds each property to the declaration") {
129
+ @include test-generate-utility(
130
+ (
131
+ class: padding-x,
132
+ property: padding-inline-start padding-inline-end,
133
+ values: 1rem
134
+ )
135
+ ) {
136
+ .padding-x-1rem {
137
+ padding-inline-start: 1rem;
138
+ padding-inline-end: 1rem;
139
+ }
140
+ }
141
+ }
142
+
143
+ @include it("uses the first property as class name") {
144
+ @include test-generate-utility(
145
+ (
146
+ property: padding-inline-start padding-inline-end,
147
+ values: 1rem
148
+ )
149
+ ) {
150
+ .padding-inline-start-1rem {
151
+ padding-inline-start: 1rem;
152
+ padding-inline-end: 1rem;
153
+ }
154
+ }
155
+ }
156
+
157
+ @include it("supports a null class to create classes straight from the values") {
158
+ @include test-generate-utility(
159
+ (
160
+ property: visibility,
161
+ class: null,
162
+ values: (
163
+ visible: visible,
164
+ invisible: hidden,
165
+ )
166
+ )
167
+ ) {
168
+ .visible {
169
+ visibility: visible;
170
+ }
171
+
172
+ .invisible {
173
+ visibility: hidden;
174
+ }
175
+ }
176
+ }
177
+ }
178
+
179
+ @include describe("state") {
180
+ @include it("Generates selectors for each states") {
181
+ @include test-generate-utility(
182
+ (
183
+ property: padding,
184
+ values: 1rem,
185
+ state: hover focus,
186
+ )
187
+ ) {
188
+ .padding-1rem {
189
+ padding: 1rem;
190
+ }
191
+
192
+ .padding-1rem-hover:hover {
193
+ padding: 1rem;
194
+ }
195
+
196
+ .padding-1rem-focus:focus {
197
+ padding: 1rem;
198
+ }
199
+ }
200
+ }
201
+ }
202
+
203
+ @include describe("css-var"){
204
+ @include it("sets a CSS variable instead of the property") {
205
+ @include test-generate-utility(
206
+ (
207
+ property: padding,
208
+ css-variable-name: padding,
209
+ css-var: true,
210
+ values: 1rem 2rem
211
+ )
212
+ ) {
213
+ .padding-1rem {
214
+ --bs-padding: 1rem;
215
+ }
216
+
217
+ .padding-2rem {
218
+ --bs-padding: 2rem;
219
+ }
220
+ }
221
+ }
222
+
223
+ @include it("defaults to class") {
224
+ @include test-generate-utility(
225
+ (
226
+ property: padding,
227
+ class: padding,
228
+ css-var: true,
229
+ values: 1rem 2rem
230
+ )
231
+ ) {
232
+ .padding-1rem {
233
+ --bs-padding: 1rem;
234
+ }
235
+
236
+ .padding-2rem {
237
+ --bs-padding: 2rem;
238
+ }
239
+ }
240
+ }
241
+ }
242
+
243
+ @include describe("local-vars") {
244
+ @include it("generates the listed variables") {
245
+ @include test-generate-utility(
246
+ (
247
+ property: color,
248
+ class: desaturated-color,
249
+ local-vars: (
250
+ color-opacity: 1,
251
+ color-saturation: .25
252
+ ),
253
+ values: (
254
+ blue: hsla(192deg, var(--bs-color-saturation), 0, var(--bs-color-opacity))
255
+ )
256
+ )
257
+ ) {
258
+ .desaturated-color-blue {
259
+ --bs-color-opacity: 1;
260
+ // Sass compilation will put a leading zero so we want to keep that one
261
+ // stylelint-disable-next-line @stylistic/number-leading-zero
262
+ --bs-color-saturation: 0.25;
263
+ color: hsla(192deg, var(--bs-color-saturation), 0, var(--bs-color-opacity));
264
+ }
265
+ }
266
+ }
267
+ }
268
+
269
+ @include describe("css-var & state") {
270
+ @include it("Generates a rule with for each state with a CSS variable") {
271
+ @include test-generate-utility(
272
+ (
273
+ property: padding,
274
+ css-var: true,
275
+ css-variable-name: padding,
276
+ values: 1rem,
277
+ state: hover focus,
278
+ )
279
+ ) {
280
+ .padding-1rem {
281
+ --bs-padding: 1rem;
282
+ }
283
+
284
+ .padding-1rem-hover:hover {
285
+ --bs-padding: 1rem;
286
+ }
287
+
288
+ .padding-1rem-focus:focus {
289
+ --bs-padding: 1rem;
290
+ }
291
+ }
292
+ }
293
+ }
294
+
295
+ @include describe("rtl") {
296
+ @include it("sets up RTLCSS for removal when false") {
297
+ @include test-generate-utility(
298
+ (
299
+ property: padding,
300
+ values: 1rem,
301
+ rtl: false
302
+ )
303
+ ) {
304
+ /* rtl:begin:remove */
305
+
306
+ .padding-1rem {
307
+ padding: 1rem;
308
+ }
309
+
310
+ /* rtl:end:remove */
311
+
312
+ }
313
+ }
314
+ }
315
+
316
+ @include describe("rfs") {
317
+ @include it("sets the fluid value when not inside media query") {
318
+ @include test-generate-utility(
319
+ (
320
+ property: padding,
321
+ values: 1rem,
322
+ rfs: true
323
+ )
324
+ ) {
325
+ .padding-1rem {
326
+ padding: rfs-fluid-value(1rem);
327
+ }
328
+ }
329
+ }
330
+
331
+ @include it("sets the value when inside the media query") {
332
+ @include test-generate-utility(
333
+ (
334
+ property: padding,
335
+ values: 1rem,
336
+ rfs: true
337
+ ),
338
+ $is-rfs-media-query: true
339
+ ) {
340
+ .padding-1rem {
341
+ padding: rfs-value(1rem);
342
+ }
343
+ }
344
+ }
345
+ }
346
+ }
347
+
348
+ @include describe("$infix") {
349
+ @include it("inserts the given infix") {
350
+ @include test-generate-utility(
351
+ (
352
+ property: "padding",
353
+ values: (null: 1rem, small: .5rem, large: 2rem)
354
+ ),
355
+ $infix: -sm
356
+ ) {
357
+ .padding-sm {
358
+ padding: 1rem;
359
+ }
360
+
361
+ .padding-sm-small {
362
+ padding: .5rem;
363
+ }
364
+
365
+ .padding-sm-large {
366
+ padding: 2rem;
367
+ }
368
+ }
369
+ }
370
+
371
+ @include it("strips leading - if class is null") {
372
+ @include test-generate-utility(
373
+ (
374
+ property: visibility,
375
+ class: null,
376
+ values: (
377
+ visible: visible,
378
+ invisible: hidden,
379
+ )
380
+ ),
381
+ -sm
382
+ ) {
383
+ .sm-visible {
384
+ visibility: visible;
385
+ }
386
+
387
+ .sm-invisible {
388
+ visibility: hidden;
389
+ }
390
+ }
391
+ }
392
+ }
393
+ }
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+
3
+ const path = require('node:path')
4
+
5
+ const runnerPath = path.join(__dirname, 'runner').replace(/\\/g, '/')
6
+
7
+ require.extensions['.scss'] = (module, filename) => {
8
+ const normalizedFilename = filename.replace(/\\/g, '/')
9
+
10
+ return module._compile(`
11
+ const runner = require('${runnerPath}')
12
+ runner('${normalizedFilename}', { describe, it })
13
+ `, filename)
14
+ }
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ const fs = require('node:fs')
4
+ const path = require('node:path')
5
+ const { runSass } = require('sass-true')
6
+
7
+ module.exports = (filename, { describe, it }) => {
8
+ const data = fs.readFileSync(filename, 'utf8')
9
+ const TRUE_SETUP = '$true-terminal-output: false; @import "true";'
10
+ const sassString = TRUE_SETUP + data
11
+
12
+ runSass(
13
+ { describe, it, sourceType: 'string' },
14
+ sassString,
15
+ { loadPaths: [path.dirname(filename)] }
16
+ )
17
+ }