-
-
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: deduplicate generated props and action arg names (#10669)
fixes #10662
- Loading branch information
1 parent
e21488f
commit b1b51a4
Showing
5 changed files
with
43 additions
and
1 deletion.
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: deduplicate generated props and action arg names |
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
14 changes: 14 additions & 0 deletions
14
packages/svelte/tests/runtime-legacy/samples/action-component/_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,14 @@ | ||
import { tick } from 'svelte'; | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
accessors: false, | ||
async test({ assert, target }) { | ||
assert.htmlEqual(target.innerHTML, '<button>foo / foo</button><div></div>'); | ||
|
||
const button = target.querySelector('button'); | ||
button?.click(); | ||
await tick(); | ||
assert.htmlEqual(target.innerHTML, '<button>bar / bar</button><div></div>'); | ||
} | ||
}); |
17 changes: 17 additions & 0 deletions
17
packages/svelte/tests/runtime-legacy/samples/action-component/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,17 @@ | ||
<script> | ||
import Component from "./sub.svelte" | ||
let state = 'foo'; | ||
let param = ''; | ||
function action(node, _param) { | ||
param = _param | ||
return { | ||
update(_param) { | ||
param = _param; | ||
} | ||
}; | ||
} | ||
</script> | ||
|
||
<button on:click={() => state = 'bar'}>{state} / {param}</button> | ||
<Component {action} {state}></Component> |
6 changes: 6 additions & 0 deletions
6
packages/svelte/tests/runtime-legacy/samples/action-component/sub.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,6 @@ | ||
<script> | ||
export let action; | ||
export let state; | ||
</script> | ||
|
||
<div use:action={state}></div> |