diff options
Diffstat (limited to 'test/_props.scss')
-rw-r--r-- | test/_props.scss | 124 |
1 files changed, 64 insertions, 60 deletions
diff --git a/test/_props.scss b/test/_props.scss index 021ed4c..71d88c5 100644 --- a/test/_props.scss +++ b/test/_props.scss | |||
@@ -1,5 +1,9 @@ | |||
1 | // sass-lint:disable empty-args | 1 | // sass-lint:disable empty-args |
2 | 2 | ||
3 | @use 'true' as *; | ||
4 | @use '../src/functions'; | ||
5 | @use '../src/props'; | ||
6 | |||
3 | @include describe('Property trees') { | 7 | @include describe('Property trees') { |
4 | @include it('Validate names') { | 8 | @include it('Validate names') { |
5 | $map-valid: ( | 9 | $map-valid: ( |
@@ -24,8 +28,8 @@ | |||
24 | ) | 28 | ) |
25 | ); | 29 | ); |
26 | 30 | ||
27 | @include assert-equal(iro-props-validate($map-valid), true, 'Check valid map'); | 31 | @include assert-equal(props.validate($map-valid), true, 'Check valid map'); |
28 | @include assert-equal(iro-props-validate($map-invalid), false, 'Check invalid map'); | 32 | @include assert-equal(props.validate($map-invalid), false, 'Check invalid map'); |
29 | } | 33 | } |
30 | 34 | ||
31 | @include it('Save / Delete') { | 35 | @include it('Save / Delete') { |
@@ -40,8 +44,8 @@ | |||
40 | ) | 44 | ) |
41 | ); | 45 | ); |
42 | 46 | ||
43 | @include assert-equal(iro-props-store($map), null, 'Save default tree'); | 47 | @include assert-equal(props.store($map), null, 'Save default tree'); |
44 | @include assert-equal(iro-props-clear(), null, 'Delete default tree'); | 48 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
45 | } | 49 | } |
46 | 50 | ||
47 | @include it('Read') { | 51 | @include it('Read') { |
@@ -78,32 +82,32 @@ | |||
78 | ) | 82 | ) |
79 | ); | 83 | ); |
80 | 84 | ||
81 | @include assert-equal(iro-props-store($map1), null, 'Save default tree'); | 85 | @include assert-equal(props.store($map1), null, 'Save default tree'); |
82 | @include assert-equal(iro-props-store($map2, 'test'), null, 'Save "test" tree'); | 86 | @include assert-equal(props.store($map2, 'test'), null, 'Save "test" tree'); |
83 | 87 | ||
84 | @include iro-props-namespace('ns') { | 88 | @include props.namespace('ns') { |
85 | @include assert-equal(iro-props-store($map3, 'namespaced'), null, 'Save "namespaced" tree'); | 89 | @include assert-equal(props.store($map3, 'namespaced'), null, 'Save "namespaced" tree'); |
86 | } | 90 | } |
87 | 91 | ||
88 | @include assert-equal(iro-props-get-static(--background), map-get($map1, --background), 'Get --background in default'); | 92 | @include assert-equal(props.get-static(--background), map-get($map1, --background), 'Get --background in default'); |
89 | @include assert-equal(iro-props-get-static(--buttons --primary --background), map-get(map-get(map-get($map1, --buttons), --primary), --background), 'Get --buttons --primary --background in default'); | 93 | @include assert-equal(props.get-static(--buttons --primary --background), map-get(map-get(map-get($map1, --buttons), --primary), --background), 'Get --buttons --primary --background in default'); |
90 | @include assert-equal(iro-props-get-static(--box, $default: false), false, 'Get nonexistent in default'); | 94 | @include assert-equal(props.get-static(--box, $default: false), false, 'Get nonexistent in default'); |
91 | 95 | ||
92 | @include assert-equal(iro-props-get-static(--background, 'test'), map-get($map2, --background), 'Get --background in "test"'); | 96 | @include assert-equal(props.get-static(--background, 'test'), map-get($map2, --background), 'Get --background in "test"'); |
93 | @include assert-equal(iro-props-get-static(--buttons --primary --background, 'test'), map-get(map-get(map-get($map2, --buttons), --primary), --background), 'Get --buttons --primary --background in "test"'); | 97 | @include assert-equal(props.get-static(--buttons --primary --background, 'test'), map-get(map-get(map-get($map2, --buttons), --primary), --background), 'Get --buttons --primary --background in "test"'); |
94 | @include assert-equal(iro-props-get-static(--box, 'test', $default: false), false, 'Get nonexistent in "test"'); | 98 | @include assert-equal(props.get-static(--box, 'test', $default: false), false, 'Get nonexistent in "test"'); |
95 | 99 | ||
96 | @include assert-equal(iro-props-get-static(--background, 'namespaced', $default: false), false, 'Get --background in "namespaced"'); | 100 | @include assert-equal(props.get-static(--background, 'namespaced', $default: false), false, 'Get --background in "namespaced"'); |
97 | @include assert-equal(iro-props-get-static(--ns --background, 'namespaced'), map-get($map3, --background), 'Get --ns --background in "namespaced"'); | 101 | @include assert-equal(props.get-static(--ns --background, 'namespaced'), map-get($map3, --background), 'Get --ns --background in "namespaced"'); |
98 | @include iro-props-namespace('ns') { | 102 | @include props.namespace('ns') { |
99 | @include assert-equal(iro-props-get-static(--background, 'namespaced'), map-get($map3, --background), 'Get namespaced --background in "namespaced"'); | 103 | @include assert-equal(props.get-static(--background, 'namespaced'), map-get($map3, --background), 'Get namespaced --background in "namespaced"'); |
100 | @include assert-equal(iro-props-get-static(--buttons --primary --background, 'namespaced'), map-get(map-get(map-get($map3, --buttons), --primary), --background), 'Get namespaced --buttons --primary --background in "namespaced"'); | 104 | @include assert-equal(props.get-static(--buttons --primary --background, 'namespaced'), map-get(map-get(map-get($map3, --buttons), --primary), --background), 'Get namespaced --buttons --primary --background in "namespaced"'); |
101 | @include assert-equal(iro-props-get-static(--box, 'namespaced', $default: false), false, 'Get namespaced nonexistent in "namespaced"'); | 105 | @include assert-equal(props.get-static(--box, 'namespaced', $default: false), false, 'Get namespaced nonexistent in "namespaced"'); |
102 | } | 106 | } |
103 | 107 | ||
104 | @include assert-equal(iro-props-clear(), null, 'Delete default tree'); | 108 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
105 | @include assert-equal(iro-props-clear('test'), null, 'Delete "test" tree'); | 109 | @include assert-equal(props.clear('test'), null, 'Delete "test" tree'); |
106 | @include assert-equal(iro-props-clear('namespaced'), null, 'Delete "namespaced" tree'); | 110 | @include assert-equal(props.clear('namespaced'), null, 'Delete "namespaced" tree'); |
107 | } | 111 | } |
108 | 112 | ||
109 | @include it('Overwrite') { | 113 | @include it('Overwrite') { |
@@ -127,15 +131,15 @@ | |||
127 | ) | 131 | ) |
128 | ); | 132 | ); |
129 | 133 | ||
130 | @include assert-equal(iro-props-store($map1), null, 'Save default tree'); | 134 | @include assert-equal(props.store($map1), null, 'Save default tree'); |
131 | @include assert-equal(iro-props-store($map2, $merge: true), null, 'Overwrite default tree'); | 135 | @include assert-equal(props.store($map2, $merge: true), null, 'Overwrite default tree'); |
132 | 136 | ||
133 | @include assert-equal(iro-props-get-static(), iro-map-merge-recursive($map1, $map2), 'After update, get whole map'); | 137 | @include assert-equal(props.get-static(), functions.map-merge-recursive($map1, $map2), 'After update, get whole map'); |
134 | @include assert-equal(iro-props-get-static(--background), map-get($map2, --background), 'After update, get --background'); | 138 | @include assert-equal(props.get-static(--background), map-get($map2, --background), 'After update, get --background'); |
135 | @include assert-equal(iro-props-get-static(--text), map-get($map2, --text), 'After update, get --text'); | 139 | @include assert-equal(props.get-static(--text), map-get($map2, --text), 'After update, get --text'); |
136 | @include assert-equal(iro-props-get-static(--buttons --primary --text), map-get(map-get(map-get($map1, --buttons), --primary), --text), 'After update, get --buttons --primary --text'); | 140 | @include assert-equal(props.get-static(--buttons --primary --text), map-get(map-get(map-get($map1, --buttons), --primary), --text), 'After update, get --buttons --primary --text'); |
137 | 141 | ||
138 | @include assert-equal(iro-props-clear(), null, 'Delete default tree'); | 142 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
139 | } | 143 | } |
140 | 144 | ||
141 | @include it('Native assignment') { | 145 | @include it('Native assignment') { |
@@ -155,10 +159,10 @@ | |||
155 | ); | 159 | ); |
156 | 160 | ||
157 | @include assert('Simple') { | 161 | @include assert('Simple') { |
158 | @include iro-props-store($map); | 162 | @include props.store($map); |
159 | 163 | ||
160 | @include output { | 164 | @include output { |
161 | @include iro-props-assign; | 165 | @include props.assign; |
162 | } | 166 | } |
163 | 167 | ||
164 | @include expect { | 168 | @include expect { |
@@ -170,14 +174,14 @@ | |||
170 | --buttons--default--text: #{map-get(map-get(map-get($map, --buttons), --default), --text)}; | 174 | --buttons--default--text: #{map-get(map-get(map-get($map, --buttons), --default), --text)}; |
171 | } | 175 | } |
172 | 176 | ||
173 | @include iro-props-clear; | 177 | @include props.clear; |
174 | } | 178 | } |
175 | 179 | ||
176 | @include assert('Filtered') { | 180 | @include assert('Filtered') { |
177 | @include iro-props-store($map); | 181 | @include props.store($map); |
178 | 182 | ||
179 | @include output { | 183 | @include output { |
180 | @include iro-props-assign($skip: --buttons); | 184 | @include props.assign($skip: --buttons); |
181 | } | 185 | } |
182 | 186 | ||
183 | @include expect { | 187 | @include expect { |
@@ -185,16 +189,16 @@ | |||
185 | --text: #{map-get($map, --text)}; | 189 | --text: #{map-get($map, --text)}; |
186 | } | 190 | } |
187 | 191 | ||
188 | @include iro-props-clear; | 192 | @include props.clear; |
189 | } | 193 | } |
190 | 194 | ||
191 | @include assert('Namespaced') { | 195 | @include assert('Namespaced') { |
192 | @include iro-props-namespace('ns') { | 196 | @include props.namespace('ns') { |
193 | @include iro-props-store($map); | 197 | @include props.store($map); |
194 | } | 198 | } |
195 | 199 | ||
196 | @include output { | 200 | @include output { |
197 | @include iro-props-assign; | 201 | @include props.assign; |
198 | } | 202 | } |
199 | 203 | ||
200 | @include expect { | 204 | @include expect { |
@@ -206,7 +210,7 @@ | |||
206 | --ns--buttons--default--text: #{map-get(map-get(map-get($map, --buttons), --default), --text)}; | 210 | --ns--buttons--default--text: #{map-get(map-get(map-get($map, --buttons), --default), --text)}; |
207 | } | 211 | } |
208 | 212 | ||
209 | @include iro-props-clear; | 213 | @include props.clear; |
210 | } | 214 | } |
211 | } | 215 | } |
212 | 216 | ||
@@ -226,17 +230,17 @@ | |||
226 | ) | 230 | ) |
227 | ); | 231 | ); |
228 | 232 | ||
229 | @include assert-equal(iro-props-store($map), null, 'Save default tree'); | 233 | @include assert-equal(props.store($map), null, 'Save default tree'); |
230 | 234 | ||
231 | @include assert-equal(iro-props-get(--background), var(--background), 'Get --background'); | 235 | @include assert-equal(props.get(--background), var(--background), 'Get --background'); |
232 | @include assert-equal(iro-props-get(--buttons --primary --text), var(--buttons--primary--text), 'Get --buttons --primary --text'); | 236 | @include assert-equal(props.get(--buttons --primary --text), var(--buttons--primary--text), 'Get --buttons --primary --text'); |
233 | @include assert-equal(iro-props-get(--buttons --secondary --text, $default: false), var(--buttons--secondary--text, false), 'Get --buttons --secondary --text with default'); | 237 | @include assert-equal(props.get(--buttons --secondary --text, $default: false), var(--buttons--secondary--text, false), 'Get --buttons --secondary --text with default'); |
234 | @include iro-props-namespace('buttons') { | 238 | @include props.namespace('buttons') { |
235 | @include assert-equal(iro-props-get(--primary --text), var(--buttons--primary--text), 'Get via namespace "buttons" --primary --text'); | 239 | @include assert-equal(props.get(--primary --text), var(--buttons--primary--text), 'Get via namespace "buttons" --primary --text'); |
236 | @include assert-equal(iro-props-get(--secondary --text, $default: false), var(--buttons--secondary--text, false), 'Get via namespace "buttons" --secondary --text with default'); | 240 | @include assert-equal(props.get(--secondary --text, $default: false), var(--buttons--secondary--text, false), 'Get via namespace "buttons" --secondary --text with default'); |
237 | } | 241 | } |
238 | 242 | ||
239 | @include assert-equal(iro-props-clear(), null, 'Delete default tree'); | 243 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
240 | } | 244 | } |
241 | 245 | ||
242 | @include it('References') { | 246 | @include it('References') { |
@@ -255,25 +259,25 @@ | |||
255 | --background: #eee, | 259 | --background: #eee, |
256 | --buttons: ( | 260 | --buttons: ( |
257 | --primary: ( | 261 | --primary: ( |
258 | --background: iro-props-ref($key: --background) | 262 | --background: props.ref($key: --background) |
259 | ), | 263 | ), |
260 | --default: iro-props-ref($key: --buttons --primary) | 264 | --default: props.ref($key: --buttons --primary) |
261 | ) | 265 | ) |
262 | ); | 266 | ); |
263 | 267 | ||
264 | @include assert-equal(iro-props-store($map1), null, 'Save default tree'); | 268 | @include assert-equal(props.store($map1), null, 'Save default tree'); |
265 | @include assert-equal(iro-props-store($map2, 'second'), null, 'Save "second" tree'); | 269 | @include assert-equal(props.store($map2, 'second'), null, 'Save "second" tree'); |
266 | 270 | ||
267 | @include assert-equal(iro-props-get-static(--buttons --primary --background, 'second'), map-get($map1, --background), 'Get referenced value'); | 271 | @include assert-equal(props.get-static(--buttons --primary --background, 'second'), map-get($map1, --background), 'Get referenced value'); |
268 | @include assert-equal(iro-props-get(--buttons --primary --background, 'second'), var(--buttons--primary--background), 'Get referenced value, native'); | 272 | @include assert-equal(props.get(--buttons --primary --background, 'second'), var(--buttons--primary--background), 'Get referenced value, native'); |
269 | 273 | ||
270 | @include assert-equal(iro-props-get-static(--buttons --default, 'second'), map-get(map-get($map1, --buttons), --primary), 'Get referenced subtree, whole'); | 274 | @include assert-equal(props.get-static(--buttons --default, 'second'), map-get(map-get($map1, --buttons), --primary), 'Get referenced subtree, whole'); |
271 | @include assert-equal(iro-props-get-static(--buttons --default --background, 'second'), map-get(map-get(map-get($map1, --buttons), --primary), --background), 'Get referenced subtree, inner value'); | 275 | @include assert-equal(props.get-static(--buttons --default --background, 'second'), map-get(map-get(map-get($map1, --buttons), --primary), --background), 'Get referenced subtree, inner value'); |
272 | @include assert-equal(iro-props-get(--buttons --default --background, 'second'), var(--buttons--default--background), 'Get referenced subtree, native'); | 276 | @include assert-equal(props.get(--buttons --default --background, 'second'), var(--buttons--default--background), 'Get referenced subtree, native'); |
273 | 277 | ||
274 | @include assert('Native assignment') { | 278 | @include assert('Native assignment') { |
275 | @include output { | 279 | @include output { |
276 | @include iro-props-assign('second'); | 280 | @include props.assign('second'); |
277 | } | 281 | } |
278 | 282 | ||
279 | @include expect { | 283 | @include expect { |
@@ -284,7 +288,7 @@ | |||
284 | } | 288 | } |
285 | } | 289 | } |
286 | 290 | ||
287 | @include assert-equal(iro-props-clear(), null, 'Delete default tree'); | 291 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
288 | @include assert-equal(iro-props-clear('second'), null, 'Delete "second" tree'); | 292 | @include assert-equal(props.clear('second'), null, 'Delete "second" tree'); |
289 | } | 293 | } |
290 | } | 294 | } |