diff --git a/packages/runtime-core/__tests__/helpers/renderList.spec.ts b/packages/runtime-core/__tests__/helpers/renderList.spec.ts index 06d2825df36..ae487b6be23 100644 --- a/packages/runtime-core/__tests__/helpers/renderList.spec.ts +++ b/packages/runtime-core/__tests__/helpers/renderList.spec.ts @@ -22,7 +22,9 @@ describe('renderList', () => { }) it('should warn when given a non-integer N', () => { - renderList(3.1, () => {}) + try { + renderList(3.1, () => {}) + } catch (e) {} expect( `The v-for range expect an integer value but got 3.1.` ).toHaveBeenWarned() diff --git a/packages/runtime-core/src/helpers/renderList.ts b/packages/runtime-core/src/helpers/renderList.ts index 9fbf967a8ca..1655d555fb3 100644 --- a/packages/runtime-core/src/helpers/renderList.ts +++ b/packages/runtime-core/src/helpers/renderList.ts @@ -67,7 +67,6 @@ export function renderList( } else if (typeof source === 'number') { if (__DEV__ && !Number.isInteger(source)) { warn(`The v-for range expect an integer value but got ${source}.`) - return [] } ret = new Array(source) for (let i = 0; i < source; i++) {