mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 20:14:39 +00:00
overhaul tests
This commit is contained in:
3
test/apps/preloading/src/routes/_error.html
Normal file
3
test/apps/preloading/src/routes/_error.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>{status}</h1>
|
||||
|
||||
<p>{error.message}</p>
|
||||
15
test/apps/preloading/src/routes/_layout.html
Normal file
15
test/apps/preloading/src/routes/_layout.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{#if preloading}
|
||||
<progress class='preloading-progress' value=0.5/>
|
||||
{/if}
|
||||
|
||||
<svelte:component this={child.component} {rootPreloadFunctionRan} {...child.props}/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
return {
|
||||
rootPreloadFunctionRan: true
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
1
test/apps/preloading/src/routes/foo.html
Normal file
1
test/apps/preloading/src/routes/foo.html
Normal file
@@ -0,0 +1 @@
|
||||
<h1>foo</h1>
|
||||
4
test/apps/preloading/src/routes/index.html
Normal file
4
test/apps/preloading/src/routes/index.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<h1>Great success!</h1>
|
||||
|
||||
<a href="slow-preload">slow preload</a>
|
||||
<a href="foo">foo</a>
|
||||
1
test/apps/preloading/src/routes/preload-root/index.html
Normal file
1
test/apps/preloading/src/routes/preload-root/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<h1>root preload function ran: {rootPreloadFunctionRan}</h1>
|
||||
@@ -0,0 +1,17 @@
|
||||
<h1>{foo.bar()}</h1>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
class Foo {
|
||||
bar() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
foo: new Foo()
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
<svelte:component this={child.component} {...child.props}/>
|
||||
11
test/apps/preloading/src/routes/preload-values/set.html
Normal file
11
test/apps/preloading/src/routes/preload-values/set.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<h1>{set.has('x')}</h1>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
return {
|
||||
set: new Set(['x'])
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
15
test/apps/preloading/src/routes/slow-preload.html
Normal file
15
test/apps/preloading/src/routes/slow-preload.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<h1>This page should never render</h1>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
return new Promise(fulfil => {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.fulfil = fulfil;
|
||||
} else {
|
||||
fulfil({});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user