test: simplify computed last sub test case
This commit is contained in:
parent
6fcb80172f
commit
d1764a142a
|
@ -1013,16 +1013,9 @@ describe('reactivity/computed', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('computed should remain live after losing all subscribers', () => {
|
test('computed should remain live after losing all subscribers', () => {
|
||||||
const toggle = ref(true)
|
const state = reactive({ a: 1 })
|
||||||
const state = reactive({
|
|
||||||
a: 1,
|
|
||||||
})
|
|
||||||
const p = computed(() => state.a + 1)
|
const p = computed(() => state.a + 1)
|
||||||
const pp = computed(() => {
|
const { effect: e } = effect(() => p.value)
|
||||||
return toggle.value ? p.value : 111
|
|
||||||
})
|
|
||||||
|
|
||||||
const { effect: e } = effect(() => pp.value)
|
|
||||||
e.stop()
|
e.stop()
|
||||||
|
|
||||||
expect(p.value).toBe(2)
|
expect(p.value).toBe(2)
|
||||||
|
|
Loading…
Reference in New Issue