make it a runtime test

pull/9467/head
Simon Holthausen 3 years ago
parent 67c3f696a0
commit be4e594cd5

@ -0,0 +1,9 @@
import { ok, test } from '../../test';
export default test({
test({ target }) {
const button = target.querySelector('button');
ok(button);
button.click();
}
});

@ -0,0 +1,13 @@
<script>
function log() {
// Test that the log function is not hoisted. If it was, this would make the test
// pass still, but Vitest would error because it sees that there are unhandled errors
snippet;
}
</script>
{#snippet snippet()}Hello{/snippet}
<button on:click={log}>
log snippet
</button>

@ -1,31 +0,0 @@
// input.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
function log(_, snippet) {
console.log(snippet);
}
var frag_1 = $.template(`Hello`, true);
var frag = $.template(`<button>log snippet</button>`);
export default function Input($$anchor, $$props) {
$.push($$props, false);
/* Init */
var button = $.open($$anchor, true, frag);
function snippet($$anchor) {
/* Init */
var fragment = $.open_frag($$anchor, true, frag_1);
$.close_frag($$anchor, fragment);
}
button.__click = [log, snippet];
$.close($$anchor, button);
$.pop();
}
$.delegate(["click"]);

@ -1,22 +0,0 @@
// input.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import * as $ from "svelte/internal/server";
export default function Input($$payload, $$props) {
$.push(false);
function log() {
console.log(snippet);
}
function snippet($$payload) {
const anchor = $.create_anchor($$payload);
$$payload.out += anchor;
$$payload.out += `Hello`;
$$payload.out += anchor;
}
$$payload.out += `<button>log snippet</button>`;
$.pop();
}

@ -1,11 +0,0 @@
<script>
function log() {
console.log(snippet)
}
</script>
{#snippet snippet()}Hello{/snippet}
<button on:click={log}>
log snippet
</button>
Loading…
Cancel
Save