docs: use sapper/cypress for e2e testing

This commit is contained in:
Eric Liu 2020-07-19 11:41:15 -07:00
commit ccdf6af78d
36 changed files with 4373 additions and 26 deletions

View file

@ -0,0 +1,38 @@
<script context="module">
export async function preload({ params }) {
const res = await this.fetch(`components/${params.slug}.json`);
const data = await res.json();
if (res.status === 200) {
return { data };
} else {
this.error(res.status, data.message);
}
}
</script>
<script>
export let data = {};
import { onMount } from "svelte";
let component = undefined;
onMount(async () => {
try {
component = await import(`../examples/${data.title}.svelte`);
} catch (e) {
console.log(e);
}
});
</script>
<svelte:head>
<title>{data.title}</title>
</svelte:head>
<h1>{data.title}</h1>
{#if component}
<svelte:component this={component.default} />
{/if}