-
-
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.
fix: improve each block with animate (#9839)
- Loading branch information
Showing
4 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: improve each block with animate |
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
63 changes: 63 additions & 0 deletions
63
packages/svelte/tests/runtime-legacy/samples/animation-flip/_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,63 @@ | ||
import { flushSync } from 'svelte'; | ||
import { ok, test } from '../../test'; | ||
|
||
export default test({ | ||
async test({ assert, target, window }) { | ||
const button = target.querySelector('button'); | ||
ok(button); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>Shuffle</button><div class="list"><label><input type="checkbox"> | ||
write | ||
some | ||
docs</label><label><input type="checkbox"> | ||
start | ||
writing | ||
JSConf | ||
talk</label><label><input type="checkbox"> | ||
buy | ||
some | ||
milk</label><label><input type="checkbox"> | ||
mow | ||
the | ||
lawn</label><label><input type="checkbox"> | ||
feed | ||
the | ||
turtle</label><label><input type="checkbox"> | ||
fix | ||
some | ||
bugs</label></div>` | ||
); | ||
|
||
flushSync(() => { | ||
button.click(); | ||
}); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>Shuffle</button><div class="list"><label><input type="checkbox"> | ||
fix | ||
some | ||
bugs</label><label><input type="checkbox"> | ||
feed | ||
the | ||
turtle</label><label><input type="checkbox"> | ||
mow | ||
the | ||
lawn</label><label><input type="checkbox"> | ||
buy | ||
some | ||
milk</label><label><input type="checkbox"> | ||
start | ||
writing | ||
JSConf | ||
talk</label><label><input type="checkbox"> | ||
write | ||
some | ||
docs</label></div>` | ||
); | ||
} | ||
}); |
27 changes: 27 additions & 0 deletions
27
packages/svelte/tests/runtime-legacy/samples/animation-flip/main.svelte
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,27 @@ | ||
<script> | ||
import { flip } from 'svelte/animate'; | ||
let todos = [ | ||
{ id: 1, done: false, description: 'write some docs' }, | ||
{ id: 2, done: false, description: 'start writing JSConf talk' }, | ||
{ id: 3, done: true, description: 'buy some milk' }, | ||
{ id: 4, done: false, description: 'mow the lawn' }, | ||
{ id: 5, done: false, description: 'feed the turtle' }, | ||
{ id: 6, done: false, description: 'fix some bugs' } | ||
]; | ||
function update() { | ||
todos = Array.from(todos).reverse(); | ||
} | ||
</script> | ||
|
||
<button on:click={update}>Shuffle</button> | ||
|
||
<div class="list"> | ||
{#each todos as todo (todo.id)} | ||
<label animate:flip> | ||
<input type="checkbox" bind:checked={todo.done} /> | ||
{todo.description} | ||
</label> | ||
{/each} | ||
</div> |
08d93a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
svelte-5-preview – ./sites/svelte-5-preview
svelte-5-preview-svelte.vercel.app
svelte-octane.vercel.app
svelte-5-preview-git-main-svelte.vercel.app
svelte-5-preview.vercel.app