update some tests

This commit is contained in:
Rich Harris
2019-01-30 10:21:55 -05:00
parent c00af6dad0
commit da540ef15f
23 changed files with 255 additions and 251 deletions

View File

@@ -1,11 +1,13 @@
<h1>{post.title}</h1>
<script context="module">
export function preload({ params }) {
return this.fetch(`blog/${params.slug}.json`).then(r => r.json()).then(post => {
return { post };
});
}
</script>
<script>
export default {
preload({ params }) {
return this.fetch(`blog/${params.slug}.json`).then(r => r.json()).then(post => {
return { post };
});
}
};
</script>
export let post;
</script>
<h1>{post.title}</h1>

View File

@@ -1,15 +1,17 @@
<script context="module">
export function preload() {
return this.fetch('blog.json').then(r => r.json()).then(posts => {
return { posts };
});
}
</script>
<script>
export let posts;
</script>
<h1>blog</h1>
{#each posts as post}
<p><a href="blog/{post.slug}">{post.title}</a></p>
{/each}
<script>
export default {
preload() {
return this.fetch('blog.json').then(r => r.json()).then(posts => {
return { posts };
});
}
};
</script>
{/each}