update tests

pull/2161/head
Conduitry 6 years ago
parent 8f5aba3225
commit 957093e81a

@ -56,8 +56,8 @@ function instance($$self, $$props, $$invalidate) {
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
};
$$self.$$.update = ($$dirty = { bar: 1, foo: 1 }) => {
if ($$dirty.bar || $$dirty.foo) {
$$self.$$.update = ($$dirty = { foo: 1 }) => {
if ($$dirty.foo) {
bar = foo * 2; $$invalidate('bar', bar);
}
};

@ -22,11 +22,11 @@ function instance($$self, $$props, $$invalidate) {
if ('x' in $$props) $$invalidate('x', x = $$props.x);
};
$$self.$$.update = ($$dirty = { b: 1, x: 1, a: 1 }) => {
if ($$dirty.b || $$dirty.x) {
$$self.$$.update = ($$dirty = { x: 1, b: 1 }) => {
if ($$dirty.x) {
b = x; $$invalidate('b', b);
}
if ($$dirty.a || $$dirty.b) {
if ($$dirty.b) {
a = b; $$invalidate('a', a);
}
};

@ -17,12 +17,12 @@ let a = 1;
let b = 2;
function instance($$self, $$props, $$invalidate) {
let max;
$$self.$$.update = ($$dirty = { max: 1, Math: 1, a: 1, b: 1 }) => {
if ($$dirty.max || $$dirty.a || $$dirty.b) {
$$self.$$.update = ($$dirty = { Math: 1, a: 1, b: 1 }) => {
if ($$dirty.a || $$dirty.b) {
max = Math.max(a, b); $$invalidate('max', max);
}
};

@ -11,11 +11,11 @@ export default {
<p>doubled: 4</p>
`);
component.doubled = 6;
component.doubled = 3;
assert.equal(component.doubled, 4);
assert.equal(component.doubled, 3);
assert.htmlEqual(target.innerHTML, `
<p>doubled: 4</p>
<p>doubled: 3</p>
`);
}
};
Loading…
Cancel
Save