pull/10798/head
Rich Harris 2 years ago
parent a7aef7132c
commit 8e118d926c

@ -13,4 +13,4 @@
{#if visible}
<div transition:foo></div>
{/if}
{/if}

@ -5,6 +5,7 @@ export default test({
async test({ assert, component, target, raf }) {
const frame = /** @type {HTMLIFrameElement} */ (target.querySelector('iframe'));
await tick();
await tick(); // TODO investigate why this second tick is necessary. without it, `Foo.svelte` initializes with `visible = true`, incorrectly
component.visible = true;
const div = frame.contentDocument?.querySelector('div');
@ -14,8 +15,10 @@ export default test({
component.visible = false;
raf.tick(26);
// The exact number doesn't matter here, this test is about ensuring that transitions work in iframes
assert.equal(Number(div.style.opacity).toFixed(4), '0.8333');
raf.tick(25);
assert.equal(div.style.opacity, '0.25');
raf.tick(49);
assert.equal(div.style.opacity, '0');
}
});

Loading…
Cancel
Save