mirror of https://github.com/sveltejs/svelte
parent
099b6f002a
commit
9f0b6781f1
@ -0,0 +1,47 @@
|
||||
export default {
|
||||
props: {
|
||||
props: {
|
||||
foo: 'lol',
|
||||
baz: 40 + 2,
|
||||
}
|
||||
},
|
||||
|
||||
html: `
|
||||
<div baz="42" foo="lol" qux="named"></div>
|
||||
`,
|
||||
|
||||
test({ assert, component, target }) {
|
||||
const html = `
|
||||
<div qux="named"></div>
|
||||
`;
|
||||
|
||||
// test undefined
|
||||
component.props = undefined;
|
||||
assert.htmlEqual(target.innerHTML, html);
|
||||
|
||||
// set object props
|
||||
component.props = this.props.props;
|
||||
assert.htmlEqual(target.innerHTML, this.html);
|
||||
|
||||
// test null
|
||||
component.props = null;
|
||||
assert.htmlEqual(target.innerHTML, html);
|
||||
|
||||
// set object props
|
||||
component.props = this.props.props;
|
||||
assert.htmlEqual(target.innerHTML, this.html);
|
||||
|
||||
// test boolean
|
||||
component.props = true;
|
||||
assert.htmlEqual(target.innerHTML, html);
|
||||
|
||||
// set object props
|
||||
component.props = this.props.props;
|
||||
assert.htmlEqual(target.innerHTML, this.html);
|
||||
|
||||
// test number
|
||||
component.props = 123;
|
||||
assert.htmlEqual(target.innerHTML, html);
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
export let props;
|
||||
</script>
|
||||
|
||||
<div {...props} qux="named"/>
|
Loading…
Reference in new issue