fix(reactivity): account for NaN in value change checks (#361)

This commit is contained in:
Mayness
2019-10-23 10:53:43 -05:00
committed by Evan You
parent 11d0778f9c
commit 18a349ce8c
7 changed files with 47 additions and 8 deletions

View File

@@ -691,4 +691,14 @@ describe('reactivity/effect', () => {
obj.foo = { prop: 1 }
expect(dummy).toBe(1)
})
it('should not be trigger when the value and the old value both are NaN', () => {
const obj = reactive({
foo: NaN
})
const fnSpy = jest.fn(() => obj.foo)
effect(fnSpy)
obj.foo = NaN
expect(fnSpy).toHaveBeenCalledTimes(1)
})
})