mirror of https://github.com/sveltejs/svelte
[fix] style manager transition regression (#7831)
parent
ed078e31fe
commit
07d6d179ab
@ -0,0 +1,17 @@
|
||||
export default {
|
||||
skip_if_ssr: true,
|
||||
skip_if_hydrate: true,
|
||||
skip_if_hydrate_from_ssr: true,
|
||||
test: async ({ component, assert, window, waitUntil }) => {
|
||||
assert.htmlEqual(window.document.head.innerHTML, '');
|
||||
component.visible = true;
|
||||
assert.htmlEqual(window.document.head.innerHTML, '<style></style>');
|
||||
await waitUntil(() => window.document.head.innerHTML === '');
|
||||
assert.htmlEqual(window.document.head.innerHTML, '');
|
||||
|
||||
component.visible = false;
|
||||
assert.htmlEqual(window.document.head.innerHTML, '<style></style>');
|
||||
await waitUntil(() => window.document.head.innerHTML === '');
|
||||
assert.htmlEqual(window.document.head.innerHTML, '');
|
||||
}
|
||||
};
|
@ -0,0 +1,16 @@
|
||||
<script>
|
||||
export let visible;
|
||||
|
||||
function foo() {
|
||||
return {
|
||||
duration: 10,
|
||||
css: t => {
|
||||
return `opacity: ${t}`;
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
<div transition:foo></div>
|
||||
{/if}
|
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
test: async ({ assert, component, window, waitUntil }) => {
|
||||
component.visible = true;
|
||||
await waitUntil(() => window.document.head.querySelector('style').sheet.rules.length === 2);
|
||||
assert.equal(window.document.head.querySelector('style').sheet.rules.length, 2);
|
||||
await waitUntil(() => window.document.head.querySelector('style') === null);
|
||||
assert.equal(window.document.head.querySelector('style'), null);
|
||||
component.visible = false;
|
||||
await waitUntil(() => window.document.head.querySelector('style').sheet.rules.length === 2);
|
||||
assert.equal(window.document.head.querySelector('style').sheet.rules.length, 2);
|
||||
await waitUntil(() => window.document.head.querySelector('style') === null);
|
||||
assert.equal(window.document.head.querySelector('style'), null);
|
||||
}
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
<script>
|
||||
export let visible;
|
||||
|
||||
function foo() {
|
||||
return {
|
||||
duration: 10,
|
||||
css: t => {
|
||||
return `opacity: ${t}`;
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
<div transition:foo></div>
|
||||
{/if}
|
||||
|
||||
{#if !visible}
|
||||
<div transition:foo></div>
|
||||
{/if}
|
@ -1,14 +0,0 @@
|
||||
export default {
|
||||
skip_if_ssr: true,
|
||||
skip_if_hydrate: true,
|
||||
skip_if_hydrate_from_ssr: true,
|
||||
test({ raf, assert, component, window }) {
|
||||
component.visible = true;
|
||||
raf.tick(100);
|
||||
component.visible = false;
|
||||
raf.tick(200);
|
||||
raf.tick(0);
|
||||
|
||||
assert.htmlEqual(window.document.head.innerHTML, '');
|
||||
}
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
<script>
|
||||
export let visible = false;
|
||||
|
||||
function foo() {
|
||||
return {
|
||||
duration: 100,
|
||||
css: () => ''
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
<div transition:foo></div>
|
||||
{/if}
|
Loading…
Reference in new issue