File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,4 +10,25 @@ window.matchMedia = window.matchMedia || function() {
1010 addListener : function ( ) { } ,
1111 removeListener : function ( ) { }
1212 } ;
13- } ;
13+ } ;
14+
15+ // Mock PointerEvent methods for JSDOM
16+ if ( typeof window !== 'undefined' && typeof window . HTMLElement !== 'undefined' ) {
17+ window . HTMLElement . prototype . setPointerCapture = window . HTMLElement . prototype . setPointerCapture || function ( pointerId ) { } ;
18+ window . HTMLElement . prototype . releasePointerCapture = window . HTMLElement . prototype . releasePointerCapture || function ( pointerId ) { } ;
19+ // Mock hasPointerCapture to return true after setPointerCapture is called, needed for our component logic
20+ const originalSetPointerCapture = window . HTMLElement . prototype . setPointerCapture ;
21+ const capturedPointers = new Set ( ) ;
22+ window . HTMLElement . prototype . setPointerCapture = function ( pointerId ) {
23+ capturedPointers . add ( pointerId ) ;
24+ originalSetPointerCapture . call ( this , pointerId ) ;
25+ } ;
26+ const originalReleasePointerCapture = window . HTMLElement . prototype . releasePointerCapture ;
27+ window . HTMLElement . prototype . releasePointerCapture = function ( pointerId ) {
28+ capturedPointers . delete ( pointerId ) ;
29+ originalReleasePointerCapture . call ( this , pointerId ) ;
30+ } ;
31+ window . HTMLElement . prototype . hasPointerCapture = window . HTMLElement . prototype . hasPointerCapture || function ( pointerId ) {
32+ return capturedPointers . has ( pointerId ) ;
33+ } ;
34+ }
You can’t perform that action at this time.
0 commit comments