overhaul tests

This commit is contained in:
Rich Harris
2018-10-07 18:23:43 -04:00
committed by GitHub
parent 18acef3190
commit 5e59855a15
183 changed files with 4145 additions and 3126 deletions

View File

@@ -0,0 +1 @@
<h1>{params.slug.toUpperCase()}</h1>

View File

@@ -0,0 +1,3 @@
<h1>{status}</h1>
<p>{error.message}</p>

View File

@@ -0,0 +1 @@
<h1>a</h1>

View File

@@ -0,0 +1,3 @@
export function get(req, res) {
res.end(req.params.slug);
}

View File

@@ -0,0 +1,11 @@
<h1>{letter}</h1>
<script>
export default {
preload() {
return this.fetch('b.json').then(r => r.json()).then(letter => {
return { letter };
});
}
};
</script>

View File

@@ -0,0 +1,3 @@
export function get(req, res) {
res.end(JSON.stringify('b'));
}

View File

@@ -0,0 +1 @@
<h1>reserved words are okay as routes</h1>

View File

@@ -0,0 +1,9 @@
export function del(req, res) {
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({
id: req.params.id
}));
}

View File

@@ -0,0 +1,19 @@
<button class='del' on:click='del()'>delete</button>
<script>
export default {
oncreate() {
window.deleted = null;
},
methods: {
del() {
fetch(`delete-test/42.json`, { method: 'DELETE' })
.then(r => r.json())
.then(data => {
window.deleted = data;
});
}
}
};
</script>

View File

@@ -0,0 +1,9 @@
<h1>message: "{message}"</h1>
<script>
export default {
preload({ query }) {
return query;
}
};
</script>

View File

@@ -0,0 +1,7 @@
<h1>Great success!</h1>
<a href="a">a</a>
<a href="ambiguous/ok.json">ok</a>
<a href="echo-query?message">ok</a>
<div class='hydrate-test'></div>

View File

@@ -0,0 +1,9 @@
$&
<script>
export default {
preload() {
return '$&';
}
};
</script>