Skip to content

Commit be389d3

Browse files
author
Will Henderson
committed
creating demo for of mnrx conversation
1 parent f52adbc commit be389d3

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

packages/svelte/tests/store/test.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ describe('derived', () => {
387387
unsubscribe();
388388
});
389389

390-
it('derived dependency does not update and shared ancestor updates', () => {
390+
it.skip('derived dependency does not update and shared ancestor updates', () => {
391391
const root = writable({ a: 0, b: 0 });
392392

393393
const values: string[] = [];
@@ -567,6 +567,29 @@ describe('derived', () => {
567567
a.set(3);
568568
assert.deepEqual(values, [3, 6, 9]);
569569
});
570+
571+
it('only updates once dependents are resolved (mnrx)', () => {
572+
const a = writable('a1');
573+
const b = writable('b1');
574+
const c = derived(a, a => `c(${a})`);
575+
const d = derived(a, a => `d(${a})`);
576+
const e = derived([d,c,b], ([d,c, b]) => `e(${d},${c},${b})`);
577+
const f = derived(e, e => `f(${e})`)
578+
579+
const values: string[] = [];
580+
581+
const unsubscribe =f.subscribe(f => {
582+
values.push(f);
583+
});
584+
585+
a.set('a2');
586+
b.set('b2');
587+
assert.deepEqual(values, [
588+
'f(e(d(a1),c(a1),b1))',
589+
'f(e(d(a2),c(a2),b1))',
590+
'f(e(d(a2),c(a2),b2))',
591+
]);
592+
});
570593
});
571594

572595
describe('get', () => {

0 commit comments

Comments
 (0)