diff --git a/packages/runtime-core/__tests__/helpers/renderList.spec.ts b/packages/runtime-core/__tests__/helpers/renderList.spec.ts index d23a63cc08e..63c6fb15cdb 100644 --- a/packages/runtime-core/__tests__/helpers/renderList.spec.ts +++ b/packages/runtime-core/__tests__/helpers/renderList.spec.ts @@ -1,3 +1,4 @@ +import { reactive, ref, shallowReactive } from '../../src/index' import { renderList } from '../../src/helpers/renderList' describe('renderList', () => { @@ -56,4 +57,17 @@ describe('renderList', () => { renderList(undefined, (item, index) => `node ${index}: ${item}`), ).toEqual([]) }) + + it('should render items in a reactive array correctly', () => { + const reactiveArray = reactive([{ foo: ref('foo') }]) + const shallowReactiveArray = shallowReactive([{ foo: ref('foo') }]) + + expect(renderList(reactiveArray, item => `${typeof item.foo}`)).toEqual([ + 'string', + ]) + + expect( + renderList(shallowReactiveArray, item => `${typeof item.foo}`), + ).toEqual(['object']) + }) })