mirror of https://github.com/sveltejs/svelte
fix: ensure hmr block effects are transparent for transitions (#12384)
* fix: ensure hmr block effects are transparent for transitions * add testpull/12391/head
parent
ce669987a6
commit
125156d7d5
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure hmr block effects are transparent for transitions
|
@ -0,0 +1 @@
|
||||
<div></div>
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
function show(node) {
|
||||
return {
|
||||
duration: 500,
|
||||
css: (t) => `opacity: ${t}`,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="red" in:show></div>
|
@ -0,0 +1,27 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true,
|
||||
hmr: true
|
||||
},
|
||||
|
||||
async test({ assert, target, raf }) {
|
||||
const [b1] = target.querySelectorAll('button');
|
||||
|
||||
b1.click();
|
||||
|
||||
flushSync();
|
||||
|
||||
b1.click();
|
||||
|
||||
flushSync();
|
||||
|
||||
raf.tick(0);
|
||||
|
||||
raf.tick(250);
|
||||
const div = /** @type {HTMLDivElement} */ (target.querySelector('.red'));
|
||||
assert.equal(div.style.opacity, '0.5');
|
||||
}
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
<script>
|
||||
import Red from "./Red.svelte"
|
||||
import Blue from "./Blue.svelte"
|
||||
const comps = {
|
||||
Red,
|
||||
Blue
|
||||
};
|
||||
let activeComp = $state("Red")
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<button onclick={() => activeComp = activeComp === "Red" ? "Blue" : "Red"}>toggle</button>
|
||||
<svelte:component this={comps[activeComp]} />
|
||||
</main>
|
Loading…
Reference in new issue