Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Fix issue where class directives wouldn't work with spread props and class prop #3242

Merged
merged 4 commits into from
Jul 23, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Test] Add test for class directive with spread attributes
  • Loading branch information
umanghome committed Jul 14, 2019
commit 17247d8bb4e9680ac90347099c4a5a01c67d489b
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>
`);
}
};
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>