mirror of https://github.com/sveltejs/svelte
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.
31 lines
640 B
31 lines
640 B
6 years ago
|
export default {
|
||
|
props: {
|
||
|
x: false,
|
||
|
things: ['a']
|
||
|
},
|
||
|
|
||
|
test({ assert, component, target, raf }) {
|
||
|
component.x = true;
|
||
|
|
||
|
const div1 = target.querySelector('div');
|
||
|
assert.equal(div1.foo, undefined);
|
||
|
|
||
|
raf.tick(100);
|
||
|
assert.equal(div1.foo, undefined);
|
||
|
|
||
|
component.things = ['a', 'b'];
|
||
|
assert.htmlEqual(target.innerHTML, '<div></div><div></div>');
|
||
|
|
||
|
const div2 = target.querySelector('div:last-child');
|
||
|
assert.equal(div1.foo, undefined);
|
||
|
assert.equal(div2.foo, 0);
|
||
|
|
||
|
raf.tick(200);
|
||
|
assert.equal(div1.foo, undefined);
|
||
|
assert.equal(div2.foo, 1);
|
||
|
|
||
|
component.x = false;
|
||
|
assert.htmlEqual(target.innerHTML, '');
|
||
|
},
|
||
|
};
|