Skip to content

Commit 61f8d96

Browse files
committed
added test
1 parent 929d634 commit 61f8d96

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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>

0 commit comments

Comments
 (0)