81 |
81 |
assert.equal(kivi.parse_amount('1010.987654321'), 1010.987654321, '1010.987654321');
|
82 |
82 |
assert.equal(kivi.parse_amount('1,010.987654321'), 1010.987654321, '1,010.987654321');
|
83 |
83 |
});
|
|
84 |
|
|
85 |
QUnit.test("kivi.parse_amount function Swiss number style with thousand separator", function( assert ) {
|
|
86 |
kivi.setup_formats({ numbers: '1\'000.00' });
|
|
87 |
|
|
88 |
assert.equal(kivi.parse_amount('10.00'), 10, '10.00');
|
|
89 |
assert.equal(kivi.parse_amount('10.'), 10, '10.');
|
|
90 |
assert.equal(kivi.parse_amount('1010.00'), 1010, '1010.00');
|
|
91 |
assert.equal(kivi.parse_amount('1010.'), 1010, '1010.');
|
|
92 |
assert.equal(kivi.parse_amount('1\'010.00'), 1010, '1\'010.00');
|
|
93 |
assert.equal(kivi.parse_amount('1\'010.'), 1010, '1\'010.');
|
|
94 |
assert.equal(kivi.parse_amount('9\'080\'070\'060\'050\'040\'030\'020\'010.00'), 9080070060050040030020010, '9\'080\'070\'060\'050\'040\'030\'020\'010.00');
|
|
95 |
assert.equal(kivi.parse_amount('9\'080\'070\'060\'050\'040\'030\'020\'010.'), 9080070060050040030020010, '9\'080\'070\'060\'050\'040\'030\'020\'010.');
|
|
96 |
|
|
97 |
assert.equal(kivi.parse_amount('10.98'), 10.98, '10.98');
|
|
98 |
assert.equal(kivi.parse_amount('1010.98'), 1010.98, '1010.98');
|
|
99 |
assert.equal(kivi.parse_amount('1\'010.98'), 1010.98, '1\'010.98');
|
|
100 |
|
|
101 |
assert.equal(kivi.parse_amount('10.987654321'), 10.987654321, '10.987654321');
|
|
102 |
assert.equal(kivi.parse_amount('1010.987654321'), 1010.987654321, '1010.987654321');
|
|
103 |
assert.equal(kivi.parse_amount('1\'010.987654321'), 1010.987654321, '1\'010.987654321');
|
|
104 |
});
|
|
105 |
|
|
106 |
QUnit.test("kivi.parse_amount function numbers with leading 0 should still be parsed as decimal and not octal", function( assert ) {
|
|
107 |
kivi.setup_formats({ numbers: '1000,00' });
|
|
108 |
|
|
109 |
assert.equal(kivi.parse_amount('0123456789'), 123456789, '0123456789');
|
|
110 |
assert.equal(kivi.parse_amount('000123456789'), 123456789, '000123456789');
|
|
111 |
});
|
js parse_/format_amount: Tests für Swiss-Zahlenformat & für Nicht-Oktal-Parsen