-
-
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: inline style value become undefined (#8517)
fixes #8462 --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
- Loading branch information
1 parent
6bbae50
commit 32153e3
Showing
3 changed files
with
22 additions
and
2 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
11 changes: 11 additions & 0 deletions
11
test/runtime/samples/inline-style-become-undefined/_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,11 @@ | ||
export default { | ||
async test({ assert, target, window }) { | ||
const div = target.querySelector('div'); | ||
const click = new window.MouseEvent('click'); | ||
|
||
assert.htmlEqual(target.innerHTML, '<div style="background: red;"></div>'); | ||
await div.dispatchEvent(click); | ||
await Promise.resolve(); | ||
assert.htmlEqual(target.innerHTML, '<div style=""></div>'); | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/runtime/samples/inline-style-become-undefined/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,9 @@ | ||
<script> | ||
let bg = "red"; | ||
const handle = () => { | ||
bg = undefined; | ||
}; | ||
</script> | ||
|
||
<div style:background={bg} on:click={handle}></div> |