mirror of https://github.com/sveltejs/svelte
parent
dc7da40369
commit
ace342239b
@ -0,0 +1,33 @@
|
||||
import { tick } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['hydrate'],
|
||||
|
||||
server_props: {
|
||||
browser: false
|
||||
},
|
||||
|
||||
ssrHtml: `
|
||||
<h1>hello from the server</h1>
|
||||
<h2>hello from the server</h2>
|
||||
<h3>hello from the server</h3>
|
||||
`,
|
||||
|
||||
props: {
|
||||
browser: true
|
||||
},
|
||||
|
||||
async test({ assert, target }) {
|
||||
await tick();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<h1>hello from the browser</h1>
|
||||
<h2>hello from the browser</h2>
|
||||
<h3>hello from the browser</h3>
|
||||
`
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
let { browser = typeof window !== 'undefined' } = $props();
|
||||
</script>
|
||||
|
||||
{#if await true}
|
||||
<h1>hello from the {browser ? 'browser' : 'server'}</h1>
|
||||
{/if}
|
||||
|
||||
<h2>hello from the {browser ? 'browser' : 'server'}</h2>
|
||||
<h3>hello from the {browser ? 'browser' : 'server'}</h3>
|
Loading…
Reference in new issue