File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
packages/svelte/tests/runtime-browser/samples/browser-events-ending-with-capture Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { tick } from 'svelte' ;
2
+ import { test } from '../../assert' ;
3
+
4
+ export default test ( {
5
+ async test ( { assert, window } ) {
6
+ const div = window . document . querySelector ( 'div' ) ;
7
+
8
+ div . dispatchEvent ( new PointerEvent ( 'gotpointercapture' ) ) ;
9
+ div . dispatchEvent ( new PointerEvent ( 'lostpointercapture' ) ) ;
10
+
11
+ await tick ( ) ;
12
+
13
+ assert . equal ( div ?. dataset . lostCaptured , 'true' ) ;
14
+ assert . equal ( div ?. dataset . gotCaptured , 'true' ) ;
15
+ }
16
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ </script >
3
+
4
+ <div
5
+ ongotpointercapture ={(e ) => {
6
+ e .target .dataset .gotCaptured = " true" ;
7
+ }}
8
+ onlostpointercapture ={(e ) => {
9
+ e .target .dataset .lostCaptured = " true" ;
10
+ }}
11
+ >
12
+ </div >
13
+
You can’t perform that action at this time.
0 commit comments