You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime-browser/samples/inline-style-directive-prec.../_config.js

25 lines
840 B

export default {
html: `
<p style="font-size: 32px; color: red; background-color: green; border-color: green;"></p>
`,
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');
assert.equal(styles.backgroundColor, 'rgb(0, 128, 0)');
assert.equal(styles.borderColor, 'rgb(0, 128, 0)');
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');
assert.equal(styles.backgroundColor, 'rgb(0, 128, 0)');
assert.equal(styles.borderColor, 'rgb(0, 128, 0)');
}
}
};