mirror of https://github.com/sveltejs/svelte
parent
e48343af53
commit
4e19bac21e
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
let className
|
||||||
|
export { className as class }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class={className}></div>
|
@ -0,0 +1,15 @@
|
|||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
myClass: 'one two'
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `<div class="one two three"></div>`,
|
||||||
|
|
||||||
|
test({ assert, component, target, window }) {
|
||||||
|
component.myClass = 'one';
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<div class="one three"></div>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte'
|
||||||
|
export let myClass;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Child class={myClass} class:three={true}></Child>
|
@ -0,0 +1 @@
|
|||||||
|
<div {...$$props}></div>
|
@ -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>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,8 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte'
|
||||||
|
|
||||||
|
export let myClass;
|
||||||
|
export let attributes = {};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Child class={myClass} class:three={true} {...attributes}></Child>
|
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
let className
|
||||||
|
export { className as class }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class={className}></div>
|
@ -0,0 +1,15 @@
|
|||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
user: { active: true }
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `<div class="active"></div>`,
|
||||||
|
|
||||||
|
test({ assert, component, target }) {
|
||||||
|
component.user = { active: false };
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<div class></div>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte'
|
||||||
|
export let user;
|
||||||
|
|
||||||
|
function isActive(user) {
|
||||||
|
return user.active;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Child class:active={isActive(user)}></Child>
|
Loading…
Reference in new issue