tests for C-nodes

pull/16188/head
Manuel Serret 9 months ago
parent 83b19d5a91
commit b4c66841af

@ -357,6 +357,7 @@ const visitors = {
},
ConstTag(node, context) {
// TODO this is buggy
context.write('{@const ');
context.visit(node.declaration);
context.write('}');

@ -0,0 +1,8 @@
<script>
let active = true;
let foo = false;
</script>
<div class:active class:bar={foo}>
Hello world!
</div>

@ -0,0 +1,8 @@
<script>
let active = true;
let foo = false;
</script>
<div class:active class:bar={foo}>
Hello world!
</div>

@ -0,0 +1,9 @@
<style>
.foo {
color: red;
}
.foo.bar {
color: blue;
}
</style>

@ -0,0 +1,11 @@
<style>
.foo {
color: red;
}
.foo.bar {
color: blue;
}
</style>

@ -0,0 +1,5 @@
<!-- inline -->
<!--
multiline
-->

@ -0,0 +1,4 @@
<!-- inline -->
<!--
multiline
-->

@ -0,0 +1,5 @@
<style>
.container .item { color: red; }
nav > ul.menu { display: flex; }
h2 + p.note { margin-top: 0; }
</style>

@ -0,0 +1,15 @@
<style>
.container .item {
color: red;
}
nav > ul.menu {
display: flex;
}
h2 + p.note {
margin-top: 0;
}
</style>

@ -0,0 +1,8 @@
<script>
import C from './C.svelte';
</script>
<C foo="bar" />
<C foo="bar">
<span>Hello World</span>
</C>

@ -0,0 +1,6 @@
<script>
import C from './C.svelte';
</script>
<C foo="bar" />
<C foo="bar"><span>Hello World</span></C>

@ -0,0 +1,8 @@
<script>
const boxes = [];
</script>
{#each boxes as box}
{@const area = box.width * box.height}
{box.width} * {box.height} = {area}
{/each}

@ -0,0 +1,8 @@
<script>
const boxes = [];
</script>
{#each boxes as box}
{@const const area = box.width * box.height;}
{box.width} * {box.height} = {area}
{/each}
Loading…
Cancel
Save