File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ let nameSpaceContext: JSXContext<string> | undefined = undefined
90
90
const isNodeString = ( node : Node ) : node is NodeString => Array . isArray ( node )
91
91
92
92
const getEventSpec = ( key : string ) : [ string , boolean ] | undefined => {
93
- const match = key . match ( / ^ o n ( [ A - Z ] [ a - z A - Z ] + ?) ( (?< ! P o i n t e r ) C a p t u r e ) ? $ / )
93
+ const match = key . match ( / ^ o n ( [ A - Z ] [ a - z A - Z ] + ?(?: P o i n t e r C a p t u r e ) ? ) ( C a p t u r e ) ? $ / )
94
94
if ( match ) {
95
95
const [ , eventName , capture ] = match
96
96
return [ ( eventAliasMap [ eventName ] || eventName ) . toLowerCase ( ) , ! ! capture ]
Original file line number Diff line number Diff line change @@ -598,6 +598,33 @@ describe('DOM', () => {
598
598
root . querySelector ( 'button' ) ?. click ( )
599
599
expect ( clicked ) . toEqual ( [ 'div' , 'button' , 'button' ] )
600
600
} )
601
+
602
+ it ( 'onGotPointerCapture' , async ( ) => {
603
+ const App = ( ) => {
604
+ return < div onGotPointerCapture = { ( ) => { } } > </ div >
605
+ }
606
+ const addEventListenerSpy = vi . spyOn ( dom . window . Node . prototype , 'addEventListener' )
607
+ render ( < App /> , root )
608
+ expect ( addEventListenerSpy ) . toHaveBeenCalledOnce ( )
609
+ expect ( addEventListenerSpy ) . toHaveBeenCalledWith (
610
+ 'gotpointercapture' ,
611
+ expect . any ( Function ) ,
612
+ false
613
+ )
614
+ } )
615
+ it ( 'onGotPointerCaptureCapture' , async ( ) => {
616
+ const App = ( ) => {
617
+ return < div onGotPointerCaptureCapture = { ( ) => { } } > </ div >
618
+ }
619
+ const addEventListenerSpy = vi . spyOn ( dom . window . Node . prototype , 'addEventListener' )
620
+ render ( < App /> , root )
621
+ expect ( addEventListenerSpy ) . toHaveBeenCalledOnce ( )
622
+ expect ( addEventListenerSpy ) . toHaveBeenCalledWith (
623
+ 'gotpointercapture' ,
624
+ expect . any ( Function ) ,
625
+ true
626
+ )
627
+ } )
601
628
} )
602
629
603
630
it ( 'simple Counter' , async ( ) => {
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ let nameSpaceContext: JSXContext<string> | undefined = undefined
90
90
const isNodeString = ( node : Node ) : node is NodeString => Array . isArray ( node )
91
91
92
92
const getEventSpec = ( key : string ) : [ string , boolean ] | undefined => {
93
- const match = key . match ( / ^ o n ( [ A - Z ] [ a - z A - Z ] + ?) ( (?< ! P o i n t e r ) C a p t u r e ) ? $ / )
93
+ const match = key . match ( / ^ o n ( [ A - Z ] [ a - z A - Z ] + ?(?: P o i n t e r C a p t u r e ) ? ) ( C a p t u r e ) ? $ / )
94
94
if ( match ) {
95
95
const [ , eventName , capture ] = match
96
96
return [ ( eventAliasMap [ eventName ] || eventName ) . toLowerCase ( ) , ! ! capture ]
You can’t perform that action at this time.
0 commit comments