-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
detach outroing blocks correctly
- Loading branch information
Showing
8 changed files
with
165 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
test/runtime/samples/nested-transition-detach-each/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export default { | ||
data: { | ||
visible: false, | ||
rows: [1, 2, 3], | ||
cols: ['a', 'b', 'c'] | ||
}, | ||
|
||
html: ``, | ||
|
||
compileOptions: { | ||
dev: true | ||
}, | ||
nestedTransitions: true, | ||
skipIntroByDefault: true, | ||
|
||
test(assert, component, target, window, raf) { | ||
component.set({ visible: true }); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<div class="row"> | ||
<div class="cell">1, a</div> | ||
<div class="cell">1, b</div> | ||
<div class="cell">1, c</div> | ||
</div> | ||
<div class="row"> | ||
<div class="cell">2, a</div> | ||
<div class="cell">2, b</div> | ||
<div class="cell">2, c</div> | ||
</div> | ||
<div class="row"> | ||
<div class="cell">3, a</div> | ||
<div class="cell">3, b</div> | ||
<div class="cell">3, c</div> | ||
</div> | ||
`); | ||
|
||
component.set({ visible: false }); | ||
raf.tick(0); | ||
raf.tick(100); | ||
assert.htmlEqual(target.innerHTML, ``); | ||
}, | ||
}; |
22 changes: 22 additions & 0 deletions
22
test/runtime/samples/nested-transition-detach-each/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{#if visible} | ||
{#each rows as row} | ||
<div out:foo class="row"> | ||
{#each cols as col} | ||
<div out:foo class="cell">{row}, {col}</div> | ||
{/each} | ||
</div> | ||
{/each} | ||
{/if} | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
foo(node) { | ||
return { | ||
duration: 100, | ||
tick: t => node.foo = t | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
44 changes: 44 additions & 0 deletions
44
test/runtime/samples/nested-transition-detach-if-false/Folder.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<li> | ||
<span>{dir}</span> | ||
|
||
{#if open} | ||
<ul> | ||
{#each items as item (item.filename)} | ||
{#if item.isDir} | ||
<svelte:self dir={item.filename}/> | ||
{:else} | ||
<li>{item.filename}</li> | ||
{/if} | ||
{/each} | ||
</ul> | ||
{/if} | ||
</li> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return { | ||
items: [], | ||
open: true | ||
}; | ||
}, | ||
|
||
computed: { | ||
items: ({ dir }) => { | ||
return dir === 'a' | ||
? [ | ||
{ | ||
filename: 'a/b', | ||
isDir: true | ||
} | ||
] | ||
: [ | ||
{ | ||
filename: 'a/b/c', | ||
isDir: false | ||
} | ||
]; | ||
} | ||
} | ||
}; | ||
</script> |
26 changes: 26 additions & 0 deletions
26
test/runtime/samples/nested-transition-detach-if-false/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default { | ||
html: ` | ||
<li> | ||
<span>a</span> | ||
<ul> | ||
<li> | ||
<span>a/b</span> | ||
<ul> | ||
<li>a/b/c</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</li> | ||
`, | ||
|
||
nestedTransitions: true, | ||
|
||
test(assert, component, target, window, raf) { | ||
component.refs.folder.set({ open: false }); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<li> | ||
<span>a</span> | ||
</li> | ||
`); | ||
}, | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/runtime/samples/nested-transition-detach-if-false/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Folder ref:folder dir="a"/> | ||
|
||
<script> | ||
export default { | ||
components: { | ||
Folder: './Folder.html' | ||
} | ||
}; | ||
</script> |