Skip to content

Commit

Permalink
Merge pull request #1911 from infor-design/1907-fix-us-locale-groupsize
Browse files Browse the repository at this point in the history
1907 - Fix for incorrect groupSize definition on US Locale [v4.17.x]
  • Loading branch information
deep7102 committed Apr 4, 2019
2 parents b2544bb + 3d21e05 commit a995b73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/locale/cultures/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Soho.Locale.addCulture('en-US', {
minusSign: '-',
decimal: '.',
group: ',',
groupSizes: [3, 0]
groupSizes: [3, 3]
},
// Resx - Provided By Translation Team
messages: {
Expand Down
30 changes: 15 additions & 15 deletions test/components/locale/locale.func-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ describe('Locale API', () => {
it('Should format negative numbers', () => {
Locale.set('en-US');

expect(Locale.formatNumber(-1000000, { style: 'currency' })).toEqual('-$1000,000.00');
expect(Locale.formatNumber(-1000000, { style: 'currency' })).toEqual('-$1,000,000.00');

Locale.set('de-DE');

Expand Down Expand Up @@ -1053,7 +1053,7 @@ describe('Locale API', () => {
});

it('Should handle group size', () => {
Locale.set('en-US'); // 3, 0
Locale.set('en-US'); // 3, 3

expect(Locale.formatNumber(-2.53, { style: 'percent', minimumFractionDigits: 2 })).toEqual('-253.00 %');
expect(Locale.formatNumber(1.1234)).toEqual('1.123');
Expand All @@ -1062,11 +1062,11 @@ describe('Locale API', () => {
expect(Locale.formatNumber(1234.1234)).toEqual('1,234.123');
expect(Locale.formatNumber(12345.1234)).toEqual('12,345.123');
expect(Locale.formatNumber(123456.1234)).toEqual('123,456.123');
expect(Locale.formatNumber(1234567.1234)).toEqual('1234,567.123');
expect(Locale.formatNumber(12345678.1234)).toEqual('12345,678.123');
expect(Locale.formatNumber(123456789.1234)).toEqual('123456,789.123');
expect(Locale.formatNumber(1234567890.1234)).toEqual('1234567,890.123');
expect(Locale.formatNumber(123456789.1234, { style: 'currency' })).toEqual('$123456,789.12');
expect(Locale.formatNumber(1234567.1234)).toEqual('1,234,567.123');
expect(Locale.formatNumber(12345678.1234)).toEqual('12,345,678.123');
expect(Locale.formatNumber(123456789.1234)).toEqual('123,456,789.123');
expect(Locale.formatNumber(1234567890.1234)).toEqual('1,234,567,890.123');
expect(Locale.formatNumber(123456789.1234, { style: 'currency' })).toEqual('$123,456,789.12');
expect(Locale.formatNumber(100, { style: 'percent' })).toEqual('10,000 %');

Locale.set('nl-NL'); // 3, 3
Expand Down Expand Up @@ -1103,7 +1103,7 @@ describe('Locale API', () => {
});

it('Should parse group size', () => {
Locale.set('en-US'); // 3, 0
Locale.set('en-US'); // 3, 3

expect(Locale.parseNumber('-253.00 %')).toEqual(-253);
expect(Locale.parseNumber('1.123')).toEqual(1.123);
Expand Down Expand Up @@ -1153,7 +1153,7 @@ describe('Locale API', () => {
});

it('Should be able to not show the group size', () => {
Locale.set('en-US'); // 3, 0
Locale.set('en-US'); // 3, 3

expect(Locale.formatNumber(1234567.1234, { group: '' })).toEqual('1234567.123');
expect(Locale.formatNumber(12345678.1234, { group: '' })).toEqual('12345678.123');
Expand All @@ -1170,7 +1170,7 @@ describe('Locale API', () => {
});

it('Should be able to set the group size', () => {
Locale.set('en-US'); // 3, 0
Locale.set('en-US'); // 3, 3

expect(Locale.formatNumber(1234567.1234, { groupSizes: [3, 0] })).toEqual('1234,567.123');
expect(Locale.formatNumber(12345678.1234, { groupSizes: [3, 0] })).toEqual('12345,678.123');
Expand All @@ -1187,7 +1187,7 @@ describe('Locale API', () => {
});

it('Should be able to set zero group size', () => {
Locale.set('en-US'); // 3, 0
Locale.set('en-US'); // 3, 3

expect(Locale.formatNumber(1234567.1234, { groupSizes: [0, 0] })).toEqual('1234567.123');
expect(Locale.formatNumber(12345678.1234, { groupSizes: [0, 0] })).toEqual('12345678.123');
Expand Down Expand Up @@ -1244,17 +1244,17 @@ describe('Locale API', () => {
Locale.getLocale('nl-NL').done(() => {
expect(Locale.currentLocale.name).toEqual('en-US');

expect(Locale.formatNumber(123456789.1234, { locale: 'en-US' })).toEqual('123456,789.123');
expect(Locale.formatNumber(123456789.1234)).toEqual('123456,789.123');
expect(Locale.formatNumber(123456789.1234, { locale: 'en-US' })).toEqual('123,456,789.123');
expect(Locale.formatNumber(123456789.1234)).toEqual('123,456,789.123');
expect(Locale.formatNumber(123456789.1234, { locale: 'nl-NL' })).toEqual('123.456.789,123');
expect(Locale.currentLocale.name).toEqual('en-US');
});

Locale.getLocale('hi-IN').done(() => {
expect(Locale.currentLocale.name).toEqual('en-US');

expect(Locale.formatNumber(123456789.1234, { locale: 'en-US' })).toEqual('123456,789.123');
expect(Locale.formatNumber(123456789.1234)).toEqual('123456,789.123');
expect(Locale.formatNumber(123456789.1234, { locale: 'en-US' })).toEqual('123,456,789.123');
expect(Locale.formatNumber(123456789.1234)).toEqual('123,456,789.123');
expect(Locale.formatNumber(123456789.1234, { locale: 'hi-IN' })).toEqual('12,34,56,789.123');
expect(Locale.currentLocale.name).toEqual('en-US');
done();
Expand Down

0 comments on commit a995b73

Please sign in to comment.