@@ -20,7 +20,8 @@ import {
2020 maxHeight ,
2121 rem ,
2222 opacify ,
23- transparentize
23+ transparentize ,
24+ flex
2425} from "./styled-tidy" ;
2526
2627declare interface TestProps {
@@ -35,7 +36,7 @@ export const setup = (node: any) =>
3536describe ( "styed-tidy" , ( ) => {
3637 afterEach ( cleanup ) ;
3738
38- describe ( "'is' function " , ( ) => {
39+ describe ( "'is' matcher " , ( ) => {
3940 const Test = styled . div < TestProps > `
4041 ${ is ( "enabled" ) `color: green` } ;
4142 ` ;
@@ -51,7 +52,7 @@ describe("styed-tidy", () => {
5152 } ) ;
5253 } ) ;
5354
54- describe ( "'isnt' function " , ( ) => {
55+ describe ( "'isnt' matcher " , ( ) => {
5556 const Test = styled . div < TestProps > `
5657 ${ isnt ( "enabled" ) `color: red` } ;
5758 ` ;
@@ -67,7 +68,7 @@ describe("styed-tidy", () => {
6768 } ) ;
6869 } ) ;
6970
70- describe ( "'isAny' function " , ( ) => {
71+ describe ( "'isAny' matcher " , ( ) => {
7172 const Test = styled . div < TestProps > `
7273 ${ isAny ( "size" , [ "small" , "medium" ] ) `color: green` } ;
7374 ` ;
@@ -89,7 +90,7 @@ describe("styed-tidy", () => {
8990 } ) ;
9091 } ) ;
9192
92- describe ( "'isntAny' function " , ( ) => {
93+ describe ( "'isntAny' matcher " , ( ) => {
9394 const Test = styled . div < TestProps > `
9495 ${ isntAny ( "size" , [ "small" , "medium" ] ) `color: green` } ;
9596 ` ;
@@ -111,7 +112,7 @@ describe("styed-tidy", () => {
111112 } ) ;
112113 } ) ;
113114
114- describe ( "'value' function " , ( ) => {
115+ describe ( "'value' matcher " , ( ) => {
115116 it ( "should render the given value" , ( ) => {
116117 const Test = styled . div < TestProps > `
117118 width: ${ value ( "size" ) } ;
@@ -121,7 +122,7 @@ describe("styed-tidy", () => {
121122 } ) ;
122123 } ) ;
123124
124- describe ( "'swap' function " , ( ) => {
125+ describe ( "'swap' matcher " , ( ) => {
125126 const Test = styled . div < TestProps > `
126127 color: ${ swap ( "enabled" , "green" , "red" ) } ;
127128 ` ;
@@ -137,7 +138,7 @@ describe("styed-tidy", () => {
137138 } ) ;
138139 } ) ;
139140
140- describe ( "'choose' function " , ( ) => {
141+ describe ( "'choose' matcher " , ( ) => {
141142 it ( "should render the matching option for the given prop" , ( ) => {
142143 const sizes = {
143144 small : "10px" ,
@@ -157,7 +158,7 @@ describe("styed-tidy", () => {
157158 } ) ;
158159 } ) ;
159160
160- describe ( "'over' function " , ( ) => {
161+ describe ( "'over' matcher " , ( ) => {
161162 const Test = styled . div < TestProps > `
162163 ${ over ( "amount" , 10 ) `color: green` } ;
163164 ` ;
@@ -173,7 +174,7 @@ describe("styed-tidy", () => {
173174 } ) ;
174175 } ) ;
175176
176- describe ( "'under' function " , ( ) => {
177+ describe ( "'under' matcher " , ( ) => {
177178 const Test = styled . div < TestProps > `
178179 ${ under ( "amount" , 10 ) `color: green` } ;
179180 ` ;
@@ -189,7 +190,7 @@ describe("styed-tidy", () => {
189190 } ) ;
190191 } ) ;
191192
192- describe ( "'minWidth' function " , ( ) => {
193+ describe ( "'minWidth' media query " , ( ) => {
193194 it ( "renders a min-width media query with the given CSS" , ( ) => {
194195 const Test = styled . div < TestProps > `
195196 ${ minWidth ( 420 ) `display: flex` } ;
@@ -202,7 +203,7 @@ describe("styed-tidy", () => {
202203 } ) ;
203204 } ) ;
204205
205- describe ( "'maxWidth' function " , ( ) => {
206+ describe ( "'maxWidth' media query " , ( ) => {
206207 it ( "renders a max-width media query with the given CSS" , ( ) => {
207208 const Test = styled . div < TestProps > `
208209 ${ maxWidth ( 420 ) `display: flex` } ;
@@ -215,7 +216,7 @@ describe("styed-tidy", () => {
215216 } ) ;
216217 } ) ;
217218
218- describe ( "'minHeight' function " , ( ) => {
219+ describe ( "'minHeight' media query " , ( ) => {
219220 it ( "renders a min-height media query with the given CSS" , ( ) => {
220221 const Test = styled . div < TestProps > `
221222 ${ minHeight ( 420 ) `display: flex` } ;
@@ -228,7 +229,7 @@ describe("styed-tidy", () => {
228229 } ) ;
229230 } ) ;
230231
231- describe ( "'maxHeight' function " , ( ) => {
232+ describe ( "'maxHeight' media query " , ( ) => {
232233 it ( "renders a max-height media query with the given CSS" , ( ) => {
233234 const Test = styled . div < TestProps > `
234235 ${ maxHeight ( 420 ) `display: flex` } ;
@@ -241,7 +242,7 @@ describe("styed-tidy", () => {
241242 } ) ;
242243 } ) ;
243244
244- describe ( "'rem' function " , ( ) => {
245+ describe ( "'rem' mixin " , ( ) => {
245246 it ( "calculates rem values" , ( ) => {
246247 expect ( rem ( 16 ) ) . toBe ( "1rem" ) ;
247248 expect ( rem ( 4 ) ) . toBe ( "0.25rem" ) ;
@@ -250,7 +251,7 @@ describe("styed-tidy", () => {
250251 } ) ;
251252 } ) ;
252253
253- describe ( "'opacify' function " , ( ) => {
254+ describe ( "'opacify' mixin " , ( ) => {
254255 it ( "correctly adjusts an rgb value" , ( ) => {
255256 expect ( opacify ( "rgb(255,255,255)" , 0.2 ) ) . toBe ( "rgba(255,255,255,1)" ) ;
256257 } ) ;
@@ -266,7 +267,7 @@ describe("styed-tidy", () => {
266267 } ) ;
267268 } ) ;
268269
269- describe ( "'transparentize' function " , ( ) => {
270+ describe ( "'transparentize' mixin " , ( ) => {
270271 it ( "correctly adjusts an rgb value" , ( ) => {
271272 expect ( transparentize ( "rgb(255,255,255)" , 0.2 ) ) . toBe (
272273 "rgba(255,255,255,0.8)"
@@ -283,4 +284,19 @@ describe("styed-tidy", () => {
283284 expect ( transparentize ( "#FFFFFF" , 0.2 ) ) . toBe ( "rgba(255,255,255,0.8)" ) ;
284285 } ) ;
285286 } ) ;
287+
288+ describe ( "'flex' mixin" , ( ) => {
289+ it ( "sets the given flexbox CSS attributes" , ( ) => {
290+ const Test = styled . div < TestProps > `
291+ ${ flex ( "column-reverse" , "center" , "flex-end" ) } ;
292+ ` ;
293+ const { getByText } = setup ( < Test > test</ Test > ) ;
294+ const test = getByText ( "test" ) ;
295+
296+ expect ( test ) . toHaveStyleRule ( "display" , "flex" ) ;
297+ expect ( test ) . toHaveStyleRule ( "flex-direction" , "column-reverse" ) ;
298+ expect ( test ) . toHaveStyleRule ( "align-items" , "center" ) ;
299+ expect ( test ) . toHaveStyleRule ( "justify-content" , "flex-end" ) ;
300+ } ) ;
301+ } ) ;
286302} ) ;
0 commit comments