-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rework directive name handling (#9470)
* move snapshot test to a runtime test * handle dynamic cases * huh --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>
- Loading branch information
1 parent
73e8820
commit d749685
Showing
7 changed files
with
42 additions
and
168 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
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-runes/samples/directives-with-member-access/_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,5 @@ | ||
import { test } from '../../test'; | ||
|
||
// no need to compare the rendered HTML — we only care | ||
// that the generated code is valid | ||
export default test({}); |
19 changes: 19 additions & 0 deletions
19
packages/svelte/tests/runtime-runes/samples/directives-with-member-access/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,19 @@ | ||
<script> | ||
/** | ||
* @param {Element} [node] | ||
* @param {any} [options] | ||
*/ | ||
const fn = (node, options) => ({}); | ||
let a = { b: { 'c-d': fn } }; | ||
let directive = $derived(a); | ||
</script> | ||
|
||
<!-- these will yield TypeScript errors, because it looks like e.g. `nested.with - string`, | ||
in other words a number. Relatedly, people should not do this. It is stupid. --> | ||
<div use:directive.b.c-d /> | ||
<div transition:directive.b.c-d /> | ||
<div animate:directive.b.c-d /> | ||
<div in:directive.b.c-d /> | ||
<div out:directive.b.c-d /> |
5 changes: 0 additions & 5 deletions
5
packages/svelte/tests/snapshot/samples/directives-with-member-access/_config.js
This file was deleted.
Oops, something went wrong.
108 changes: 0 additions & 108 deletions
108
...lte/tests/snapshot/samples/directives-with-member-access/_expected/client/index.svelte.js
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
packages/svelte/tests/snapshot/samples/directives-with-member-access/index.svelte
This file was deleted.
Oops, something went wrong.
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
d749685
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.vercel.app
svelte-octane.vercel.app
svelte-5-preview-svelte.vercel.app
svelte-5-preview-git-main-svelte.vercel.app