8000 fix currency filter negative formatting (fix #2300) · ws2042/vue@f3e6f9f · GitHub
[go: up one dir, main page]

Skip to content

Commit f3e6f9f

Browse files
committed
fix currency filter negative formatting (fix vuejs#2300)
1 parent 5397333 commit f3e6f9f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/filters/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default {
7878
: ''
7979
var _float = stringified.slice(-3)
8080
var sign = value < 0 ? '-' : ''
81-
return currency + sign + head +
81+
return sign + currency + head +
8282
_int.slice(i).replace(digitsRE, '$1,') +
8383
_float
8484
},

test/unit/specs/filters/filters_spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ describe('Filters', function () {
7575
expect(filter(undefined)).toBe('')
7676
expect(filter(Infinity)).toBe('')
7777
// negative numbers
78-
expect(filter(-50)).toBe('$-50.00')
79-
expect(filter(-150.43)).toBe('$-150.43')
80-
expect(filter(-1500.4343434)).toBe('$-1,500.43')
78+
expect(filter(-50)).toBe('-$50.00')
79+
expect(filter(-150.43)).toBe('-$150.43')
80+
expect(filter(-1500.4343434)).toBe('-$1,500.43')
8181
})
8282

8383
it('debounce', function (done) {

0 commit comments

Comments
 (0)
0