fix(parseYBounds): parseYBounds was parsing integers, causing floating numbers to be trimmed. Updated parseYBounds to parseFloat instead (#18166)

pull/18172/head
Ariel Salem 2020-05-19 14:46:25 -07:00 committed by GitHub
parent ebbc8025b3
commit b913eea568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -15,4 +15,7 @@ describe('parseYBounds', () => {
it('should return [-10, null] when the bounds are ["-10", null]', () => {
expect(parseYBounds(['-10', null])).toEqual([-10, null])
})
it('should return [0.1, .6] when the bounds are ["0.1", "0.6"]', () => {
expect(parseYBounds(['0.1', '0.6'])).toEqual([0.1, 0.6])
})
})

View File

@ -136,8 +136,8 @@ export const parseYBounds = (
return null
}
const min = isNaN(parseInt(bounds[0])) ? null : parseInt(bounds[0])
const max = isNaN(parseInt(bounds[1])) ? null : parseInt(bounds[1])
const min = isNaN(parseFloat(bounds[0])) ? null : parseFloat(bounds[0])
const max = isNaN(parseFloat(bounds[1])) ? null : parseFloat(bounds[1])
return [min, max]
}