mirror of https://github.com/sveltejs/svelte
parent
b0447bf41e
commit
97ee67c08f
@ -0,0 +1,7 @@
|
||||
export function new_tail(): string {
|
||||
return '%%tail_head%%';
|
||||
}
|
||||
|
||||
export function attach_head(head: string, tail: string): string {
|
||||
return tail.replace('%%tail_head%%', head);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
export default {
|
||||
props: {
|
||||
animalEntries: [
|
||||
{ animal: 'raccoon', class: 'mammal' },
|
||||
{ animal: 'eagle', class: 'bird' }
|
||||
]
|
||||
},
|
||||
|
||||
html: `
|
||||
<p class="mammal">raccoon</p>
|
||||
<p class="bird">eagle</p>
|
||||
`,
|
||||
|
||||
test({ assert, component, target }) {
|
||||
component.animalEntries = [{ animal: 'cow', class: 'mammal' }];
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p class="mammal">cow</p>
|
||||
`);
|
||||
},
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
export let animalEntries;
|
||||
</script>
|
||||
|
||||
{#each animalEntries as { animal, ...props } }
|
||||
<p {...props}>{animal}</p>
|
||||
{/each}
|
@ -0,0 +1,15 @@
|
||||
[{
|
||||
"code": "comma-after-rest",
|
||||
"message": "Comma is not permitted after the rest element",
|
||||
"pos": 100,
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 53,
|
||||
"character": 100
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 53,
|
||||
"character": 100
|
||||
}
|
||||
}]
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
export let animalEntries;
|
||||
</script>
|
||||
|
||||
{#each animalEntries as { animal, features: { ...rest, eyes } } }
|
||||
<p {...rest}>{animal} {eyes}</p>
|
||||
{/each}
|
Loading…
Reference in new issue