Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocean-OS committed Feb 24, 2025
1 parent 945973b commit bdc2ac5
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from '../../test';

export default test({});
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

var on_click = (_, count) => $.update(count);
var root = $.template(`<h1></h1> <p></p> <button> </button> <p></p> <p></p> <p></p> <!>`, 1);

export default function App($$anchor) {
let a = 1;
let b = 2;
let name = 'world';
let count = $.state(0);

function Component() {} // placeholder component

var fragment = root();
var h1 = $.first_child(fragment);

h1.textContent = 'Hello, world!';

var p = $.sibling(h1, 2);

p.textContent = '1 + 2 = 3';

var button = $.sibling(p, 2);

button.__click = [on_click, count];

var text = $.child(button);

$.reset(button);

var p_1 = $.sibling(button, 2);

p_1.textContent = '1 + 2 = 3';

var p_2 = $.sibling(p_1, 2);

p_2.textContent = 'Sum is 3';

var p_3 = $.sibling(p_2, 2);

p_3.textContent = '1';

var node = $.sibling(p_3, 2);

Component(node, {
a: 1,
get count() {
return $.get(count);
},
c: 3
});

$.template_effect(() => $.set_text(text, `Count is ${$.get(count) ?? ''}`));
$.append($$anchor, fragment);
}

$.delegate(['click']);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as $ from 'svelte/internal/server';

export default function App($$payload) {
let a = 1;
let b = 2;
let name = 'world';
let count = 0;

function Component() {} // placeholder component
$$payload.out += `<h1>Hello, ${$.escape(name)}!</h1> <p>${$.escape(a)} + ${$.escape(b)} = ${$.escape(a + b)}</p> <button>Count is ${$.escape(count)}</button> <p>1 + 2 = ${$.escape(1 + 2)}</p> <p>Sum is ${$.escape((a, b, a + b))}</p> <p>${$.escape(a === 1 ? a : b)}</p> `;
Component($$payload, { a, count, c: a + b });
$$payload.out += `<!---->`;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script>
let a = 1;
let b = 2;
let name = 'world';
let count = $state(0);
function Component() {
// placeholder component
}
</script>
<h1>Hello, {name}!</h1>
<p>{a} + {b} = {a + b}</p>
<button onclick={() => count++}>Count is {count}</button>
<p>{1} + {2} = {1 + 2}</p>
<p>Sum is {(a, b, a + b)}</p>
<p>{a === 1 ? a : b}</p>
<Component {a} {count} c={a+b} />

0 comments on commit bdc2ac5

Please sign in to comment.