diff options
Diffstat (limited to 'test/_props.scss')
| -rw-r--r-- | test/_props.scss | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/test/_props.scss b/test/_props.scss index 71d88c5..d8b550b 100644 --- a/test/_props.scss +++ b/test/_props.scss | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | // sass-lint:disable empty-args | 1 | // sass-lint:disable empty-args |
| 2 | 2 | ||
| 3 | @use 'sass:map'; | ||
| 3 | @use 'true' as *; | 4 | @use 'true' as *; |
| 4 | @use '../src/functions'; | 5 | @use '../src/functions'; |
| 5 | @use '../src/props'; | 6 | @use '../src/props'; |
| @@ -89,20 +90,20 @@ | |||
| 89 | @include assert-equal(props.store($map3, 'namespaced'), null, 'Save "namespaced" tree'); | 90 | @include assert-equal(props.store($map3, 'namespaced'), null, 'Save "namespaced" tree'); |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | @include assert-equal(props.get-static(--background), map-get($map1, --background), 'Get --background in default'); | 93 | @include assert-equal(props.get-static(--background), map-get($map1, --background), 'Get --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'); | 94 | @include assert-equal(props.get-static(--buttons --primary --background), map-get($map1, --buttons, --primary, --background), 'Get --buttons --primary --background in default'); |
| 94 | @include assert-equal(props.get-static(--box, $default: false), false, 'Get nonexistent in default'); | 95 | @include assert-equal(props.get-static(--box, $default: false), false, 'Get nonexistent in default'); |
| 95 | 96 | ||
| 96 | @include assert-equal(props.get-static(--background, 'test'), map-get($map2, --background), 'Get --background in "test"'); | 97 | @include assert-equal(props.get-static(--background, 'test'), map-get($map2, --background), 'Get --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"'); | 98 | @include assert-equal(props.get-static(--buttons --primary --background, 'test'), map-get($map2, --buttons, --primary, --background), 'Get --buttons --primary --background in "test"'); |
| 98 | @include assert-equal(props.get-static(--box, 'test', $default: false), false, 'Get nonexistent in "test"'); | 99 | @include assert-equal(props.get-static(--box, 'test', $default: false), false, 'Get nonexistent in "test"'); |
| 99 | 100 | ||
| 100 | @include assert-equal(props.get-static(--background, 'namespaced', $default: false), false, 'Get --background in "namespaced"'); | 101 | @include assert-equal(props.get-static(--background, 'namespaced', $default: false), false, 'Get --background in "namespaced"'); |
| 101 | @include assert-equal(props.get-static(--ns --background, 'namespaced'), map-get($map3, --background), 'Get --ns --background in "namespaced"'); | 102 | @include assert-equal(props.get-static(--ns --background, 'namespaced'), map-get($map3, --background), 'Get --ns --background in "namespaced"'); |
| 102 | @include props.namespace('ns') { | 103 | @include props.namespace('ns') { |
| 103 | @include assert-equal(props.get-static(--background, 'namespaced'), map-get($map3, --background), 'Get namespaced --background in "namespaced"'); | 104 | @include assert-equal(props.get-static(--background, 'namespaced'), map-get($map3, --background), 'Get namespaced --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"'); | 105 | @include assert-equal(props.get-static(--buttons --primary --background, 'namespaced'), map-get($map3, --buttons, --primary, --background), 'Get namespaced --buttons --primary --background in "namespaced"'); |
| 105 | @include assert-equal(props.get-static(--box, 'namespaced', $default: false), false, 'Get namespaced nonexistent in "namespaced"'); | 106 | @include assert-equal(props.get-static(--box, 'namespaced', $default: false), false, 'Get namespaced nonexistent in "namespaced"'); |
| 106 | } | 107 | } |
| 107 | 108 | ||
| 108 | @include assert-equal(props.clear(), null, 'Delete default tree'); | 109 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
| @@ -134,10 +135,10 @@ | |||
| 134 | @include assert-equal(props.store($map1), null, 'Save default tree'); | 135 | @include assert-equal(props.store($map1), null, 'Save default tree'); |
| 135 | @include assert-equal(props.store($map2, $merge: true), null, 'Overwrite default tree'); | 136 | @include assert-equal(props.store($map2, $merge: true), null, 'Overwrite default tree'); |
| 136 | 137 | ||
| 137 | @include assert-equal(props.get-static(), functions.map-merge-recursive($map1, $map2), 'After update, get whole map'); | 138 | @include assert-equal(props.get-static(), map.deep-merge($map1, $map2), 'After update, get whole map'); |
| 138 | @include assert-equal(props.get-static(--background), map-get($map2, --background), 'After update, get --background'); | 139 | @include assert-equal(props.get-static(--background), map-get($map2, --background), 'After update, get --background'); |
| 139 | @include assert-equal(props.get-static(--text), map-get($map2, --text), 'After update, get --text'); | 140 | @include assert-equal(props.get-static(--text), map-get($map2, --text), 'After update, get --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'); | 141 | @include assert-equal(props.get-static(--buttons --primary --text), map-get($map1, --buttons, --primary, --text), 'After update, get --buttons --primary --text'); |
| 141 | 142 | ||
| 142 | @include assert-equal(props.clear(), null, 'Delete default tree'); | 143 | @include assert-equal(props.clear(), null, 'Delete default tree'); |
| 143 | } | 144 | } |
| @@ -168,10 +169,10 @@ | |||
| 168 | @include expect { | 169 | @include expect { |
| 169 | --background: #{map-get($map, --background)}; | 170 | --background: #{map-get($map, --background)}; |
| 170 | --text: #{map-get($map, --text)}; | 171 | --text: #{map-get($map, --text)}; |
| 171 | --buttons--primary--background: #{map-get(map-get(map-get($map, --buttons), --primary), --background)}; | 172 | --buttons--primary--background: #{map-get($map, --buttons, --primary, --background)}; |
| 172 | --buttons--primary--text: #{map-get(map-get(map-get($map, --buttons), --primary), --text)}; | 173 | --buttons--primary--text: #{map-get($map, --buttons, --primary, --text)}; |
| 173 | --buttons--default--background: #{map-get(map-get(map-get($map, --buttons), --default), --background)}; | 174 | --buttons--default--background: #{map-get($map, --buttons, --default, --background)}; |
| 174 | --buttons--default--text: #{map-get(map-get(map-get($map, --buttons), --default), --text)}; | 175 | --buttons--default--text: #{map-get($map, --buttons, --default, --text)}; |
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | @include props.clear; | 178 | @include props.clear; |
| @@ -204,10 +205,10 @@ | |||
| 204 | @include expect { | 205 | @include expect { |
| 205 | --ns--background: #{map-get($map, --background)}; | 206 | --ns--background: #{map-get($map, --background)}; |
| 206 | --ns--text: #{map-get($map, --text)}; | 207 | --ns--text: #{map-get($map, --text)}; |
| 207 | --ns--buttons--primary--background: #{map-get(map-get(map-get($map, --buttons), --primary), --background)}; | 208 | --ns--buttons--primary--background: #{map-get($map, --buttons, --primary, --background)}; |
| 208 | --ns--buttons--primary--text: #{map-get(map-get(map-get($map, --buttons), --primary), --text)}; | 209 | --ns--buttons--primary--text: #{map-get($map, --buttons, --primary, --text)}; |
| 209 | --ns--buttons--default--background: #{map-get(map-get(map-get($map, --buttons), --default), --background)}; | 210 | --ns--buttons--default--background: #{map-get($map, --buttons, --default, --background)}; |
| 210 | --ns--buttons--default--text: #{map-get(map-get(map-get($map, --buttons), --default), --text)}; | 211 | --ns--buttons--default--text: #{map-get($map, --buttons, --default, --text)}; |
| 211 | } | 212 | } |
| 212 | 213 | ||
| 213 | @include props.clear; | 214 | @include props.clear; |
| @@ -271,9 +272,9 @@ | |||
| 271 | @include assert-equal(props.get-static(--buttons --primary --background, 'second'), map-get($map1, --background), 'Get referenced value'); | 272 | @include assert-equal(props.get-static(--buttons --primary --background, 'second'), map-get($map1, --background), 'Get referenced value'); |
| 272 | @include assert-equal(props.get(--buttons --primary --background, 'second'), var(--buttons--primary--background), 'Get referenced value, native'); | 273 | @include assert-equal(props.get(--buttons --primary --background, 'second'), var(--buttons--primary--background), 'Get referenced value, native'); |
| 273 | 274 | ||
| 274 | @include assert-equal(props.get-static(--buttons --default, 'second'), map-get(map-get($map1, --buttons), --primary), 'Get referenced subtree, whole'); | 275 | @include assert-equal(props.get-static(--buttons --default, 'second'), map-get($map1, --buttons, --primary), 'Get referenced subtree, whole'); |
| 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'); | 276 | @include assert-equal(props.get-static(--buttons --default --background, 'second'), map-get($map1, --buttons, --primary, --background), 'Get referenced subtree, inner value'); |
| 276 | @include assert-equal(props.get(--buttons --default --background, 'second'), var(--buttons--default--background), 'Get referenced subtree, native'); | 277 | @include assert-equal(props.get(--buttons --default --background, 'second'), var(--buttons--default--background), 'Get referenced subtree, native'); |
| 277 | 278 | ||
| 278 | @include assert('Native assignment') { | 279 | @include assert('Native assignment') { |
| 279 | @include output { | 280 | @include output { |
| @@ -283,8 +284,8 @@ | |||
| 283 | @include expect { | 284 | @include expect { |
| 284 | --background: #{map-get($map2, --background)}; | 285 | --background: #{map-get($map2, --background)}; |
| 285 | --buttons--primary--background: #{map-get($map1, --background)}; | 286 | --buttons--primary--background: #{map-get($map1, --background)}; |
| 286 | --buttons--default--background: #{map-get(map-get(map-get($map1, --buttons), --primary), --background)}; | 287 | --buttons--default--background: #{map-get($map1, --buttons, --primary, --background)}; |
| 287 | --buttons--default--text: #{map-get(map-get(map-get($map1, --buttons), --primary), --text)}; | 288 | --buttons--default--text: #{map-get($map1, --buttons, --primary, --text)}; |
| 288 | } | 289 | } |
| 289 | } | 290 | } |
| 290 | 291 | ||
