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,19 +1,21 @@
<h1>{post.title}</h1>
<script context="module">
export function preload({ params }) {
const { slug } = params;
return this.fetch(`blog/${slug}.json`).then(r => {
return r.json().then(data => {
if (r.status !== 200) {
this.error(r.status, data);
}
return data;
});
});
}
</script>
<script>
export default {
preload({ params }) {
const { slug } = params;
export let post;
</script>
return this.fetch(`blog/${slug}.json`).then(r => {
return r.json().then(data => {
if (r.status !== 200) {
this.error(r.status, data);
}
return data;
});
});
}
};
</script>
<h1>{post.title}</h1>

View File

@@ -1,7 +1,5 @@
<script>
export default {
preload() {
this.error(420, 'Enhance your calm');
}
};
<script context="module">
export function preload() {
this.error(420, 'Enhance your calm');
}
</script>

View File

@@ -1,7 +1,5 @@
<script>
export default {
preload() {
throw new Error('nope');
}
};
<script context="module">
export function preload() {
throw new Error('nope');
}
</script>