File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed
Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,20 @@ window.localStorage = {
134134} ;
135135
136136// used for native dark/light mode detection
137- window . matchMedia = ( ) => true ;
137+ window . matchMedia = ( ) => ( {
138+ matches : false ,
139+ media : '' ,
140+ onchange : null ,
141+ // eslint-disable-next-line no-empty-function
142+ addListener : ( ) => { } , // Deprecated
143+ // eslint-disable-next-line no-empty-function
144+ removeListener : ( ) => { } , // Deprecated
145+ // eslint-disable-next-line no-empty-function
146+ addEventListener : ( ) => { } ,
147+ // eslint-disable-next-line no-empty-function
148+ removeEventListener : ( ) => { } ,
149+ dispatchEvent : ( ) => true ,
150+ } ) ;
138151
139152// override @metamask /logo
140153window . requestAnimationFrame = ( ) => undefined ;
Original file line number Diff line number Diff line change @@ -9,21 +9,6 @@ jest.mock('webextension-polyfill', () => {
99 } ;
1010} ) ;
1111
12- // Mock window.matchMedia
13- Object . defineProperty ( window , 'matchMedia' , {
14- writable : true ,
15- value : jest . fn ( ) . mockImplementation ( ( query ) => ( {
16- matches : false ,
17- media : query ,
18- onchange : null ,
19- addListener : jest . fn ( ) , // Deprecated
20- removeListener : jest . fn ( ) , // Deprecated
21- addEventListener : jest . fn ( ) ,
22- removeEventListener : jest . fn ( ) ,
23- dispatchEvent : jest . fn ( ) ,
24- } ) ) ,
25- } ) ;
26-
2712const UNRESOLVED = Symbol ( 'timedOut' ) ;
2813
2914// Store this in case it gets stubbed later
You can’t perform that action at this time.
0 commit comments