-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.scss
92 lines (86 loc) · 3.5 KB
/
test.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
@use 'sass:list';
@use 'sass:map';
@use 'sass:meta';
@use 'lib/mixin' as mixin-utils;
@use 'lib/function/list' as list-utils;
@use 'lib/function/map' as map-utils;
@use 'lib/function/math' as math-utils;
@use 'lib/function/meta' as meta-utils;
@use 'lib/function/selector' as selector-utils;
@use 'lib/function/string' as string-utils;
.test {
$test-list: (foo, bar, baz);
$test-map: (foo: bar);
$test-color: #0000ff;
// Mixins
@include mixin-utils.at-root('.test');
@include mixin-utils.has-focus;
@include mixin-utils.hide-text;
@include mixin-utils.hide-visually;
@include mixin-utils.ios-native-scrolling;
@include mixin-utils.is-selectable(true);
@include mixin-utils.last-row(2);
@include mixin-utils.text-ellipsis;
// Functions
$test-functions: (
't-list-concat-1': list-utils.concat($test-list, ','),
't-list-contains-1': list-utils.contains($test-list, foo),
't-list-expand-directions-1': list-utils.expand-directions($test-list),
't-list-first-1': list-utils.first($test-list),
't-list-insert-nth-1': list-utils.insert-nth($test-list, 2, qux),
't-list-last-1': list-utils.last($test-list),
't-list-last-index-1': list-utils.last-index($test-list, bar),
't-list-prepend-1': list-utils.prepend($test-list, qux),
't-list-purge-1': list-utils.purge($test-list),
't-list-remove-1': list-utils.remove($test-list, foo),
't-list-remove-nth-1': list-utils.remove-nth($test-list, 1),
't-list-replace-1': list-utils.replace($test-list, foo, qux),
't-list-replace-nth-1': list-utils.replace-nth($test-list, 1, qux),
't-list-slice-1': list-utils.slice($test-list, 2, 3),
't-map-assign-1': map-utils.assign($test-map),
't-map-deep-get-1': map-utils.deep-get($test-map, 'color'),
't-math-to-length-1': math-utils.to-length(5, 'rem'),
't-meta-is-truthy-1': meta-utils.is-truthy('foo'),
't-meta-strip-unit-1': meta-utils.strip-unit(3),
't-meta-to-number-1': meta-utils.to-number('3.141'),
't-meta-to-string-1': meta-utils.to-string(foo),
't-selector-get-element-name-1': selector-utils.get-element-name('.test'),
't-string-replace-1': string-utils.str-replace('test', 'st', 'oo'),
't-string-split-1': string-utils.split('test'),
);
$test-fixtures: (
't-list-concat-1': 'foo,bar,baz',
't-list-contains-1': true,
't-list-expand-directions-1': (foo, bar, baz, bar),
't-list-first-1': foo,
't-list-insert-nth-1': foo qux bar baz,
't-list-last-1': baz,
't-list-last-index-1': 2,
't-list-prepend-1': (qux, foo, bar, baz),
't-list-purge-1': (foo, bar, baz),
't-list-remove-1': bar baz,
't-list-remove-nth-1': bar baz,
't-list-replace-1': qux bar baz,
't-list-replace-nth-1': qux bar baz,
't-list-slice-1': bar baz,
't-map-assign-1': (foo: bar),
't-map-deep-get-1': null,
't-math-to-length-1': 5rem,
't-meta-is-truthy-1': true,
't-meta-strip-unit-1': 3,
't-meta-to-number-1': 3.141,
't-meta-to-string-1': 'foo',
't-selector-get-element-name-1': 'test',
't-string-replace-1': 'teoo',
't-string-split-1': 't' 'e' 's' 't',
);
@each $key in (map.keys($test-fixtures)) {
$result: map.get($test-functions, $key);
$fixture: map.get($test-fixtures, $key);
@if ($result != $fixture) {
@error 'Comparison test "#{$key}" failing! - Fixture: #{meta.inspect($fixture)} ~vs~ Result: #{meta.inspect($result)}';
} @else {
@debug 'Comparison test "#{$key}" successful! - Fixture: #{meta.inspect($fixture)} ~vs~ Result: #{meta.inspect($result)}';
}
}
}