mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 19:45:26 +00:00
update some tests
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
<h1>{letter}</h1>
|
||||
<script context="module">
|
||||
export function preload() {
|
||||
return this.fetch('b.json').then(r => r.json()).then(letter => {
|
||||
return { letter };
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
return this.fetch('b.json').then(r => r.json()).then(letter => {
|
||||
return { letter };
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
export let letter;
|
||||
</script>
|
||||
|
||||
<h1>{letter}</h1>
|
||||
@@ -1,19 +1,17 @@
|
||||
<button class='del' on:click='del()'>delete</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
oncreate() {
|
||||
window.deleted = null;
|
||||
},
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
methods: {
|
||||
del() {
|
||||
fetch(`delete-test/42.json`, { method: 'DELETE' })
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
window.deleted = data;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
onMount(() => {
|
||||
window.deleted = null;
|
||||
});
|
||||
|
||||
function del() {
|
||||
fetch(`delete-test/42.json`, { method: 'DELETE' })
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
window.deleted = data;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="del" on:click={del}>delete</button>
|
||||
@@ -1,9 +1,7 @@
|
||||
$&
|
||||
<script context="module">
|
||||
export function preload() {
|
||||
return '$&';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
return '$&';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
$&
|
||||
Reference in New Issue
Block a user