mirror of https://github.com/sveltejs/svelte
fix: style directive not reactive in {#each} loop (#7140)
parent
815bc7ef6e
commit
dc06ea916e
@ -1,18 +1,25 @@
|
||||
export default {
|
||||
html: `
|
||||
<p style="color: red;"></p>
|
||||
<p style="color: red;"></p>
|
||||
`,
|
||||
|
||||
test({ assert, component, target, window }) {
|
||||
const p = target.querySelector('p');
|
||||
const [p1, p2] = target.querySelectorAll('p');
|
||||
|
||||
let styles = window.getComputedStyle(p);
|
||||
assert.equal(styles.color, 'red');
|
||||
assert.equal(window.getComputedStyle(p1).color, 'red');
|
||||
assert.equal(window.getComputedStyle(p2).color, 'red');
|
||||
|
||||
component.color = 'blue';
|
||||
assert.htmlEqual(target.innerHTML, '<p style="color: blue;"></p>');
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<p style="color: blue;"></p>
|
||||
<p style="color: blue;"></p>
|
||||
`
|
||||
);
|
||||
|
||||
styles = window.getComputedStyle(p);
|
||||
assert.equal(styles.color, 'blue');
|
||||
assert.equal(window.getComputedStyle(p1).color, 'blue');
|
||||
assert.equal(window.getComputedStyle(p2).color, 'blue');
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in new issue