six-widget-support
Advanced tools
Comparing version 0.2.9 to 0.2.10
{ | ||
"name": "six-widget-support", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"description": "Common functionality for SIX Widgets", | ||
@@ -26,7 +26,6 @@ "main": "lib", | ||
"chai": "^3.5.0", | ||
"enzyme": "^1.4.1", | ||
"enzyme": "^1.5.0", | ||
"mocha": "^2.4.5", | ||
"numeraljs": "^1.5.6", | ||
"react": "^0.14.3", | ||
"react-addons-test-utils": "^0.14.6", | ||
"react-addons-test-utils": "^0.14.3", | ||
"react-dom": "^0.14.3", | ||
@@ -40,3 +39,6 @@ "sinon": "^1.17.3", | ||
"react-dom": "^0.14.3" | ||
}, | ||
"dependencies": { | ||
"numeraljs": "^1.5.6" | ||
} | ||
} |
@@ -5,10 +5,35 @@ import { expect } from 'chai'; | ||
describe('number-formatter', () => { | ||
describe('with no locale', () => { | ||
describe('by default', () => { | ||
let formatter = new NumberFormatter(); | ||
it('should format "falsy" values as \'-\'', () => { | ||
expect(formatter.fmtNbr(null)).to.equal('-'); | ||
expect(formatter.fmtPc(null)).to.equal('-'); | ||
expect(formatter.abbrNbr(null)).to.equal('-'); | ||
expect(formatter.fmtTm(null)).to.equal('-'); | ||
expect(formatter.fmtNbr(NaN)).to.equal('-'); | ||
expect(formatter.fmtPc(NaN)).to.equal('-'); | ||
expect(formatter.abbrNbr(NaN)).to.equal('-'); | ||
expect(formatter.fmtNbr(undefined)).to.equal('-'); | ||
expect(formatter.fmtPc(undefined)).to.equal('-'); | ||
expect(formatter.abbrNbr(undefined)).to.equal('-'); | ||
expect(formatter.fmtTm(undefined)).to.equal('-'); | ||
expect(formatter.fmtNbr('')).to.equal('-'); | ||
expect(formatter.fmtPc('')).to.equal('-'); | ||
expect(formatter.abbrNbr('')).to.equal('-'); | ||
expect(formatter.fmtTm('')).to.equal('-'); | ||
}); | ||
it('should use default language', () => { | ||
expect(formatter.fmtNbr(10.1)).to.equal('10,10'); | ||
expect(formatter.fmtNbr(10000)).to.equal('10 000,00'); | ||
expect(formatter.abbrNbr(1000000)).to.equal('1,00 mn'); | ||
expect(formatter.fmtNbr(10.1230)).to.equal('10,123'); | ||
expect(formatter.fmtNbr(10000)).to.equal('10 000'); | ||
expect(formatter.abbrNbr(1000000)).to.equal('1 M'); | ||
}); | ||
it('should format percent values with no thousand separator two decimal places', () => { | ||
expect(formatter.fmtPc(1000.123)).to.equal('1000,12'); | ||
}); | ||
}); | ||
@@ -21,4 +46,4 @@ | ||
expect(formatter.fmtNbr(10.1)).to.equal('10,10'); | ||
expect(formatter.fmtNbr(10000)).to.equal('10 000,00'); | ||
expect(formatter.abbrNbr(1000000)).to.equal('1,00 mn'); | ||
expect(formatter.fmtNbr(10000)).to.equal('10 000'); | ||
expect(formatter.abbrNbr(1000000)).to.equal('1 M'); | ||
}); | ||
@@ -30,14 +55,18 @@ }) | ||
it('should use comma as decimal delimiter and two decimal places', () => { | ||
it('should use comma as decimal delimiter and at least two decimal places', () => { | ||
expect(formatter.fmtNbr(10.1)).to.equal('10,10'); | ||
}); | ||
it('should show up to three decimal places if there\'s enough precision', () => { | ||
expect(formatter.fmtNbr(10.123)).to.equal('10,123'); | ||
}); | ||
it('should use space as thousands delimiter', () => { | ||
expect(formatter.fmtNbr(10000)).to.equal('10 000,00'); | ||
expect(formatter.fmtNbr(10000)).to.equal('10 000'); | ||
}); | ||
it('should use swedish abbreviations', () => { | ||
expect(formatter.abbrNbr(1000000)).to.equal('1,00 mn'); | ||
expect(formatter.abbrNbr(1000)).to.equal('1,00 k'); | ||
expect(formatter.abbrNbr(1000000000)).to.equal('1,00 md'); | ||
expect(formatter.abbrNbr(1000000)).to.equal('1 M'); | ||
expect(formatter.abbrNbr(1000)).to.equal('1 k'); | ||
expect(formatter.abbrNbr(1000000000)).to.equal('1 G'); | ||
}); | ||
@@ -49,3 +78,3 @@ }); | ||
it('should use dot as a decimal delimiter and two decimal places', () => { | ||
it('should use dot as a decimal delimiter and at least two decimal places', () => { | ||
expect(formatter.fmtNbr(10.1)).to.equal('10.10'); | ||
@@ -55,9 +84,9 @@ }); | ||
it('should use comma as thousands delimiter', () => { | ||
expect(formatter.fmtNbr(10000)).to.equal('10,000.00'); | ||
expect(formatter.fmtNbr(10000)).to.equal('10,000'); | ||
}); | ||
it('should use english abbreviations', () => { | ||
expect(formatter.abbrNbr(1000000)).to.equal('1.00 m'); | ||
expect(formatter.abbrNbr(1000)).to.equal('1.00 k'); | ||
expect(formatter.abbrNbr(1000000000)).to.equal('1.00 b'); | ||
expect(formatter.abbrNbr(1000000)).to.equal('1 M'); | ||
expect(formatter.abbrNbr(1000)).to.equal('1 k'); | ||
expect(formatter.abbrNbr(1000000000)).to.equal('1 G'); | ||
}); | ||
@@ -73,12 +102,12 @@ }); | ||
expect(formatter2.fmtNbr(10.1)).to.equal('10.10'); | ||
expect(formatter1.abbrNbr(1000000)).to.equal('1,00 mn'); | ||
expect(formatter1.abbrNbr(1000)).to.equal('1,00 k'); | ||
expect(formatter1.abbrNbr(1000000000)).to.equal('1,00 md'); | ||
expect(formatter2.abbrNbr(1000000)).to.equal('1.00 m'); | ||
expect(formatter2.abbrNbr(1000)).to.equal('1.00 k'); | ||
expect(formatter2.abbrNbr(1000000000)).to.equal('1.00 b'); | ||
expect(formatter1.fmtNbr(10000)).to.equal('10 000,00'); | ||
expect(formatter2.fmtNbr(10000)).to.equal('10,000.00'); | ||
expect(formatter1.abbrNbr(1000000)).to.equal('1 M'); | ||
expect(formatter1.abbrNbr(1000)).to.equal('1 k'); | ||
expect(formatter1.abbrNbr(1000000000)).to.equal('1 G'); | ||
expect(formatter2.abbrNbr(1000000)).to.equal('1 M'); | ||
expect(formatter2.abbrNbr(1000)).to.equal('1 k'); | ||
expect(formatter2.abbrNbr(1000000000)).to.equal('1 G'); | ||
expect(formatter1.fmtNbr(10000)).to.equal('10 000'); | ||
expect(formatter2.fmtNbr(10000)).to.equal('10,000'); | ||
}); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17
16669
4
7
359
1
+ Addednumeraljs@^1.5.6
+ Addednumeraljs@1.5.6(transitive)