Skip to content

Commit

Permalink
chore: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
noootwo committed Nov 18, 2024
1 parent 68254f3 commit 375b0b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/reactivity/__tests__/reactiveArray.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type ComputedRef, computed } from '../src/computed'
import { isReactive, reactive, shallowReactive, toRaw } from '../src/reactive'
import { isRef, ref } from '../src/ref'
import { effect } from '../src/effect'
import { getDepFromReactive } from '../src/dep'

describe('reactivity/reactive/Array', () => {
test('should make Array reactive', () => {
Expand Down Expand Up @@ -279,6 +280,13 @@ describe('reactivity/reactive/Array', () => {
expect(proxy).toHaveLength(1)
})

// #12427
test('get reactive array dep', () => {
const array = reactive<number[]>([1])
effect(() => array[0])
expect(getDepFromReactive(toRaw(array), 0)).toBeDefined()
})

describe('Array methods w/ refs', () => {
let original: any[]
beforeEach(() => {
Expand Down

0 comments on commit 375b0b3

Please sign in to comment.