Skip to content

Commit

Permalink
fix(runtime-core): ensure consistent behavior between dev/prod on inv…
Browse files Browse the repository at this point in the history
…alid v-for range

close #5867
  • Loading branch information
yyx990803 committed May 6, 2022
1 parent 4e7b36f commit 67099fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/runtime-core/__tests__/helpers/renderList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion packages/runtime-core/src/helpers/renderList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 67099fe

Please sign in to comment.