1 QUnit.test("kivi.setup_formats date format initialization", function( assert ) {
2 kivi.setup_formats({ dates: "dd.mm.yy" });
3 assert.deepEqual(kivi._date_format, { sep: '.', d: 0, m: 1, y: 2 } , "German date style with dots");
5 kivi.setup_formats({ dates: "dd/mm/yy" });
6 assert.deepEqual(kivi._date_format, { sep: '/', d: 0, m: 1, y: 2 } , "German date style with slashes");
8 kivi.setup_formats({ dates: "mm/dd/yy" });
9 assert.deepEqual(kivi._date_format, { sep: '/', d: 1, m: 0, y: 2 } , "American date style");
11 kivi.setup_formats({ dates: "yyyy-mm-dd" });
12 assert.deepEqual(kivi._date_format, { sep: '-', d: 2, m: 1, y: 0 } , "ISO date style");
14 kivi.setup_formats({ dates: "dd.mm.yy" });
15 kivi.setup_formats({ dates: "Totally invalid!" });
16 assert.deepEqual(kivi._date_format, { sep: '.', d: 0, m: 1, y: 2 } , "Invalid date style should not change previously-set style");
19 QUnit.test("kivi.setup_formats number format initialization", function( assert ) {
20 kivi.setup_formats({ numbers: "1.000,00" });
21 assert.deepEqual(kivi._number_format, { decimalSep: ',', thousandSep: '.' } , "German number style with thousands separator");
23 kivi.setup_formats({ numbers: "1000,00" });
24 assert.deepEqual(kivi._number_format, { decimalSep: ',', thousandSep: '' } , "German number style without thousands separator");
26 kivi.setup_formats({ numbers: "1,000.00" });
27 assert.deepEqual(kivi._number_format, { decimalSep: '.', thousandSep: ',' } , "English number style with thousands separator");
29 kivi.setup_formats({ numbers: "1000.00" });
30 assert.deepEqual(kivi._number_format, { decimalSep: '.', thousandSep: '' } , "English number style without thousands separator");
32 kivi.setup_formats({ numbers: "1.000,00" });
33 kivi.setup_formats({ numbers: "Totally invalid!" });
34 assert.deepEqual(kivi._number_format, { decimalSep: ',', thousandSep: '.' } , "Invalid number style should not change previously-set style");