mirror of https://github.com/sveltejs/svelte
parent
cf44cc161c
commit
a98ece855a
@ -0,0 +1,46 @@
|
|||||||
|
/* generated by Svelte vX.Y.Z */
|
||||||
|
import {
|
||||||
|
SvelteComponent,
|
||||||
|
detach,
|
||||||
|
init,
|
||||||
|
insert,
|
||||||
|
noop,
|
||||||
|
safe_not_equal,
|
||||||
|
text
|
||||||
|
} from "svelte/internal";
|
||||||
|
|
||||||
|
function create_fragment(ctx) {
|
||||||
|
let t;
|
||||||
|
|
||||||
|
return {
|
||||||
|
c() {
|
||||||
|
t = text(/*one*/ ctx[0]);
|
||||||
|
},
|
||||||
|
m(target, anchor) {
|
||||||
|
insert(target, t, anchor);
|
||||||
|
},
|
||||||
|
p: noop,
|
||||||
|
i: noop,
|
||||||
|
o: noop,
|
||||||
|
d(detaching) {
|
||||||
|
if (detaching) detach(t);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function instance($$self) {
|
||||||
|
{
|
||||||
|
var one = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [one];
|
||||||
|
}
|
||||||
|
|
||||||
|
class Component extends SvelteComponent {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, instance, create_fragment, safe_not_equal, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Component;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
{
|
||||||
|
var one = 1;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{one}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
html: '<p>12345</p><p>67890</p>'
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
{
|
||||||
|
var foo = 12345;
|
||||||
|
var bar = 67890;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{foo}</p>
|
||||||
|
<p>{bar}</p>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
html: '<p>0</p><p>2</p><p>4</p><p>6</p><p>8</p>'
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
var array = [0, 1, 2, 3, 4];
|
||||||
|
for (var i in array) {
|
||||||
|
array[i] = 2 * i;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each array as a}
|
||||||
|
<p>{a}</p>
|
||||||
|
{/each}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
html: '<p>0</p><p>1</p><p>2</p><p>3</p><p>4</p>'
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
var array = [];
|
||||||
|
for (var i = 0; i < 5; i++) {
|
||||||
|
array[i] = i;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each array as a}
|
||||||
|
<p>{a}</p>
|
||||||
|
{/each}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
export default {
|
||||||
|
html: '<button></button><p>0</p>',
|
||||||
|
|
||||||
|
async test({ assert, target, window }) {
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
const clickEvent = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await button.dispatchEvent(clickEvent);
|
||||||
|
assert.htmlEqual(target.innerHTML, '<button></button><p>4</p>');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
let foo = 0;
|
||||||
|
function handleClick() {
|
||||||
|
var random = 4;
|
||||||
|
foo += random;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={handleClick} />
|
||||||
|
<p>{foo}</p>
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
condition: true
|
||||||
|
},
|
||||||
|
|
||||||
|
html: '<p>true</p><p>123</p><p>0</p>',
|
||||||
|
|
||||||
|
test({ assert, component, target }) {
|
||||||
|
component.condition = false;
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, '<p>false</p><p>123</p><p>0</p>');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<script>
|
||||||
|
export var condition;
|
||||||
|
|
||||||
|
if (condition) {
|
||||||
|
var b = 123;
|
||||||
|
var c = 0;
|
||||||
|
} else {
|
||||||
|
var b = 0;
|
||||||
|
var c = 456;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{condition}</p>
|
||||||
|
<p>{b}</p>
|
||||||
|
<p>{c}</p>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
a: 13
|
||||||
|
},
|
||||||
|
|
||||||
|
html: '<p>169</p>'
|
||||||
|
};
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
export let a;
|
||||||
|
let i = 0;
|
||||||
|
while (++i <= a) {
|
||||||
|
var b = a * i;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{b}</p>
|
||||||
Loading…
Reference in new issue