flint-gs 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,47 @@
|
|
1
|
+
@function deep-equal($expected) {
|
2
|
+
$when: true;
|
3
|
+
$actual: actual();
|
4
|
+
|
5
|
+
$contains-list: true;
|
6
|
+
$temp-1: $actual;
|
7
|
+
$temp-2: $expected;
|
8
|
+
|
9
|
+
@while $contains-list {
|
10
|
+
$contains-list: false;
|
11
|
+
|
12
|
+
@if length($temp-1) == length($temp-2) {
|
13
|
+
@for $n from 1 through length($temp-1) {
|
14
|
+
$temp-1-item: nth($temp-1, $n);
|
15
|
+
$temp-2-item: nth($temp-2, $n);
|
16
|
+
|
17
|
+
@if type-of($temp-1-item) == "list" and type-of($temp-2-item) == "list" {
|
18
|
+
@if length($temp-1-item) == length($temp-2-item) {
|
19
|
+
@for $_n from 1 through length($temp-1-item) {
|
20
|
+
$_temp-1-item: nth($temp-1-item, $_n);
|
21
|
+
$_temp-2-item: nth($temp-2-item, $_n);
|
22
|
+
|
23
|
+
@if type-of($_temp-1-item) == "list" and type-of($_temp-2-item) == "list" {
|
24
|
+
$contains-list: true;
|
25
|
+
} @else if $_temp-1-item != $_temp-2-item {
|
26
|
+
$when: false;
|
27
|
+
}
|
28
|
+
|
29
|
+
$temp-1: $_temp-1-item;
|
30
|
+
$temp-2: $_temp-2-item;
|
31
|
+
}
|
32
|
+
} @else {
|
33
|
+
$when: false;
|
34
|
+
}
|
35
|
+
} @else if $temp-1-item != $temp-2-item {
|
36
|
+
$when: false;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
} @else {
|
40
|
+
$when: false;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
$throw: error("dep", "The `deep-equal` matcher has been deprecated, please use the `be` matcher for the same functionality");
|
45
|
+
|
46
|
+
@return should("deep equal", $expected, $when);
|
47
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
@function be-close-to($this, $precision) {
|
2
|
+
$actual: actual();
|
3
|
+
$when: false;
|
4
|
+
|
5
|
+
@if type-of($actual) == "number" {
|
6
|
+
$when: abs($this - $actual) < (bc-util-power(10, -$precision) / 2);
|
7
|
+
} @else {
|
8
|
+
$when: error("type", "The `be-close-to` matcher is only for numbers");
|
9
|
+
}
|
10
|
+
|
11
|
+
@return should("be close to", $this, $when);
|
12
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
@function be-greater-than($this) {
|
2
|
+
$actual: actual();
|
3
|
+
$when: false;
|
4
|
+
|
5
|
+
@if type-of($actual) == "number" {
|
6
|
+
$when: $actual > $this;
|
7
|
+
} @else {
|
8
|
+
$when: error("type", "The `be-greater-than` matcher is only for numbers");
|
9
|
+
}
|
10
|
+
|
11
|
+
@return should("be greater than", $this, $when);
|
12
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
@function be-less-than($this) {
|
2
|
+
$actual: actual();
|
3
|
+
$when: false;
|
4
|
+
|
5
|
+
@if type-of($actual) == "number" {
|
6
|
+
$when: $actual < $this;
|
7
|
+
} @else {
|
8
|
+
$when: error("type", "The `be-less-than` matcher is only for numbers");
|
9
|
+
}
|
10
|
+
|
11
|
+
@return should("be less than", $this, $when);
|
12
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@function bc-util-contain($list, $value, $recursive: false) {
|
2
|
+
@each $item in $list {
|
3
|
+
@if type-of( $item ) == list and $recursive {
|
4
|
+
@if bc-util-contain($item, $value, $recursive) {
|
5
|
+
@return true;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
@if $item == $value {
|
10
|
+
@return true;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
@return false;
|
15
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@function bc-util-equal($value-1, $value-2, $recursive: true) {
|
2
|
+
@if length($value-1) != length($value-2) {
|
3
|
+
@return false;
|
4
|
+
}
|
5
|
+
|
6
|
+
@for $i from 1 through length($value-1) {
|
7
|
+
|
8
|
+
@if $recursive
|
9
|
+
and type-of( nth($value-1, $i) ) == list
|
10
|
+
and type-of( nth($value-2, $i) ) == list {
|
11
|
+
|
12
|
+
@if not bc-util-equal(nth($value-1, $i), nth($value-2, $i)) {
|
13
|
+
@return false;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
@else if nth($value-1, $i) != nth($value-2, $i){
|
18
|
+
@return false;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
@return true;
|
23
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@function bc-util-list-join($list, $separator, $slice-start: 1, $slice-end: 0) {
|
2
|
+
$result: "";
|
3
|
+
|
4
|
+
@if type-of($list) == list {
|
5
|
+
$length: length($list);
|
6
|
+
|
7
|
+
@if $slice-end == false {
|
8
|
+
$slice-end: length($list);
|
9
|
+
}
|
10
|
+
|
11
|
+
@if $slice-start < 0 {
|
12
|
+
$slice-start: length($list) + $slice-start + 1;
|
13
|
+
}
|
14
|
+
|
15
|
+
@if $slice-end < 0 {
|
16
|
+
$slice-end: length($list) + $slice-end + 1;
|
17
|
+
}
|
18
|
+
|
19
|
+
@for $i from $slice-start through $length - $slice-end {
|
20
|
+
@if $result == "" {
|
21
|
+
$result: nth($list, $i);
|
22
|
+
}
|
23
|
+
|
24
|
+
@else {
|
25
|
+
$result: $result + "#{$separator}" + nth($list, $i);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
@else {
|
31
|
+
$result: $list;
|
32
|
+
}
|
33
|
+
|
34
|
+
@return $result;
|
35
|
+
}
|
data/tests/config.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require '../lib/flint.rb'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
# Require dependencies through bundler
|
6
|
+
Bundler.require(:default, :test) if defined?(Bundler)
|
7
|
+
|
8
|
+
# Define paths
|
9
|
+
css_dir = "output"
|
10
|
+
sass_dir = "input"
|
11
|
+
|
12
|
+
# Output style will change based on environment
|
13
|
+
output_style = :expanded
|
14
|
+
|
15
|
+
# Disable line comments
|
16
|
+
line_comments = false
|
17
|
+
|
18
|
+
# Disable Sass warnings
|
19
|
+
# disable_warnings = true
|
20
|
+
|
21
|
+
# Options
|
22
|
+
sass_options = {
|
23
|
+
# For when working on Windows machines
|
24
|
+
:unix_newlines => true
|
25
|
+
}
|
26
|
+
|
27
|
+
module Sass::Script::Functions
|
28
|
+
@@timeStart = Time.now
|
29
|
+
@@timeLast = Time.now
|
30
|
+
|
31
|
+
def profileRender(timeLast)
|
32
|
+
diff = Time.now - timeLast
|
33
|
+
return Sass::Script::String.new(diff * 1)
|
34
|
+
end
|
35
|
+
|
36
|
+
def timing_total()
|
37
|
+
return self.profileRender(@@timeStart)
|
38
|
+
end
|
39
|
+
|
40
|
+
def timing_interval()
|
41
|
+
str = profileRender(@@timeLast)
|
42
|
+
@@timeLast = Time.now
|
43
|
+
return str
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Sass::Tree::Visitors::Perform < Sass::Tree::Visitors::Base
|
48
|
+
# Removes all comments completely
|
49
|
+
def visit_comment(node)
|
50
|
+
return []
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* Helpers
|
3
|
+
*/
|
4
|
+
@import "helpers/helpers";
|
5
|
+
|
6
|
+
/*
|
7
|
+
* Functions
|
8
|
+
*/
|
9
|
+
@import "lib/exists";
|
10
|
+
|
11
|
+
// Getters
|
12
|
+
@import "lib/map-fetch";
|
13
|
+
@import "lib/get-value";
|
14
|
+
@import "lib/get-index";
|
15
|
+
@import "lib/steal-key";
|
16
|
+
@import "lib/steal-values";
|
17
|
+
|
18
|
+
// Calculations
|
19
|
+
@import "lib/fluid-width";
|
20
|
+
@import "lib/calc-width";
|
21
|
+
@import "lib/calc-breakpoint";
|
22
|
+
|
23
|
+
// Instance functions
|
24
|
+
@import "lib/instance";
|
25
|
+
@import "lib/has-family-instance";
|
26
|
+
@import "lib/get-instance-value";
|
27
|
+
|
28
|
+
// List functions
|
29
|
+
@import "lib/list-to-string";
|
30
|
+
@import "lib/types-in-list";
|
31
|
+
@import "lib/next-index";
|
32
|
+
@import "lib/purge";
|
33
|
+
@import "lib/replace";
|
34
|
+
@import "lib/remove";
|
35
|
+
@import "lib/last";
|
36
|
+
|
37
|
+
// String functions
|
38
|
+
@import "lib/replace-substring";
|
39
|
+
@import "lib/string-to-list";
|
40
|
+
|
41
|
+
/*
|
42
|
+
* Support syntax
|
43
|
+
*/
|
44
|
+
@import "lib/use-syntax";
|
45
|
+
@import "lib/support-syntax";
|
46
|
+
|
47
|
+
// Syntaxes
|
48
|
+
@import "lib/support-syntax-bem"
|
@@ -0,0 +1,416 @@
|
|
1
|
+
/*
|
2
|
+
* Returns truthiness of a value
|
3
|
+
*/
|
4
|
+
@include describe("[function] is-true") {
|
5
|
+
|
6
|
+
@include it("should expect values to be truthy") {
|
7
|
+
@include should(expect(
|
8
|
+
flint-is-true(true)),
|
9
|
+
to(be(true))
|
10
|
+
);
|
11
|
+
@include should(expect(
|
12
|
+
flint-is-true("true")),
|
13
|
+
to(be(true))
|
14
|
+
);
|
15
|
+
}
|
16
|
+
|
17
|
+
@include it("should expect values to return false") {
|
18
|
+
@include should(expect(
|
19
|
+
flint-is-true(null)),
|
20
|
+
to(be(false))
|
21
|
+
);
|
22
|
+
@include should(expect(
|
23
|
+
flint-is-true(false)),
|
24
|
+
to(be(false))
|
25
|
+
);
|
26
|
+
@include should(expect(
|
27
|
+
flint-is-true(())),
|
28
|
+
to(be(false))
|
29
|
+
);
|
30
|
+
@include should(expect(
|
31
|
+
flint-is-true("")),
|
32
|
+
to(be(false))
|
33
|
+
);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
/*
|
38
|
+
* Checks if item is map
|
39
|
+
*/
|
40
|
+
@include describe("[function] is-map") {
|
41
|
+
|
42
|
+
$map: ("key": "value");
|
43
|
+
$list: ("one", "two", "three");
|
44
|
+
$string: "string";
|
45
|
+
$number: 1;
|
46
|
+
$bool: true;
|
47
|
+
$null: null;
|
48
|
+
|
49
|
+
@include it("should expect variable to be a map and return true") {
|
50
|
+
@include should(expect(
|
51
|
+
flint-is-map($map)),
|
52
|
+
to(be(true))
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
@include it("should expect variable to be a map and return false") {
|
57
|
+
@include should(expect(
|
58
|
+
flint-is-map($list)),
|
59
|
+
to(be(false))
|
60
|
+
);
|
61
|
+
@include should(expect(
|
62
|
+
flint-is-map($string)),
|
63
|
+
to(be(false))
|
64
|
+
);
|
65
|
+
@include should(expect(
|
66
|
+
flint-is-map($number)),
|
67
|
+
to(be(false))
|
68
|
+
);
|
69
|
+
@include should(expect(
|
70
|
+
flint-is-map($bool)),
|
71
|
+
to(be(false))
|
72
|
+
);
|
73
|
+
@include should(expect(
|
74
|
+
flint-is-map($null)),
|
75
|
+
to(be(false))
|
76
|
+
);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
/*
|
81
|
+
* Checks if item is list
|
82
|
+
*/
|
83
|
+
@include describe("[function] is-list") {
|
84
|
+
|
85
|
+
$map: ("key": "value");
|
86
|
+
$list: ("one", "two", "three");
|
87
|
+
$string: "string";
|
88
|
+
$number: 1;
|
89
|
+
$bool: true;
|
90
|
+
$null: null;
|
91
|
+
|
92
|
+
@include it("should expect variable to be a list and return true") {
|
93
|
+
@include should(expect(
|
94
|
+
flint-is-list($list)),
|
95
|
+
to(be(true))
|
96
|
+
);
|
97
|
+
}
|
98
|
+
|
99
|
+
@include it("should expect variable to be a list and return false") {
|
100
|
+
@include should(expect(
|
101
|
+
flint-is-list($map)),
|
102
|
+
to(be(false))
|
103
|
+
);
|
104
|
+
@include should(expect(
|
105
|
+
flint-is-list($string)),
|
106
|
+
to(be(false))
|
107
|
+
);
|
108
|
+
@include should(expect(
|
109
|
+
flint-is-list($number)),
|
110
|
+
to(be(false))
|
111
|
+
);
|
112
|
+
@include should(expect(
|
113
|
+
flint-is-list($bool)),
|
114
|
+
to(be(false))
|
115
|
+
);
|
116
|
+
@include should(expect(
|
117
|
+
flint-is-list($null)),
|
118
|
+
to(be(false))
|
119
|
+
);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
/*
|
124
|
+
* Checks if item is number
|
125
|
+
*/
|
126
|
+
@include describe("[function] is-number") {
|
127
|
+
|
128
|
+
$map: ("key": "value");
|
129
|
+
$list: ("one", "two", "three");
|
130
|
+
$string: "string";
|
131
|
+
$number: 1;
|
132
|
+
$bool: true;
|
133
|
+
$null: null;
|
134
|
+
|
135
|
+
@include it("should expect variable to be a number and return true") {
|
136
|
+
@include should(expect(
|
137
|
+
flint-is-number($number)),
|
138
|
+
to(be(true))
|
139
|
+
);
|
140
|
+
}
|
141
|
+
|
142
|
+
@include it("should expect variable to be a number and return false") {
|
143
|
+
@include should(expect(
|
144
|
+
flint-is-number($map)),
|
145
|
+
to(be(false))
|
146
|
+
);
|
147
|
+
@include should(expect(
|
148
|
+
flint-is-number($list)),
|
149
|
+
to(be(false))
|
150
|
+
);
|
151
|
+
@include should(expect(
|
152
|
+
flint-is-number($string)),
|
153
|
+
to(be(false))
|
154
|
+
);
|
155
|
+
@include should(expect(
|
156
|
+
flint-is-number($bool)),
|
157
|
+
to(be(false))
|
158
|
+
);
|
159
|
+
@include should(expect(
|
160
|
+
flint-is-number($null)),
|
161
|
+
to(be(false))
|
162
|
+
);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
/*
|
167
|
+
* Checks if item is string
|
168
|
+
*/
|
169
|
+
@include describe("[function] is-string") {
|
170
|
+
|
171
|
+
$map: ("key": "value");
|
172
|
+
$list: ("one", "two", "three");
|
173
|
+
$string: "string";
|
174
|
+
$number: 1;
|
175
|
+
$bool: true;
|
176
|
+
$null: null;
|
177
|
+
|
178
|
+
@include it("should expect variable to be a string and return true") {
|
179
|
+
@include should(expect(
|
180
|
+
flint-is-string($string)),
|
181
|
+
to(be(true))
|
182
|
+
);
|
183
|
+
}
|
184
|
+
|
185
|
+
@include it("should expect variable to be a string and return false") {
|
186
|
+
@include should(expect(
|
187
|
+
flint-is-string($map)),
|
188
|
+
to(be(false))
|
189
|
+
);
|
190
|
+
@include should(expect(
|
191
|
+
flint-is-string($list)),
|
192
|
+
to(be(false))
|
193
|
+
);
|
194
|
+
@include should(expect(
|
195
|
+
flint-is-string($number)),
|
196
|
+
to(be(false))
|
197
|
+
);
|
198
|
+
@include should(expect(
|
199
|
+
flint-is-string($bool)),
|
200
|
+
to(be(false))
|
201
|
+
);
|
202
|
+
@include should(expect(
|
203
|
+
flint-is-string($null)),
|
204
|
+
to(be(false))
|
205
|
+
);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
/*
|
210
|
+
* Checks if item is not string
|
211
|
+
*/
|
212
|
+
@include describe("[function] is-not-string") {
|
213
|
+
|
214
|
+
$map: ("key": "value");
|
215
|
+
$list: ("one", "two", "three");
|
216
|
+
$string: "string";
|
217
|
+
$number: 1;
|
218
|
+
$bool: true;
|
219
|
+
$null: null;
|
220
|
+
|
221
|
+
@include it("should expect variable not to be a string") {
|
222
|
+
@include should(expect(
|
223
|
+
flint-is-not-string($string)),
|
224
|
+
not-to(be(true))
|
225
|
+
);
|
226
|
+
@include should(expect(
|
227
|
+
flint-is-not-string($map)),
|
228
|
+
to(be(true))
|
229
|
+
);
|
230
|
+
@include should(expect(
|
231
|
+
flint-is-not-string($list)),
|
232
|
+
to(be(true))
|
233
|
+
);
|
234
|
+
@include should(expect(
|
235
|
+
flint-is-not-string($number)),
|
236
|
+
to(be(true))
|
237
|
+
);
|
238
|
+
@include should(expect(
|
239
|
+
flint-is-not-string($bool)),
|
240
|
+
to(be(true))
|
241
|
+
);
|
242
|
+
@include should(expect(
|
243
|
+
flint-is-not-string($null)),
|
244
|
+
to(be(true))
|
245
|
+
);
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
/*
|
250
|
+
* Get gutter value from config map
|
251
|
+
*/
|
252
|
+
@include describe("[function] get-gutter") {
|
253
|
+
|
254
|
+
@include it("should expect gutter value from config") {
|
255
|
+
@include should(expect(
|
256
|
+
flint-get-gutter()),
|
257
|
+
to(be((0.625em)))
|
258
|
+
);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
/*
|
263
|
+
* Gets list of each breakpoint's key
|
264
|
+
*/
|
265
|
+
@include describe("[function] get-all-keys") {
|
266
|
+
|
267
|
+
@include it("should expect a list of all breakpoint keys") {
|
268
|
+
@include should(expect(
|
269
|
+
flint-get-all-keys()),
|
270
|
+
to(be(("desktop", "laptop", "tablet", "mobile")))
|
271
|
+
);
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
/*
|
276
|
+
* Gets list of all breakpoints
|
277
|
+
*/
|
278
|
+
@include describe("[function] get-all-breakpoints") {
|
279
|
+
|
280
|
+
@include it("should expect a list of all breakpoint values") {
|
281
|
+
@include should(expect(
|
282
|
+
flint-get-all-breakpoints()),
|
283
|
+
to(be((80em, 60em, 40em, 20em)))
|
284
|
+
);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
/*
|
289
|
+
* Checks if passed $key is the highest breakpoint
|
290
|
+
*/
|
291
|
+
@include describe("[function] is-highest-breakpoint") {
|
292
|
+
|
293
|
+
@include it("should expect to be highest breakpoint") {
|
294
|
+
@include should(expect(
|
295
|
+
flint-is-highest-breakpoint("desktop")),
|
296
|
+
to(be(true))
|
297
|
+
);
|
298
|
+
}
|
299
|
+
|
300
|
+
@include it("should expect not to be highest breakpoint") {
|
301
|
+
@include should(expect(
|
302
|
+
flint-is-highest-breakpoint("laptop")),
|
303
|
+
to(be(false))
|
304
|
+
);
|
305
|
+
@include should(expect(
|
306
|
+
flint-is-highest-breakpoint("tablet")),
|
307
|
+
to(be(false))
|
308
|
+
);
|
309
|
+
@include should(expect(
|
310
|
+
flint-is-highest-breakpoint("mobile")),
|
311
|
+
to(be(false))
|
312
|
+
);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
|
316
|
+
/*
|
317
|
+
* Checks if passed $key is the lowest breakpoint
|
318
|
+
*/
|
319
|
+
@include describe("[function] is-lowest-breakpoint") {
|
320
|
+
|
321
|
+
@include it("should expect to be lowest breakpoint") {
|
322
|
+
@include should(expect(
|
323
|
+
flint-is-lowest-breakpoint("mobile")),
|
324
|
+
to(be(true))
|
325
|
+
);
|
326
|
+
}
|
327
|
+
|
328
|
+
@include it("should expect not to be lowest breakpoint") {
|
329
|
+
@include should(expect(
|
330
|
+
flint-is-lowest-breakpoint("desktop")),
|
331
|
+
to(be(false))
|
332
|
+
);
|
333
|
+
@include should(expect(
|
334
|
+
flint-is-lowest-breakpoint("laptop")),
|
335
|
+
to(be(false))
|
336
|
+
);
|
337
|
+
@include should(expect(
|
338
|
+
flint-is-lowest-breakpoint("tablet")),
|
339
|
+
to(be(false))
|
340
|
+
);
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
/*
|
345
|
+
* Checks if $key is grid default
|
346
|
+
*/
|
347
|
+
@include describe("[function] is-default") {
|
348
|
+
|
349
|
+
@include it("should expect to be default breakpoint") {
|
350
|
+
@include should(expect(
|
351
|
+
flint-is-default("mobile")),
|
352
|
+
to(be(true))
|
353
|
+
);
|
354
|
+
}
|
355
|
+
|
356
|
+
@include it("should expect not to be default breakpoint") {
|
357
|
+
@include should(expect(
|
358
|
+
flint-is-default("desktop")),
|
359
|
+
to(be(false))
|
360
|
+
);
|
361
|
+
@include should(expect(
|
362
|
+
flint-is-default("laptop")),
|
363
|
+
to(be(false))
|
364
|
+
);
|
365
|
+
@include should(expect(
|
366
|
+
flint-is-default("tablet")),
|
367
|
+
to(be(false))
|
368
|
+
);
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
/*
|
373
|
+
* Gets all breakpoint column values
|
374
|
+
*/
|
375
|
+
@include describe("[function] get-all-columns") {
|
376
|
+
|
377
|
+
@include it("should expect a list of all breakpoint column values") {
|
378
|
+
@include should(expect(
|
379
|
+
flint-get-all-columns()),
|
380
|
+
to(be((16, 12, 8, 4)))
|
381
|
+
);
|
382
|
+
}
|
383
|
+
}
|
384
|
+
|
385
|
+
/*
|
386
|
+
* Returns the unit used in config
|
387
|
+
*/
|
388
|
+
@include describe("[function] get-config-unit") {
|
389
|
+
@include it("should expect configuration unit to be ems") {
|
390
|
+
@include should(expect(
|
391
|
+
flint-get-config-unit()),
|
392
|
+
to(be("em"))
|
393
|
+
);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
/*
|
398
|
+
* Convert pixel value to em
|
399
|
+
*/
|
400
|
+
@include describe("[function] to-em") {
|
401
|
+
|
402
|
+
@include it("should expect passed pixel value to be converted to ems") {
|
403
|
+
@include should(expect(
|
404
|
+
flint-to-em(16px)),
|
405
|
+
to(be(1em))
|
406
|
+
);
|
407
|
+
@include should(expect(
|
408
|
+
flint-to-em(32px)),
|
409
|
+
to(be(2em))
|
410
|
+
);
|
411
|
+
@include should(expect(
|
412
|
+
flint-to-em(16px, 32px)),
|
413
|
+
to(be(0.5em))
|
414
|
+
);
|
415
|
+
}
|
416
|
+
}
|