-
-
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: interpolated style directive updates properly with spread (#8505)
fixes #8438
- Loading branch information
Showing
3 changed files
with
40 additions
and
9 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
18 changes: 18 additions & 0 deletions
18
test/runtime-puppeteer/samples/inline-style-directive-update-with-spread/_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,18 @@ | ||
export default { | ||
html: ` | ||
<div style="background-color: rgb(255, 0, 0);"></div> | ||
`, | ||
|
||
test({ assert, target, window, component }) { | ||
const div = target.querySelector('div'); | ||
const styles = window.getComputedStyle(div); | ||
assert.equal(styles.backgroundColor, 'rgb(255, 0, 0)'); | ||
|
||
{ | ||
component.backgroundColor = 128; | ||
const div = target.querySelector('div'); | ||
const styles = window.getComputedStyle(div); | ||
assert.equal(styles.backgroundColor, 'rgb(128, 0, 0)'); | ||
} | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/runtime-puppeteer/samples/inline-style-directive-update-with-spread/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,5 @@ | ||
<script lang="ts"> | ||
export let backgroundColor = 255; | ||
</script> | ||
|
||
<div style:background-color="rgb({backgroundColor}, 0, 0)" {...$$restProps} /> |