flint-gs 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -24
- data/lib/flint.rb +4 -72
- data/lib/flint/functions.rb +97 -0
- data/lib/flint/version.rb +4 -0
- data/stylesheets/flint/functions/lib/_list-to-string.scss +16 -10
- data/stylesheets/flint/functions/lib/_string-to-list.scss +2 -2
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +4 -4
- data/stylesheets/flint/mixins/lib/_main.scss +0 -2
- data/tests/bootcamp/_bootcamp.scss +46 -0
- data/tests/bootcamp/core/functions/_actual.scss +3 -0
- data/tests/bootcamp/core/functions/_error.scss +29 -0
- data/tests/bootcamp/core/functions/_expect.scss +6 -0
- data/tests/bootcamp/core/functions/_not-to.scss +5 -0
- data/tests/bootcamp/core/functions/_should.scss +6 -0
- data/tests/bootcamp/core/functions/_to.scss +5 -0
- data/tests/bootcamp/core/mixins/_describe.scss +31 -0
- data/tests/bootcamp/core/mixins/_it.scss +31 -0
- data/tests/bootcamp/core/mixins/_runner.scss +28 -0
- data/tests/bootcamp/core/mixins/_should.scss +46 -0
- data/tests/bootcamp/core/mixins/_xdescribe.scss +9 -0
- data/tests/bootcamp/core/mixins/_xit.scss +9 -0
- data/tests/bootcamp/core/variables/_helpers.scss +5 -0
- data/tests/bootcamp/core/variables/_settings.scss +2 -0
- data/tests/bootcamp/core/variables/_should.scss +6 -0
- data/tests/bootcamp/core/variables/_trackers.scss +6 -0
- data/tests/bootcamp/lib/_sassyjson.scss +1075 -0
- data/tests/bootcamp/matchers/_be.scss +3 -0
- data/tests/bootcamp/matchers/_equal.scss +3 -0
- data/tests/bootcamp/matchers/lists/_be-empty.scss +3 -0
- data/tests/bootcamp/matchers/lists/_be-longer-than.scss +3 -0
- data/tests/bootcamp/matchers/lists/_be-shorter-than.scss +3 -0
- data/tests/bootcamp/matchers/lists/_contain.scss +3 -0
- data/tests/bootcamp/matchers/lists/_deep-contain.scss +3 -0
- data/tests/bootcamp/matchers/lists/_deep-equal.scss +47 -0
- data/tests/bootcamp/matchers/lists/_have-length-of.scss +3 -0
- data/tests/bootcamp/matchers/numbers/_be-close-to.scss +12 -0
- data/tests/bootcamp/matchers/numbers/_be-greater-than.scss +12 -0
- data/tests/bootcamp/matchers/numbers/_be-less-than.scss +12 -0
- data/tests/bootcamp/matchers/types/_be-falsy.scss +3 -0
- data/tests/bootcamp/matchers/types/_be-null.scss +3 -0
- data/tests/bootcamp/matchers/types/_be-truthy.scss +3 -0
- data/tests/bootcamp/matchers/types/_have-type-of.scss +3 -0
- data/tests/bootcamp/utils/_contain.scss +15 -0
- data/tests/bootcamp/utils/_equal.scss +23 -0
- data/tests/bootcamp/utils/_list-join.scss +35 -0
- data/tests/bootcamp/utils/_power.scss +15 -0
- data/tests/config.rb +52 -0
- data/tests/input/functions/_functions.scss +48 -0
- data/tests/input/functions/helpers/_helpers.scss +416 -0
- data/tests/input/functions/lib/_calc-breakpoint.scss +62 -0
- data/tests/input/functions/lib/_calc-width.scss +195 -0
- data/tests/input/functions/lib/_exists.scss +30 -0
- data/tests/input/functions/lib/_fluid-width.scss +32 -0
- data/tests/input/functions/lib/_get-index.scss +31 -0
- data/tests/input/functions/lib/_get-instance-value.scss +72 -0
- data/tests/input/functions/lib/_get-value.scss +28 -0
- data/tests/input/functions/lib/_has-family-instance.scss +35 -0
- data/tests/input/functions/lib/_instance.scss +187 -0
- data/tests/input/functions/lib/_last.scss +18 -0
- data/tests/input/functions/lib/_list-to-string.scss +28 -0
- data/tests/input/functions/lib/_map-fetch.scss +34 -0
- data/tests/input/functions/lib/_next-index.scss +24 -0
- data/tests/input/functions/lib/_purge.scss +14 -0
- data/tests/input/functions/lib/_remove.scss +14 -0
- data/tests/input/functions/lib/_replace-substring.scss +14 -0
- data/tests/input/functions/lib/_replace.scss +14 -0
- data/tests/input/functions/lib/_steal-key.scss +19 -0
- data/tests/input/functions/lib/_steal-values.scss +16 -0
- data/tests/input/functions/lib/_string-to-list.scss +28 -0
- data/tests/input/functions/lib/_support-syntax-bem.scss +14 -0
- data/tests/input/functions/lib/_support-syntax.scss +21 -0
- data/tests/input/functions/lib/_types-in-list.scss +50 -0
- data/tests/input/functions/lib/_use-syntax.scss +14 -0
- data/tests/input/output.scss +243 -0
- data/tests/output/output.css +1900 -0
- data/tests/tests.html +110 -0
- metadata +170 -4
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
* Checks if instance flint-exists in selector familiy tree, falls back from current selector
|
3
|
+
*/
|
4
|
+
@include describe("[function] has-family-instance") {
|
5
|
+
|
6
|
+
@include it("should expect to return false unless inside of a parent instance") {
|
7
|
+
@include should(expect(
|
8
|
+
flint-has-family-instance("desktop")),
|
9
|
+
to(be(false))
|
10
|
+
);
|
11
|
+
}
|
12
|
+
|
13
|
+
.parent-instance {
|
14
|
+
@include _("laptop", 4);
|
15
|
+
|
16
|
+
.child-instance {
|
17
|
+
@include _("laptop", 2) {
|
18
|
+
|
19
|
+
@include it("should expect to return true unless instance doesnt exist") {
|
20
|
+
@include should(expect(
|
21
|
+
flint-has-family-instance("desktop")),
|
22
|
+
to(be(false))
|
23
|
+
);
|
24
|
+
@include should(expect(
|
25
|
+
flint-has-family-instance("laptop")),
|
26
|
+
to(be(".parent-instance::laptop"))
|
27
|
+
);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
$flint__instances: () !global;
|
34
|
+
$flint__instance-count: 0 !global;
|
35
|
+
}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
/*
|
2
|
+
* Keeps count of all instances with arguments, stores in global var
|
3
|
+
*/
|
4
|
+
@include describe("[function] instance") {
|
5
|
+
|
6
|
+
$pseudo-instance: (
|
7
|
+
".instance::desktop": (
|
8
|
+
"instance-count": 1,
|
9
|
+
"parent-selector": none,
|
10
|
+
"key": "desktop",
|
11
|
+
"breakpoint": 80em,
|
12
|
+
"columns": 16,
|
13
|
+
"span": 4,
|
14
|
+
"context": null,
|
15
|
+
"gutter": null,
|
16
|
+
"internal": (
|
17
|
+
"width": 18.75em,
|
18
|
+
"margin-right": 0.625em,
|
19
|
+
"margin-left": 0.625em
|
20
|
+
)
|
21
|
+
)
|
22
|
+
);
|
23
|
+
|
24
|
+
.instance {
|
25
|
+
@include _("desktop", 4);
|
26
|
+
|
27
|
+
@at-root {
|
28
|
+
@include it("should expect instance map to match pseudo instance") {
|
29
|
+
@include should(expect(inspect($flint__instances)), to(be(inspect($pseudo-instance))));
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
$flint__instances: () !global;
|
34
|
+
$flint__instance-count: 0 !global;
|
35
|
+
|
36
|
+
$flint__instances: flint-instance("desktop", 4, null, null, 18.75em, 0.625em, 0.625em) !global;
|
37
|
+
|
38
|
+
@at-root {
|
39
|
+
@include it("should expect instance map to match pseudo instance") {
|
40
|
+
@include should(expect(inspect($flint__instances)), to(be(inspect($pseudo-instance))));
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
$flint__instances: () !global;
|
46
|
+
$flint__instance-count: 0 !global;
|
47
|
+
|
48
|
+
$pseudo-instance: (
|
49
|
+
".parent-instance .child-instance::mobile": (
|
50
|
+
"instance-count": 8,
|
51
|
+
"parent-selector": ".parent-instance::mobile",
|
52
|
+
"key": "mobile",
|
53
|
+
"breakpoint": 20em,
|
54
|
+
"columns": 4,
|
55
|
+
"span": 2,
|
56
|
+
"context": 4,
|
57
|
+
"gutter": null,
|
58
|
+
"internal": (
|
59
|
+
"width": 8.125em,
|
60
|
+
"margin-right": 0.625em,
|
61
|
+
"margin-left": 0.625em
|
62
|
+
)
|
63
|
+
),
|
64
|
+
".parent-instance .child-instance::tablet": (
|
65
|
+
"instance-count": 7,
|
66
|
+
"parent-selector": ".parent-instance::tablet",
|
67
|
+
"key": "tablet",
|
68
|
+
"breakpoint": 40em,
|
69
|
+
"columns": 8,
|
70
|
+
"span": 2,
|
71
|
+
"context": 4,
|
72
|
+
"gutter": null,
|
73
|
+
"internal": (
|
74
|
+
"width": 8.125em,
|
75
|
+
"margin-right": 0.625em,
|
76
|
+
"margin-left": 0.625em
|
77
|
+
)
|
78
|
+
),
|
79
|
+
".parent-instance .child-instance::laptop": (
|
80
|
+
"instance-count": 6,
|
81
|
+
"parent-selector": ".parent-instance::laptop",
|
82
|
+
"key": "laptop",
|
83
|
+
"breakpoint": 60em,
|
84
|
+
"columns": 12,
|
85
|
+
"span": 2,
|
86
|
+
"context": 4,
|
87
|
+
"gutter": null,
|
88
|
+
"internal": (
|
89
|
+
"width": 8.125em,
|
90
|
+
"margin-right": 0.625em,
|
91
|
+
"margin-left": 0.625em
|
92
|
+
)
|
93
|
+
),
|
94
|
+
".parent-instance .child-instance::desktop": (
|
95
|
+
"instance-count": 5,
|
96
|
+
"parent-selector": ".parent-instance::desktop",
|
97
|
+
"key": "desktop",
|
98
|
+
"breakpoint": 80em,
|
99
|
+
"columns": 16,
|
100
|
+
"span": 2,
|
101
|
+
"context": 4,
|
102
|
+
"gutter": null,
|
103
|
+
"internal": (
|
104
|
+
"width": 8.125em,
|
105
|
+
"margin-right": 0.625em,
|
106
|
+
"margin-left": 0.625em
|
107
|
+
)
|
108
|
+
),
|
109
|
+
".parent-instance::mobile": (
|
110
|
+
"instance-count": 4,
|
111
|
+
"parent-selector": none,
|
112
|
+
"key": "mobile",
|
113
|
+
"breakpoint": 20em,
|
114
|
+
"columns": 4,
|
115
|
+
"span": 4,
|
116
|
+
"context": null,
|
117
|
+
"gutter": null,
|
118
|
+
"internal": (
|
119
|
+
"width": 18.75em,
|
120
|
+
"margin-right": 0.625em,
|
121
|
+
"margin-left": 0.625em
|
122
|
+
)
|
123
|
+
),
|
124
|
+
".parent-instance::tablet": (
|
125
|
+
"instance-count": 3,
|
126
|
+
"parent-selector": none,
|
127
|
+
"key": "tablet",
|
128
|
+
"breakpoint": 40em,
|
129
|
+
"columns": 8,
|
130
|
+
"span": 4,
|
131
|
+
"context": null,
|
132
|
+
"gutter": null,
|
133
|
+
"internal": (
|
134
|
+
"width": 18.75em,
|
135
|
+
"margin-right": 0.625em,
|
136
|
+
"margin-left": 0.625em
|
137
|
+
)
|
138
|
+
),
|
139
|
+
".parent-instance::laptop": (
|
140
|
+
"instance-count": 2,
|
141
|
+
"parent-selector": none,
|
142
|
+
"key": "laptop",
|
143
|
+
"breakpoint": 60em,
|
144
|
+
"columns": 12,
|
145
|
+
"span": 4,
|
146
|
+
"context": null,
|
147
|
+
"gutter": null,
|
148
|
+
"internal": (
|
149
|
+
"width": 18.75em,
|
150
|
+
"margin-right": 0.625em,
|
151
|
+
"margin-left": 0.625em
|
152
|
+
)
|
153
|
+
),
|
154
|
+
".parent-instance::desktop": (
|
155
|
+
"instance-count": 1,
|
156
|
+
"parent-selector": none,
|
157
|
+
"key": "desktop",
|
158
|
+
"breakpoint": 80em,
|
159
|
+
"columns": 16,
|
160
|
+
"span": 4,
|
161
|
+
"context": null,
|
162
|
+
"gutter": null,
|
163
|
+
"internal": (
|
164
|
+
"width": 18.75em,
|
165
|
+
"margin-right": 0.625em,
|
166
|
+
"margin-left": 0.625em
|
167
|
+
)
|
168
|
+
)
|
169
|
+
);
|
170
|
+
|
171
|
+
.parent-instance {
|
172
|
+
@include _(4);
|
173
|
+
|
174
|
+
.child-instance {
|
175
|
+
@include _(2, "auto");
|
176
|
+
|
177
|
+
@at-root {
|
178
|
+
@include it("should expect instance map to match pseudo instance map") {
|
179
|
+
@include should(expect(inspect($flint__instances)), to(be(inspect($pseudo-instance))));
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
$flint__instances: () !global;
|
186
|
+
$flint__instance-count: 0 !global;
|
187
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/*
|
2
|
+
* Get last item in list
|
3
|
+
*/
|
4
|
+
@include describe("[function] last") {
|
5
|
+
|
6
|
+
$list: ("one", "two", "three");
|
7
|
+
|
8
|
+
@include it("should expect to return the last item in list") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-last($list)),
|
11
|
+
to(be("three"))
|
12
|
+
);
|
13
|
+
@include should(expect(
|
14
|
+
flint-last($list)),
|
15
|
+
not-to(be("two"))
|
16
|
+
);
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
* Joins all elements of list with passed glue
|
3
|
+
*/
|
4
|
+
@include describe("[function] list-to-string") {
|
5
|
+
|
6
|
+
$list: ("one", "two", "three");
|
7
|
+
|
8
|
+
@include it("should expect the list to be converted into a string without spaces") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-list-to-string($list)),
|
11
|
+
to(be("onetwothree"))
|
12
|
+
);
|
13
|
+
}
|
14
|
+
|
15
|
+
@include it("should expect the list to be converted into a string with spaces") {
|
16
|
+
@include should(expect(
|
17
|
+
flint-list-to-string($list, " ")),
|
18
|
+
to(be("one two three"))
|
19
|
+
);
|
20
|
+
}
|
21
|
+
|
22
|
+
@include it("should expect the list to be converted into a string with commas") {
|
23
|
+
@include should(expect(
|
24
|
+
flint-list-to-string($list, ", ")),
|
25
|
+
to(be("one, two, three"))
|
26
|
+
);
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
* Fetch value from map
|
3
|
+
*/
|
4
|
+
@include describe("[function] map-fetch") {
|
5
|
+
|
6
|
+
$map: (
|
7
|
+
"key": "value",
|
8
|
+
"deep-map": (
|
9
|
+
"deep-key": "deep-value"
|
10
|
+
)
|
11
|
+
);
|
12
|
+
|
13
|
+
@include it("should expect values to be fetched from map") {
|
14
|
+
@include should(expect(
|
15
|
+
flint-map-fetch($map, "key")),
|
16
|
+
to(be("value"))
|
17
|
+
);
|
18
|
+
@include should(expect(
|
19
|
+
flint-map-fetch($map, "deep-map", "deep-key")),
|
20
|
+
to(be("deep-value"))
|
21
|
+
);
|
22
|
+
}
|
23
|
+
|
24
|
+
@include it("should expect non-existent values to return false") {
|
25
|
+
@include should(expect(
|
26
|
+
flint-map-fetch($map, "unknown")),
|
27
|
+
to(be(false))
|
28
|
+
);
|
29
|
+
@include should(expect(
|
30
|
+
flint-map-fetch($map, "deep-map", "unknown")),
|
31
|
+
to(be(false))
|
32
|
+
);
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/*
|
2
|
+
* Returns next indexed key based on passed index
|
3
|
+
*/
|
4
|
+
@include describe("[function] next-index") {
|
5
|
+
|
6
|
+
@include it("should expect alias of next indexed breakpoint") {
|
7
|
+
@include should(expect(
|
8
|
+
flint-next-index(1)),
|
9
|
+
to(be("laptop"))
|
10
|
+
);
|
11
|
+
@include should(expect(
|
12
|
+
flint-next-index(2)),
|
13
|
+
to(be("tablet"))
|
14
|
+
);
|
15
|
+
@include should(expect(
|
16
|
+
flint-next-index(3)),
|
17
|
+
to(be("mobile"))
|
18
|
+
);
|
19
|
+
@include should(expect(
|
20
|
+
flint-next-index(4)),
|
21
|
+
to(be(false))
|
22
|
+
);
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* Removes all false and null values from $list
|
3
|
+
*/
|
4
|
+
@include describe("[function] purge") {
|
5
|
+
|
6
|
+
$list: (true, false, "string", "", null, 1);
|
7
|
+
|
8
|
+
@include it("should expect all falsey values to be removed") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-purge($list)),
|
11
|
+
to(be((true, "string", 1)))
|
12
|
+
);
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* Remove value from list
|
3
|
+
*/
|
4
|
+
@include describe("[function] remove") {
|
5
|
+
|
6
|
+
$list: ("one", "two", "three");
|
7
|
+
|
8
|
+
@include it("should expect value to be removed from list") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-remove($list, "two")),
|
11
|
+
to(be(("one", "three")))
|
12
|
+
);
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* Replace substring
|
3
|
+
*/
|
4
|
+
@include describe("[function] replace-substring") {
|
5
|
+
|
6
|
+
$string: "this is a string";
|
7
|
+
|
8
|
+
@include it("should expect the substring to be updated inside of string") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-replace-substring($string, "a", "an awesome")),
|
11
|
+
to(be("this is an awesome string"))
|
12
|
+
);
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* Replaces old by new in $list
|
3
|
+
*/
|
4
|
+
@include describe("[function] replace") {
|
5
|
+
|
6
|
+
$list: ("one", "two", "three");
|
7
|
+
|
8
|
+
@include it("should expect value to be replaced in list") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-replace($list, "three", "two, again")),
|
11
|
+
to(be(("one", "two", "two, again")))
|
12
|
+
);
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*
|
2
|
+
* Steal breakpoint key by index
|
3
|
+
*/
|
4
|
+
@include describe("[function] steal-key") {
|
5
|
+
|
6
|
+
@include it("should expect breakpoint alias of passed index from configuration map") {
|
7
|
+
@include should(expect(
|
8
|
+
flint-steal-key(1)),
|
9
|
+
to(be("desktop"))
|
10
|
+
);
|
11
|
+
}
|
12
|
+
|
13
|
+
@include it("should expect invalid type to return false") {
|
14
|
+
@include should(expect(
|
15
|
+
flint-steal-key("string")),
|
16
|
+
to(be(false))
|
17
|
+
);
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
* Steal breakpoint value by index
|
3
|
+
*/
|
4
|
+
@include describe("[function] steal-values") {
|
5
|
+
|
6
|
+
@include it("should expect steal value from breakpoint key based on its index") {
|
7
|
+
@include should(expect(
|
8
|
+
flint-steal-values(1, "breakpoint")),
|
9
|
+
to(be(80em))
|
10
|
+
);
|
11
|
+
@include should(expect(
|
12
|
+
flint-steal-values(1, "columns")),
|
13
|
+
to(be(16))
|
14
|
+
);
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
* Turns string into a flat list
|
3
|
+
*/
|
4
|
+
@include describe("[function] string-to-list") {
|
5
|
+
|
6
|
+
$string: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
|
7
|
+
|
8
|
+
@include it("should expect string to be converted into a list") {
|
9
|
+
@include should(expect(
|
10
|
+
flint-string-to-list($string, " ", "")),
|
11
|
+
to(be(("Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit,", "sed", "do", "eiusmod", "tempor", "incididunt", "ut", "labore", "et", "dolore", "magna", "aliqua.")))
|
12
|
+
);
|
13
|
+
}
|
14
|
+
|
15
|
+
@include it("should expect string to be converted into a list") {
|
16
|
+
@include should(expect(
|
17
|
+
flint-string-to-list($string, " ", "d")),
|
18
|
+
to(be(("Lorem", "ipsum")))
|
19
|
+
);
|
20
|
+
}
|
21
|
+
|
22
|
+
@include it("should expect string up to comma to be converted into a list") {
|
23
|
+
@include should(expect(
|
24
|
+
flint-string-to-list($string)),
|
25
|
+
to(be(("Lorem", "ipsum", "dolor", "sit", "amet")))
|
26
|
+
);
|
27
|
+
}
|
28
|
+
}
|