File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
packages/svelte/tests/runtime-browser/samples/attribute-spreading-with-events Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { test } from '../../assert' ;
2
+ const tick = ( ) => Promise . resolve ( ) ;
3
+
4
+ export default test ( {
5
+ async test ( { assert, target } ) {
6
+ await tick ( ) ;
7
+ /** @type {HTMLElement } */
8
+ const el = target . querySelector ( '.test' ) ;
9
+ el . addEventListener ( 'animationend' , async ( ) => {
10
+ await tick ( ) ;
11
+ assert . exists ( document . querySelector ( '.result' ) ) ;
12
+ } ) ;
13
+ }
14
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ let animationEnded = $state (false );
3
+ const obj = {};
4
+ </script >
5
+
6
+ <div
7
+ {...obj }
8
+ class =" test"
9
+ ontransitionend ={(e ) => {
10
+ // doesnt matter
11
+ }}
12
+ onanimationend ={(e ) => {
13
+ animationEnded = true ;
14
+ }}
15
+ >
16
+ </div >
17
+
18
+ {#if animationEnded }
19
+ <span class =" result" >
20
+ animation ended
21
+ </span >
22
+ {/if }
23
+
24
+ <style >
25
+ .test {
26
+ width : 10rem ;
27
+ height : 10rem ;
28
+ background-color : red ;
29
+ animation : test-animation 10ms ;
30
+ }
31
+ @keyframes test-animation {
32
+ from {
33
+ opacity : 0 ;
34
+ }
35
+ to {
36
+ opacity : 1 ;
37
+ }
38
+ }
39
+ </style >
You can’t perform that action at this time.
0 commit comments