mirror of https://github.com/sveltejs/svelte
parent
3bec11a012
commit
92fa13c6d3
@ -0,0 +1,21 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<p style="font-size: 32px; color: red;"></p>
|
||||||
|
`,
|
||||||
|
solo: true,
|
||||||
|
|
||||||
|
test({ assert, target, window, component }) {
|
||||||
|
const p = target.querySelector("p");
|
||||||
|
const styles = window.getComputedStyle(p);
|
||||||
|
assert.equal(styles.color, "rgb(255, 0, 0)");
|
||||||
|
assert.equal(styles.fontSize, "32px");
|
||||||
|
|
||||||
|
component.foo = "font-size: 50px; color: green;"; // Update style attribute
|
||||||
|
{
|
||||||
|
const p = target.querySelector("p");
|
||||||
|
const styles = window.getComputedStyle(p);
|
||||||
|
assert.equal(styles.color, "rgb(255, 0, 0)");
|
||||||
|
assert.equal(styles.fontSize, "32px");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
export let foo = "font-size: 20px; color: blue;";
|
||||||
|
let bar = "32";
|
||||||
|
let baz = "red";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p style:font-size="{bar}px" style:color={baz} style={foo} />
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
export let color1 = 'red';
|
export let color = 'red';
|
||||||
export let color2 = 'blue';
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p style="height: 40px; color: {color2};" style:color={color1} />
|
<p style="height: 40px; color: blue;" style:color={color} />
|
||||||
|
|||||||
Loading…
Reference in new issue