mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
<:Self> inside each-block
This commit is contained in:
parent
0f60242bb9
commit
60c9c7c281
@ -180,7 +180,7 @@ function readTagName ( parser ) {
|
||||
|
||||
while ( i-- ) {
|
||||
const fragment = parser.stack[i];
|
||||
if ( fragment.type === 'IfBlock' || fragment.type === 'ElseBlock' ) {
|
||||
if ( fragment.type === 'IfBlock' || fragment.type === 'EachBlock' ) {
|
||||
legal = true;
|
||||
break;
|
||||
}
|
||||
|
65
test/generator/self-reference-tree/_config.js
Normal file
65
test/generator/self-reference-tree/_config.js
Normal file
@ -0,0 +1,65 @@
|
||||
export default {
|
||||
data: {
|
||||
file: {
|
||||
name: '/',
|
||||
type: 'folder',
|
||||
children: [
|
||||
{
|
||||
name: 'foo.jpg',
|
||||
type: 'image'
|
||||
},
|
||||
{
|
||||
name: 'bar.jpg',
|
||||
type: 'image'
|
||||
},
|
||||
{
|
||||
name: 'baz',
|
||||
type: 'folder',
|
||||
children: [
|
||||
{
|
||||
name: '.DS_Store',
|
||||
type: 'junk'
|
||||
},
|
||||
{
|
||||
name: 'README.md',
|
||||
type: 'markdown'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
html: `
|
||||
<article class='file folder'>
|
||||
<span class='name'>/</span>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<article class='file image'>
|
||||
<span class='name'>foo.jpg</span>
|
||||
</article>
|
||||
</li><li>
|
||||
<article class='file image'>
|
||||
<span class='name'>bar.jpg</span>
|
||||
</article>
|
||||
</li><li>
|
||||
<article class='file folder'>
|
||||
<span class='name'>baz</span>
|
||||
<ul>
|
||||
<li>
|
||||
<article class='file junk'>
|
||||
<span class='name'>.DS_Store</span>
|
||||
</article>
|
||||
</li><li>
|
||||
<article class='file markdown'>
|
||||
<span class='name'>README.md</span>
|
||||
</article>
|
||||
</li>
|
||||
</ul>
|
||||
</article>
|
||||
</li>
|
||||
</ul>
|
||||
</article>
|
||||
`
|
||||
};
|
11
test/generator/self-reference-tree/main.html
Normal file
11
test/generator/self-reference-tree/main.html
Normal file
@ -0,0 +1,11 @@
|
||||
<article class='file {{file.type}}'>
|
||||
<span class='name'>{{file.name}}</span>
|
||||
|
||||
{{#if file.type === 'folder'}}
|
||||
<ul>
|
||||
{{#each file.children as child}}
|
||||
<li><:Self file='{{child}}'/></li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</article>
|
Loading…
Reference in New Issue
Block a user