Skip to content

Commit 654e6b9

Browse files
committed
fixed test
1 parent 61f8d96 commit 654e6b9

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import { test } from '../../assert';
2-
const tick = () => Promise.resolve();
2+
import { tick } from 'svelte';
33

44
export default test({
55
async test({ assert, target }) {
66
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-
});
7+
/** @type {HTMLDivElement} */
8+
const el = target.querySelector('div');
9+
const animation_end = new window.AnimationEvent('animationend');
10+
11+
await el.dispatchEvent(animation_end);
12+
13+
await tick();
14+
15+
assert.htmlEqual(target.innerHTML, '<div></div> <span>animation ended</span>');
1316
}
1417
});

packages/svelte/tests/runtime-browser/samples/attribute-spreading-with-events/main.svelte

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
<div
77
{...obj}
8-
class="test"
98
ontransitionend={(e) => {
109
// doesnt matter
1110
}}
@@ -16,24 +15,7 @@
1615
</div>
1716

1817
{#if animationEnded}
19-
<span class="result">
18+
<span>
2019
animation ended
2120
</span>
2221
{/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)