-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3242 from umanghome/v3-class-deps-fix
[v3] Fix issue where class directives wouldn't work with spread props and class prop
- Loading branch information
Showing
6 changed files
with
64 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
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
21 changes: 21 additions & 0 deletions
21
test/runtime/samples/class-with-dynamic-attribute-and-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,21 @@ | ||
export default { | ||
props: { | ||
myClass: 'one two', | ||
attributes: { | ||
role: 'button' | ||
} | ||
}, | ||
|
||
html: `<div class="one two three" role="button"></div>`, | ||
|
||
test({ assert, component, target, window }) { | ||
component.myClass = 'one'; | ||
component.attributes = { | ||
'aria-label': 'Test' | ||
}; | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<div class="one three" aria-label="Test"></div> | ||
`); | ||
} | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/runtime/samples/class-with-dynamic-attribute-and-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,6 @@ | ||
<script> | ||
export let myClass; | ||
export let attributes = {}; | ||
</script> | ||
|
||
<div class={myClass} class:three={true} {...attributes}></div> |
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,21 @@ | ||
export default { | ||
props: { | ||
myClass: 'one two', | ||
attributes: { | ||
role: 'button' | ||
} | ||
}, | ||
|
||
html: `<div class="one two" role="button"></div>`, | ||
|
||
test({ assert, component, target, window }) { | ||
component.myClass = 'one'; | ||
component.attributes = { | ||
'aria-label': 'Test' | ||
}; | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<div class="one" aria-label="Test"></div> | ||
`); | ||
} | ||
}; |
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 myClass; | ||
export let attributes = {}; | ||
</script> | ||
|
||
<div class={myClass} {...attributes}></div> |