File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,30 @@ const notLtrMixin = {
78
78
} ,
79
79
} ;
80
80
81
+ const rtlWhereMixin = {
82
+ ':where([dir="rtl"]) &' : {
83
+ '@mixin-content' : { } ,
84
+ } ,
85
+ } ;
86
+
87
+ const ltrWhereMixin = {
88
+ ':where([dir="ltr"]) &' : {
89
+ '@mixin-content' : { } ,
90
+ } ,
91
+ } ;
92
+
93
+ const notRtlWhereMixin = {
94
+ ':where([dir="ltr"]) &' : {
95
+ '@mixin-content' : { } ,
96
+ } ,
97
+ } ;
98
+
99
+ const notLtrWhereMixin = {
100
+ ':where([dir="ltr"]) &' : {
101
+ '@mixin-content' : { } ,
102
+ } ,
103
+ } ;
104
+
81
105
const smallerThanMixin = ( _mixin : string , breakpoint : string ) => ( {
82
106
[ `@media (max-width: ${ converters . em ( converters . px ( breakpoint ) - 0.1 ) } )` ] : {
83
107
'@mixin-content' : { } ,
@@ -114,6 +138,10 @@ module.exports = () => {
114
138
ltr : ltrMixin ,
115
139
'not-rtl' : notRtlMixin ,
116
140
'not-ltr' : notLtrMixin ,
141
+ 'where-rtl' : rtlWhereMixin ,
142
+ 'where-ltr' : ltrWhereMixin ,
143
+ 'where-not-rtl' : notRtlWhereMixin ,
144
+ 'where-not-ltr' : notLtrWhereMixin ,
117
145
'smaller-than' : smallerThanMixin ,
118
146
'larger-than' : largerThanMixin ,
119
147
} ,
Original file line number Diff line number Diff line change @@ -10,3 +10,14 @@ exports[`mixin-rtl transforms rtl mixins correctly 1`] = `
10
10
}
11
11
"
12
12
` ;
13
+
14
+ exports [` mixin-rtl transforms where-rtl mixins correctly 1` ] = `
15
+ "
16
+ :where([dir="rtl"]) .demo {
17
+ margin - right : 1rem
18
+ }
19
+ :where([dir="ltr"]) .demo {
20
+ margin - left : 1rem
21
+ }
22
+ "
23
+ ` ;
Original file line number Diff line number Diff line change @@ -12,9 +12,26 @@ const baseInput = `
12
12
}
13
13
` ;
14
14
15
+ const whereInput = `
16
+ .demo {
17
+ @mixin where-rtl {
18
+ margin-right: 1rem;
19
+ }
20
+
21
+ @mixin where-not-rtl {
22
+ margin-left: 1rem;
23
+ }
24
+ }
25
+ ` ;
26
+
15
27
describe ( 'mixin-rtl' , ( ) => {
16
28
it ( 'transforms rtl mixins correctly' , async ( ) => {
17
29
const res = await testTransform ( baseInput ) ;
18
30
expect ( res . css ) . toMatchSnapshot ( ) ;
19
31
} ) ;
32
+
33
+ it ( 'transforms where-rtl mixins correctly' , async ( ) => {
34
+ const res = await testTransform ( whereInput ) ;
35
+ expect ( res . css ) . toMatchSnapshot ( ) ;
36
+ } ) ;
20
37
} ) ;
You can’t perform that action at this time.
0 commit comments