Skip to content

Commit

Permalink
fix currency filter negative formatting (fix vuejs#2300)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 4, 2016
1 parent 5397333 commit f3e6f9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
: ''
var _float = stringified.slice(-3)
var sign = value < 0 ? '-' : ''
return currency + sign + head +
return sign + currency + head +
_int.slice(i).replace(digitsRE, '$1,') +
_float
},
Expand Down
6 changes: 3 additions & 3 deletions test/unit/specs/filters/filters_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ describe('Filters', function () {
expect(filter(undefined)).toBe('')
expect(filter(Infinity)).toBe('')
// negative numbers
expect(filter(-50)).toBe('$-50.00')
expect(filter(-150.43)).toBe('$-150.43')
expect(filter(-1500.4343434)).toBe('$-1,500.43')
expect(filter(-50)).toBe('-$50.00')
expect(filter(-150.43)).toBe('-$150.43')
expect(filter(-1500.4343434)).toBe('-$1,500.43')
})

it('debounce', function (done) {
Expand Down

0 comments on commit f3e6f9f

Please sign in to comment.