-
-
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
* check for snippet block * change the error msg * edit tests * changeset * test
- Loading branch information
Showing
7 changed files
with
35 additions
and
3 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 | ||
--- | ||
|
||
feat: add support for `{@const}` inside snippet block |
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
16 changes: 16 additions & 0 deletions
16
packages/svelte/tests/runtime-runes/samples/snippet-const/_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,16 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: `<button>0</button>`, | ||
async test({ assert, target }) { | ||
const btn = target.querySelector('button'); | ||
|
||
assert.htmlEqual(target.innerHTML, '<button>0</button>'); | ||
|
||
await btn?.click(); | ||
assert.htmlEqual(target.innerHTML, '<button>2</button>'); | ||
|
||
await btn?.click(); | ||
assert.htmlEqual(target.innerHTML, '<button>4</button>'); | ||
} | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/svelte/tests/runtime-runes/samples/snippet-const/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,10 @@ | ||
<script> | ||
let count = $state(0); | ||
</script> | ||
|
||
{#snippet counter()} | ||
{@const doubled = count * 2} | ||
<button on:click={() => (count += 1)}>{doubled}</button> | ||
{/snippet} | ||
|
||
{@render counter()} |
2 changes: 1 addition & 1 deletion
2
packages/svelte/tests/validator/samples/const-tag-placement-1/errors.json
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
2 changes: 1 addition & 1 deletion
2
packages/svelte/tests/validator/samples/const-tag-placement-2/errors.json
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
55656f5
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-5-preview.vercel.app
svelte-octane.vercel.app
svelte-5-preview-git-main-svelte.vercel.app