diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/_harmony.scss | 16 | ||||
-rw-r--r-- | test/_math.scss | 21 | ||||
-rw-r--r-- | test/_responsive.scss | 4 | ||||
-rw-r--r-- | test/test.scss | 1 |
4 files changed, 11 insertions, 31 deletions
diff --git a/test/_harmony.scss b/test/_harmony.scss index 25560f0..7945be1 100644 --- a/test/_harmony.scss +++ b/test/_harmony.scss | |||
@@ -1,5 +1,7 @@ | |||
1 | @use 'sass:math'; | ||
2 | |||
1 | @function _limit-decimals($n) { | 3 | @function _limit-decimals($n) { |
2 | @return floor($n * 1000) / 1000; | 4 | @return math.div(math.floor($n * 1000), 1000); |
3 | } | 5 | } |
4 | 6 | ||
5 | @include describe('Harmony') { | 7 | @include describe('Harmony') { |
@@ -47,7 +49,7 @@ | |||
47 | font-size: 1rem; | 49 | font-size: 1rem; |
48 | 50 | ||
49 | @media (min-width: 320px) and (max-width: 640px) { | 51 | @media (min-width: 320px) and (max-width: 640px) { |
50 | font-size: calc(1rem + 0 * ((100vw - #{$rem320px}) / #{$diff320px})); | 52 | font-size: calc(1rem + 0 * (100vw - #{$rem320px}) / #{$diff320px}); |
51 | } | 53 | } |
52 | 54 | ||
53 | @media (min-width: 640px) { | 55 | @media (min-width: 640px) { |
@@ -59,7 +61,7 @@ | |||
59 | font-size: 1.1rem; | 61 | font-size: 1.1rem; |
60 | 62 | ||
61 | @media (min-width: 320px) and (max-width: 640px) { | 63 | @media (min-width: 320px) and (max-width: 640px) { |
62 | font-size: calc(1.1rem + 0.1 * ((100vw - #{$rem320px}) / #{$diff320px})); | 64 | font-size: calc(1.1rem + 0.1 * (100vw - #{$rem320px}) / #{$diff320px}); |
63 | } | 65 | } |
64 | 66 | ||
65 | @media (min-width: 640px) { | 67 | @media (min-width: 640px) { |
@@ -71,7 +73,7 @@ | |||
71 | font-size: 1.21rem; | 73 | font-size: 1.21rem; |
72 | 74 | ||
73 | @media (min-width: 320px) and (max-width: 640px) { | 75 | @media (min-width: 320px) and (max-width: 640px) { |
74 | font-size: calc(1.21rem + 0.23 * ((100vw - #{$rem320px}) / #{$diff320px})); | 76 | font-size: calc(1.21rem + 0.23 * (100vw - #{$rem320px}) / #{$diff320px}); |
75 | } | 77 | } |
76 | 78 | ||
77 | @media (min-width: 640px) { | 79 | @media (min-width: 640px) { |
@@ -161,7 +163,7 @@ | |||
161 | font-size: 1rem; | 163 | font-size: 1rem; |
162 | 164 | ||
163 | @media (min-width: 320px) and (max-width: 640px) { | 165 | @media (min-width: 320px) and (max-width: 640px) { |
164 | font-size: calc(1rem + 0 * ((100vw - #{$rem320px}) / #{$diff320px})); | 166 | font-size: calc(1rem + 0 * (100vw - #{$rem320px}) / #{$diff320px}); |
165 | } | 167 | } |
166 | 168 | ||
167 | @media (min-width: 640px) { | 169 | @media (min-width: 640px) { |
@@ -173,7 +175,7 @@ | |||
173 | font-size: 1.0263162365rem; | 175 | font-size: 1.0263162365rem; |
174 | 176 | ||
175 | @media (min-width: 320px) and (max-width: 640px) { | 177 | @media (min-width: 320px) and (max-width: 640px) { |
176 | font-size: calc(1.0263162365rem + 0.1310911709 * ((100vw - #{$rem320px}) / #{$diff320px})); | 178 | font-size: calc(1.0263162365rem + 0.1310911709 * (100vw - #{$rem320px}) / #{$diff320px}); |
177 | } | 179 | } |
178 | 180 | ||
179 | @media (min-width: 640px) { | 181 | @media (min-width: 640px) { |
@@ -185,7 +187,7 @@ | |||
185 | font-size: 1.1rem; | 187 | font-size: 1.1rem; |
186 | 188 | ||
187 | @media (min-width: 320px) and (max-width: 640px) { | 189 | @media (min-width: 320px) and (max-width: 640px) { |
188 | font-size: calc(1.1rem + 0.1 * ((100vw - #{$rem320px}) / #{$diff320px})); | 190 | font-size: calc(1.1rem + 0.1 * (100vw - #{$rem320px}) / #{$diff320px}); |
189 | } | 191 | } |
190 | 192 | ||
191 | @media (min-width: 640px) { | 193 | @media (min-width: 640px) { |
diff --git a/test/_math.scss b/test/_math.scss deleted file mode 100644 index 5f40499..0000000 --- a/test/_math.scss +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | // sass-lint:disable empty-args | ||
2 | |||
3 | @include describe('Math') { | ||
4 | @include it('iro-math-pow') { | ||
5 | @include assert-equal(iro-math-pow(2, 2), 2 * 2, '2^2'); | ||
6 | @include assert-equal(iro-math-pow(2, 3), 2 * 2 * 2, '2^3'); | ||
7 | @include assert-equal(iro-math-pow(4, 3), 4 * 4 * 4, '4^3'); | ||
8 | @include assert-equal(iro-math-pow(3, -1), 1 / 3, '3^(-1)'); | ||
9 | @include assert-equal(iro-math-pow(4, -2), 1 / (4 * 4), '4^(-2)'); | ||
10 | @include assert-equal(iro-math-pow(3, 0), 1, '3^0'); | ||
11 | } | ||
12 | |||
13 | @include it('iro-math-clamp') { | ||
14 | @include assert-equal(iro-math-clamp(0, 0, 10), 0, '0 in [0, 10]'); | ||
15 | @include assert-equal(iro-math-clamp(10, 0, 10), 10, '10 in [0, 10]'); | ||
16 | @include assert-equal(iro-math-clamp(20, 0, 10), 10, '20 in [0, 10]'); | ||
17 | @include assert-equal(iro-math-clamp(3, 10, 20), 10, '3 in [10, 20]'); | ||
18 | @include assert-equal(iro-math-clamp(-5, -30, -10), -10, '-5 in [-30, -10]'); | ||
19 | @include assert-equal(iro-math-clamp(-5, -30, -2), -5, '-5 in [-30, -2]'); | ||
20 | } | ||
21 | } | ||
diff --git a/test/_responsive.scss b/test/_responsive.scss index cdda40c..6dfe868 100644 --- a/test/_responsive.scss +++ b/test/_responsive.scss | |||
@@ -3,7 +3,7 @@ | |||
3 | $rem600px: iro-px-to-rem(600px); | 3 | $rem600px: iro-px-to-rem(600px); |
4 | $rem800px: iro-px-to-rem(800px); | 4 | $rem800px: iro-px-to-rem(800px); |
5 | 5 | ||
6 | @include assert-equal(iro-responsive-fluid-calc(2rem, 4rem, 600px, 800px), 'calc(2rem + 2 * ((100vw - #{$rem600px}) / #{iro-strip-unit($rem800px - $rem600px)}))', 'Responsive value from 2rem to 4rem over 600px to 800px'); | 6 | @include assert-equal('#{iro-responsive-fluid-calc(2rem, 4rem, 600px, 800px)}', 'calc(2rem + 2 * (100vw - #{$rem600px}) / #{iro-strip-unit($rem800px - $rem600px)})', 'Responsive value from 2rem to 4rem over 600px to 800px'); |
7 | @include assert-equal(iro-responsive-fluid-calc(4px, 12px, 600px, 800px), 'calc(4px + 8 * ((100vw - 600px) / 200))', 'Responsive value from 4px to 12px over 600px to 800px'); | 7 | @include assert-equal('#{iro-responsive-fluid-calc(4px, 12px, 600px, 800px)}', 'calc(4px + 8 * (100vw - 600px) / 200)', 'Responsive value from 4px to 12px over 600px to 800px'); |
8 | } | 8 | } |
9 | } | 9 | } |
diff --git a/test/test.scss b/test/test.scss index 9e3cf6b..86c86e9 100644 --- a/test/test.scss +++ b/test/test.scss | |||
@@ -5,7 +5,6 @@ | |||
5 | $iro-easing-gradient-steps: 4; | 5 | $iro-easing-gradient-steps: 4; |
6 | 6 | ||
7 | @import 'functions'; | 7 | @import 'functions'; |
8 | @import 'math'; | ||
9 | @import 'contexts'; | 8 | @import 'contexts'; |
10 | @import 'bem'; | 9 | @import 'bem'; |
11 | @import 'responsive'; | 10 | @import 'responsive'; |