@@ -145,4 +145,54 @@ describe('matchQueries', function () {
145
145
146
146
} ) ;
147
147
148
+ describe ( 'no height info' , function ( ) {
149
+
150
+ it ( 'ignores rules of height' , function ( ) {
151
+ const query = {
152
+ a : { minWidth : 400 , maxWidth : 500 , minHeight : 400 , maxHeight : 500 } ,
153
+ b : { minWidth : 500 , maxWidth : 600 , minHeight : 400 , maxHeight : 500 } ,
154
+ c : { minWidth : 400 , maxWidth : 500 , minHeight : 500 , maxHeight : 600 } ,
155
+ d : { minWidth : 500 , maxWidth : 600 , minHeight : 500 , maxHeight : 600 } ,
156
+ } ;
157
+
158
+ const result1 = matchQueries ( query ) ( { width : 300 } ) ;
159
+ expect ( result1 ) . toEqual ( { a : false , b : false , c : false , d : false } ) ;
160
+
161
+ const result2 = matchQueries ( query ) ( { width : 450 } ) ;
162
+ expect ( result2 ) . toEqual ( { a : true , b : false , c : true , d : false } ) ;
163
+
164
+ const result5 = matchQueries ( query ) ( { width : 550 } ) ;
165
+ expect ( result5 ) . toEqual ( { a : false , b : true , c : false , d : true } ) ;
166
+
167
+ const result6 = matchQueries ( query ) ( { width : 700 } ) ;
168
+ expect ( result6 ) . toEqual ( { a : false , b : false , c : false , d : false } ) ;
169
+ } ) ;
170
+
171
+ } ) ;
172
+
173
+ describe ( 'no width info' , function ( ) {
174
+
175
+ it ( 'ignores rules of width' , function ( ) {
176
+ const query = {
177
+ a : { minWidth : 400 , maxWidth : 500 , minHeight : 400 , maxHeight : 500 } ,
178
+ b : { minWidth : 500 , maxWidth : 600 , minHeight : 400 , maxHeight : 500 } ,
179
+ c : { minWidth : 400 , maxWidth : 500 , minHeight : 500 , maxHeight : 600 } ,
180
+ d : { minWidth : 500 , maxWidth : 600 , minHeight : 500 , maxHeight : 600 } ,
181
+ } ;
182
+
183
+ const result1 = matchQueries ( query ) ( { height : 300 } ) ;
184
+ expect ( result1 ) . toEqual ( { a : false , b : false , c : false , d : false } ) ;
185
+
186
+ const result2 = matchQueries ( query ) ( { height : 450 } ) ;
187
+ expect ( result2 ) . toEqual ( { a : true , b : true , c : false , d : false } ) ;
188
+
189
+ const result3 = matchQueries ( query ) ( { height : 550 } ) ;
190
+ expect ( result3 ) . toEqual ( { a : false , b : false , c : true , d : true } ) ;
191
+
192
+ const result6 = matchQueries ( query ) ( { height : 700 } ) ;
193
+ expect ( result6 ) . toEqual ( { a : false , b : false , c : false , d : false } ) ;
194
+ } ) ;
195
+
196
+ } ) ;
197
+
148
198
} ) ;
0 commit comments