mirror of https://github.com/sveltejs/svelte
parent
a98ece855a
commit
d13416590c
@ -0,0 +1,20 @@
|
|||||||
|
/* generated by Svelte vX.Y.Z */
|
||||||
|
import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
|
||||||
|
|
||||||
|
function instance($$self) {
|
||||||
|
switch (1) {
|
||||||
|
case 1:
|
||||||
|
const value = Math.random();
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class Component extends SvelteComponent {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, instance, null, safe_not_equal, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Component;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
switch (1) {
|
||||||
|
case 1:
|
||||||
|
const value = Math.random();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
q: 0
|
||||||
|
},
|
||||||
|
|
||||||
|
html: '<p>3</p>',
|
||||||
|
|
||||||
|
test({ assert, component, target }) {
|
||||||
|
component.q = 1;
|
||||||
|
assert.htmlEqual(target.innerHTML, '<p>4</p>');
|
||||||
|
component.q = 2;
|
||||||
|
assert.htmlEqual(target.innerHTML, '<p>5</p>');
|
||||||
|
component.q = 3;
|
||||||
|
assert.htmlEqual(target.innerHTML, '<p>6</p>');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<script>
|
||||||
|
export let q;
|
||||||
|
let p = 3;
|
||||||
|
$: {
|
||||||
|
switch (q) {
|
||||||
|
case 1:
|
||||||
|
let value = Math.floor(Math.random()); // gives 0
|
||||||
|
p = 4 + value;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
var number = Math.ceil(Math.random()); // gives 1
|
||||||
|
p = 4 + number;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
const foo = 2; // gives 2
|
||||||
|
p = 4 + foo;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{p}
|
||||||
|
</p>
|
||||||
|
|
||||||
Loading…
Reference in new issue