Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

VBID-1476 Handle multiple commas in moneyField

Change-Id: I45e0050eb8458ff7dcede5529f4b1416659293a2
  • Loading branch information...
commit 19fe3d51a3bc0d1b59e3a1476793aea9dbab0ccf 1 parent 9304076
@jawsthegame jawsthegame authored
View
2  lib/lib/forms.coffee
@@ -145,7 +145,7 @@ intField =
moneyField =
get: (el, defaultValue) ->
- stripped = el.val().replace(',', '')
+ stripped = el.val().replace(/\,/g, '')
money = parseFloat(stripped)
if _.isNaN(money)
return defaultValue if defaultValue?
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "quips",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"coffee-script": "1.6.x",
"jqueryify": "1.9.1",
View
4 test/lib/forms_spec.coffee
@@ -342,8 +342,8 @@ describe 'Money Field', ->
expect(forms.moneyField.get(@el, 0.00)).to.equal 0.00
it 'should ignore commas', ->
- @el.val('500,000')
- expect(forms.moneyField.get(@el)).to.equal '500000.00'
+ @el.val('5,000,000')
+ expect(forms.moneyField.get(@el)).to.equal '5000000.00'
describe 'Date Time Field', ->
Please sign in to comment.
Something went wrong with that request. Please try again.