File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
tests/runtime-runes/samples/media-query Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ export class MediaQuery extends ReactiveValue {
4242 constructor ( query , fallback ) {
4343 let final_query =
4444 parenthesis_regex . test ( query ) ||
45- query . split ( ' ' ) . every ( ( keyword ) => non_parenthesized_keywords . has ( keyword ) )
45+ // we need to use `some` here because technically this `window.matchMedia('random,screen')` still returns true
46+ query . split ( / [ \s , ] + / ) . some ( ( keyword ) => non_parenthesized_keywords . has ( keyword . trim ( ) ) )
4647 ? query
4748 : `(${ query } )` ;
4849 const q = window . matchMedia ( final_query ) ;
Original file line number Diff line number Diff line change @@ -7,5 +7,8 @@ export default test({
77 expect ( window . matchMedia ) . toHaveBeenCalledWith ( '(min-width: 900px)' ) ;
88 expect ( window . matchMedia ) . toHaveBeenCalledWith ( 'screen' ) ;
99 expect ( window . matchMedia ) . toHaveBeenCalledWith ( 'not print' ) ;
10+ expect ( window . matchMedia ) . toHaveBeenCalledWith ( 'screen,print' ) ;
11+ expect ( window . matchMedia ) . toHaveBeenCalledWith ( 'screen, print' ) ;
12+ expect ( window . matchMedia ) . toHaveBeenCalledWith ( 'screen, random' ) ;
1013 }
1114} ) ;
Original file line number Diff line number Diff line change 55 const mq2 = new MediaQuery (" min-width: 900px" );
66 const mq3 = new MediaQuery (" screen" );
77 const mq4 = new MediaQuery (" not print" );
8+ const mq5 = new MediaQuery (" screen,print" );
9+ const mq6 = new MediaQuery (" screen, print" );
10+ const mq7 = new MediaQuery (" screen, random" );
811 </script >
You can’t perform that action at this time.
0 commit comments