-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path_values.scss
160 lines (143 loc) · 4.65 KB
/
_values.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
@use 'sass:meta';
@use 'utils';
/// # Testing Return Values
/// @group api-assert-values
// Assert True
// -----------
/// Assert that a parameter is truthy.
/// - Empty lists and strings are excluded from default Sass truthyness.
/// Assertions are used inside the `test()` mixin
///
/// @group api-assert-values
///
/// @param {*} $assert -
/// Asserted value to test
/// @param {string} $description [null] -
/// Description of the assertion being tested.
/// A `null` of `false` value generates a default description.
///
/// @example scss -
/// @include true.test('Non-empty strings are truthy') {
/// @include true.assert-true(
/// 'Hello World',
/// 'You can optionally describe the assertion...');
/// }
/// @example scss -
/// @include true.it('Non-empty strings are truthy') {
/// @include true.is-truthy(
/// 'Hello World',
/// 'You can optionally describe the assertion...');
/// }
@mixin assert-true($assert, $description: null) {
@include utils.setup('assert-true', $description);
$truthy: utils.is-truthy($assert);
@include utils.result($truthy, true);
}
/// @alias assert-true
@mixin is-truthy($assert, $description: null) {
@include assert-true($assert, $description);
}
// Assert False
// ------------
/// Assert that a parameter is falsey.
/// - Empty lists and strings are added to default Sass falseyness.
/// to define the expected results of the test.
///
/// @group api-assert-values
///
/// @param {*} $assert -
/// Asserted value to test
/// @param {string} $description [null] -
/// Description of the assertion being tested.
/// A `null` of `false` value generates a default description.
///
/// @example scss -
/// @include true.test('Empty strings are falsey') {
/// @include true.assert-false(
/// '',
/// 'You can optionally describe the assertion...');
/// }
@mixin assert-false($assert, $description: null) {
@include utils.setup('assert-false', $description);
$falsey: not utils.is-truthy($assert);
@include utils.result($falsey, true);
}
/// @alias assert-false
@mixin is-falsy($assert, $description: null) {
@include assert-false($assert, $description);
}
// Assert Equal
// ------------
/// Assert that two parameters are `equal`
/// Assertions are used inside the `test()` mixin
/// to define the expected results of the test.
///
/// @group api-assert-values
///
/// @param {*} $assert -
/// Asserted value to test
/// @param {*} $expected -
/// Expected match
/// @param {string} $description [null] -
/// Description of the assertion being tested
/// (a `null` of `false` value generates a default description)
/// @param {bool} $inspect [false] -
/// Optionally compare inspected values
/// (useful for comparing CSS output rather than Sass values)
///
/// @example scss -
/// @use 'sass:math';
/// @include true.test('Division works as expected in Sass') {
/// @include true.assert-equal(
/// math.div(8, 2), 4,
/// 'You can optionally describe the assertion...');
/// }
@mixin assert-equal($assert, $expected, $description: null, $inspect: false) {
@include utils.setup('assert-equal', $description);
@if $inspect {
$assert: meta.inspect($assert);
$expected: meta.inspect($expected);
}
@include utils.result($assert, $expected);
}
/// @alias assert-equal
@mixin is-equal($assert, $expected, $description: null, $inspect: false) {
@include assert-equal($assert, $expected, $description, $inspect);
}
// Assert UnEqual
// --------------
/// Assert that two parameters are `unequal`
/// Assertions are used inside the `test()` mixin
/// to define the expected results of the test.
///
/// @group api-assert-values
///
/// @param {*} $assert -
/// Asserted value to test
/// @param {*} $expected -
/// Expected mismatch
/// @param {string} $description [null] -
/// Description of the assertion being tested.
/// A `null` of `false` value generates a default description.
/// @param {bool} $inspect [false] -
/// Optionally compare inspected values
/// (useful for comparing CSS output rather than Sass values)
///
/// @example scss -
/// @include true.test('Strings and numbers are not the same') {
/// @include true.assert-unequal(
/// 1em,
/// '1em');
/// }
@mixin assert-unequal($assert, $expected, $description: null, $inspect: false) {
@include utils.setup('assert-unequal', $description);
@if $inspect {
$assert: meta.inspect($assert);
$expected: meta.inspect($expected);
}
@include utils.result($assert, $expected, 'unequal');
}
/// @alias assert-unequal
@mixin not-equal($assert, $expected, $description: null, $inspect: false) {
@include assert-unequal($assert, $expected, $description, $inspect);
}