mirror of https://github.com/sveltejs/svelte
parent
0580c2d90d
commit
880168a5e3
@ -0,0 +1,25 @@
|
||||
export default {
|
||||
props: {
|
||||
fontWeight: 'bold;',
|
||||
fontSize: 12
|
||||
},
|
||||
html: `
|
||||
<p style="color: red; font-weight: bold; font-size: 12px;"></p>
|
||||
`,
|
||||
|
||||
test({ assert, target, window, component }) {
|
||||
const p = target.querySelector('p');
|
||||
let styles = window.getComputedStyle(p);
|
||||
assert.equal(styles.color, 'red');
|
||||
assert.equal(styles.fontWeight, 'bold');
|
||||
assert.equal(styles.fontSize, '12px');
|
||||
|
||||
component.fontWeight = 'normal;';
|
||||
component.fontSize = '14';
|
||||
assert.htmlEqual(target.innerHTML, '<p style="color: red; font-weight: normal; font-size: 14px;"></p>');
|
||||
styles = window.getComputedStyle(p);
|
||||
assert.equal(styles.color, 'red');
|
||||
assert.equal(styles.fontWeight, 'normal');
|
||||
assert.equal(styles.fontSize, '14px');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
export let fontWeight;
|
||||
export let fontSize;
|
||||
</script>
|
||||
|
||||
<p style:color="red;" style:font-weight={fontWeight} style:font-size="{fontSize}px" />
|
||||
Loading…
Reference in new issue