Skip to content

Commit 413aba1

Browse files
authored
fix: STRF-10878 Fix money symbol position when setting is capitalized (#271)
1 parent 9955e92 commit 413aba1

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

helpers/money.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const factory = globals => {
4444
decimalToken
4545
);
4646

47-
return money.currency_location === 'left'
47+
return money.currency_location.toLowerCase() === 'left'
4848
? money.currency_token + ' ' + value
4949
: value + ' ' + money.currency_token;
5050
};

spec/helpers/money.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ describe('money helper', function() {
5656
], done);
5757
});
5858

59+
it('should correctly set currency position regardless of location capitalization - [STRF-10878]', function(done) {
60+
const settingsWithCapitalizedLocation = {
61+
money: {
62+
currency_location: "Left",
63+
currency_token: "$",
64+
decimal_places: 2,
65+
thousands_token: ',',
66+
decimal_token: '.',
67+
}
68+
};
69+
70+
const runTestCases = testRunner({ context, siteSettings: settingsWithCapitalizedLocation });
71+
runTestCases([
72+
{
73+
input: '{{money price}}',
74+
output: '$ 1,234.56',
75+
},
76+
], done);
77+
});
78+
5979
it('should throw an exception if the price value parameter has an invalid type', function(done) {
6080
renderString('{{money "hello"}}').catch(err => {
6181
expect(err.message).to.equal("money helper accepts only Number's as first parameter");

0 commit comments

Comments
 (0)