File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed
Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -97,10 +97,44 @@ describe("match", () => {
9797 )
9898 ) . toBe ( false ) ;
9999 } ) ;
100+
101+ it ( "Width: should return true for a correct match with type" , function ( ) {
102+ expect (
103+ mediaQuery . match (
104+ [
105+ {
106+ inverse : false ,
107+ type : "screen" ,
108+ expressions : [
109+ { modifier : "min" , feature : "width" , value : "48em" }
110+ ]
111+ }
112+ ] ,
113+ { width : "48em" , type : "screen" }
114+ )
115+ ) . toBe ( true ) ;
116+ } ) ;
100117 } ) ;
101118
102119 describe ( "Length Check" , function ( ) {
103120 describe ( "Width" , function ( ) {
121+ it ( "should return true for a width equal to a min-width" , function ( ) {
122+ expect (
123+ mediaQuery . match (
124+ [
125+ {
126+ inverse : false ,
127+ type : "all" ,
128+ expressions : [
129+ { modifier : "min" , feature : "width" , value : "48em" }
130+ ]
131+ }
132+ ] ,
133+ { width : "48em" }
134+ )
135+ ) . toBe ( true ) ;
136+ } ) ;
137+
104138 it ( "should return true for a width higher than a min-width" , function ( ) {
105139 expect (
106140 mediaQuery . match (
@@ -135,6 +169,40 @@ describe("match", () => {
135169 ) . toBe ( false ) ;
136170 } ) ;
137171
172+ it ( "should return true for a width lower than a max-width" , function ( ) {
173+ expect (
174+ mediaQuery . match (
175+ [
176+ {
177+ expressions : [
178+ { feature : "width" , modifier : "max" , value : "48em" }
179+ ] ,
180+ inverse : false ,
181+ type : "all"
182+ }
183+ ] ,
184+ { width : "47.5em" }
185+ )
186+ ) . toBe ( true ) ;
187+ } ) ;
188+
189+ it ( "should return false for a width higher than a max-width" , function ( ) {
190+ expect (
191+ mediaQuery . match (
192+ [
193+ {
194+ expressions : [
195+ { feature : "width" , modifier : "max" , value : "48em" }
196+ ] ,
197+ inverse : false ,
198+ type : "all"
199+ }
200+ ] ,
201+ { width : "48.5em" }
202+ )
203+ ) . toBe ( false ) ;
204+ } ) ;
205+
138206 it ( "should return false when no width value is specified" , function ( ) {
139207 expect (
140208 mediaQuery . match (
You can’t perform that action at this time.
0 commit comments