mirror of https://github.com/sveltejs/svelte
run transitions in context of component - fixes #1675
parent
e450c30943
commit
af1902d510
@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
test(assert, component, target, window, raf) {
|
||||||
|
const div = target.querySelector('div');
|
||||||
|
assert.equal(div.foo, 42);
|
||||||
|
|
||||||
|
raf.tick(50);
|
||||||
|
assert.equal(div.foo, 42);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,20 @@
|
|||||||
|
<div transition:foo></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return { x: 42 };
|
||||||
|
},
|
||||||
|
|
||||||
|
transitions: {
|
||||||
|
foo(node, params) {
|
||||||
|
return {
|
||||||
|
duration: 100,
|
||||||
|
tick: t => {
|
||||||
|
node.foo = this.get().x;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in new issue