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 vuejs#5867
  • Loading branch information
yyx990803 authored and iwusong committed May 13, 2022
1 parent 312bf8f commit e436be8
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 e436be8

Please sign in to comment.