mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add test for unlocalize currency filter
- Test that comma is well handle in both cases where comma is the default decimal separator or not.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
describe 'convert string to number with configurated currency', ->
|
||||
filter = null
|
||||
|
||||
beforeEach ->
|
||||
module 'ofn.admin'
|
||||
inject ($filter) ->
|
||||
filter = $filter('unlocalizeCurrency')
|
||||
|
||||
describe "with point as decimal separator for I18n service", ->
|
||||
|
||||
beforeEach ->
|
||||
spyOn(I18n, "toCurrency").and.returnValue "0.1"
|
||||
|
||||
it "handle point as decimal separator", ->
|
||||
expect(filter("1.0")).toEqual 1.0
|
||||
|
||||
it "handle comma as decimal separator", ->
|
||||
expect(filter("1,0")).toEqual 1.0
|
||||
|
||||
describe "with comma as decimal separator for I18n service", ->
|
||||
|
||||
beforeEach ->
|
||||
spyOn(I18n, "toCurrency").and.returnValue "0,1"
|
||||
|
||||
it "handle point as decimal separator", ->
|
||||
expect(filter("1.0")).toEqual 1.0
|
||||
|
||||
it "handle comma as decimal separator", ->
|
||||
expect(filter("1,0")).toEqual 1.0
|
||||
Reference in New Issue
Block a user