1 QUnit.test("kivi.parse_amount function German number style with thousand separator", function( assert ) {
2 kivi.setup_formats({ numbers: '1.000,00' });
4 assert.equal(kivi.parse_amount('10,00'), 10, '10,00');
5 assert.equal(kivi.parse_amount('10,'), 10, '10,');
6 assert.equal(kivi.parse_amount('1010,00'), 1010, '1010,00');
7 assert.equal(kivi.parse_amount('1010,'), 1010, '1010,');
8 assert.equal(kivi.parse_amount('1.010,00'), 1010, '1.010,00');
9 assert.equal(kivi.parse_amount('1.010,'), 1010, '1.010,');
10 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');
11 assert.equal(kivi.parse_amount('9.080.070.060.050.040.030.020.010,'), 9080070060050040030020010, '9.080.070.060.050.040.030.020.010,');
13 assert.equal(kivi.parse_amount('10,98'), 10.98, '10,98');
14 assert.equal(kivi.parse_amount('1010,98'), 1010.98, '1010,98');
15 assert.equal(kivi.parse_amount('1.010,98'), 1010.98, '1.010,98');
17 assert.equal(kivi.parse_amount('10,987654321'), 10.987654321, '10,987654321');
18 assert.equal(kivi.parse_amount('1010,987654321'), 1010.987654321, '1010,987654321');
19 assert.equal(kivi.parse_amount('1.010,987654321'), 1010.987654321, '1.010,987654321');
22 QUnit.test("kivi.parse_amount function German number style without thousand separator", function( assert ) {
23 kivi.setup_formats({ numbers: '1000,00' });
25 assert.equal(kivi.parse_amount('10,00'), 10, '10,00');
26 assert.equal(kivi.parse_amount('10,'), 10, '10,');
27 assert.equal(kivi.parse_amount('1010,00'), 1010, '1010,00');
28 assert.equal(kivi.parse_amount('1010,'), 1010, '1010,');
29 assert.equal(kivi.parse_amount('1.010,00'), 1010, '1.010,00');
30 assert.equal(kivi.parse_amount('1.010,'), 1010, '1.010,');
31 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');
32 assert.equal(kivi.parse_amount('9.080.070.060.050.040.030.020.010,'), 9080070060050040030020010, '9.080.070.060.050.040.030.020.010,');
34 assert.equal(kivi.parse_amount('10,98'), 10.98, '10,98');
35 assert.equal(kivi.parse_amount('1010,98'), 1010.98, '1010,98');
36 assert.equal(kivi.parse_amount('1.010,98'), 1010.98, '1.010,98');
38 assert.equal(kivi.parse_amount('10,987654321'), 10.987654321, '10,987654321');
39 assert.equal(kivi.parse_amount('1010,987654321'), 1010.987654321, '1010,987654321');
40 assert.equal(kivi.parse_amount('1.010,987654321'), 1010.987654321, '1.010,987654321');
43 QUnit.test("kivi.parse_amount function English number style with thousand separator", function( assert ) {
44 kivi.setup_formats({ numbers: '1,000.00' });
46 assert.equal(kivi.parse_amount('10.00'), 10, '10.00');
47 assert.equal(kivi.parse_amount('10.'), 10, '10.');
48 assert.equal(kivi.parse_amount('1010.00'), 1010, '1010.00');
49 assert.equal(kivi.parse_amount('1010.'), 1010, '1010.');
50 assert.equal(kivi.parse_amount('1,010.00'), 1010, '1,010.00');
51 assert.equal(kivi.parse_amount('1,010.'), 1010, '1,010.');
52 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');
53 assert.equal(kivi.parse_amount('9,080,070,060,050,040,030,020,010.'), 9080070060050040030020010, '9,080,070,060,050,040,030,020,010.');
55 assert.equal(kivi.parse_amount('10.98'), 10.98, '10.98');
56 assert.equal(kivi.parse_amount('1010.98'), 1010.98, '1010.98');
57 assert.equal(kivi.parse_amount('1,010.98'), 1010.98, '1,010.98');
59 assert.equal(kivi.parse_amount('10.987654321'), 10.987654321, '10.987654321');
60 assert.equal(kivi.parse_amount('1010.987654321'), 1010.987654321, '1010.987654321');
61 assert.equal(kivi.parse_amount('1,010.987654321'), 1010.987654321, '1,010.987654321');
64 QUnit.test("kivi.parse_amount function English number style without thousand separator", function( assert ) {
65 kivi.setup_formats({ numbers: '1000.00' });
67 assert.equal(kivi.parse_amount('10.00'), 10, '10.00');
68 assert.equal(kivi.parse_amount('10.'), 10, '10.');
69 assert.equal(kivi.parse_amount('1010.00'), 1010, '1010.00');
70 assert.equal(kivi.parse_amount('1010.'), 1010, '1010.');
71 assert.equal(kivi.parse_amount('1,010.00'), 1010, '1,010.00');
72 assert.equal(kivi.parse_amount('1,010.'), 1010, '1,010.');
73 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');
74 assert.equal(kivi.parse_amount('9,080,070,060,050,040,030,020,010.'), 9080070060050040030020010, '9,080,070,060,050,040,030,020,010.');
76 assert.equal(kivi.parse_amount('10.98'), 10.98, '10.98');
77 assert.equal(kivi.parse_amount('1010.98'), 1010.98, '1010.98');
78 assert.equal(kivi.parse_amount('1,010.98'), 1010.98, '1,010.98');
80 assert.equal(kivi.parse_amount('10.987654321'), 10.987654321, '10.987654321');
81 assert.equal(kivi.parse_amount('1010.987654321'), 1010.987654321, '1010.987654321');
82 assert.equal(kivi.parse_amount('1,010.987654321'), 1010.987654321, '1,010.987654321');