]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Avoid time related deprecation warnings in tests (#6246)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Mon, 6 May 2019 20:46:22 +0000 (23:46 +0300)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Mon, 6 May 2019 20:46:22 +0000 (22:46 +0200)
17 files changed:
src/scales/scale.time.js
test/fixtures/controller.bar/bar-thickness-absolute.json
test/fixtures/controller.bar/bar-thickness-flex-offset.json
test/fixtures/controller.bar/bar-thickness-flex-single-reverse.json
test/fixtures/controller.bar/bar-thickness-flex-single.json
test/fixtures/controller.bar/bar-thickness-flex.json
test/fixtures/controller.bar/bar-thickness-max.json
test/fixtures/controller.bar/bar-thickness-min-interval.json
test/fixtures/controller.bar/bar-thickness-multiple.json
test/fixtures/controller.bar/bar-thickness-no-overlap.json
test/fixtures/controller.bar/bar-thickness-offset.json
test/fixtures/controller.bar/bar-thickness-reverse.json
test/fixtures/controller.bar/bar-thickness-single-xy.json
test/fixtures/controller.bar/bar-thickness-single.json
test/fixtures/controller.bar/bar-thickness-stacked.json
test/specs/core.controller.tests.js
test/specs/scale.time.tests.js

index dd202c70f20aace5d9a34200063353893f16efd2..237769f5b17ae378f3920d8b16685ba85245ca06 100644 (file)
@@ -449,7 +449,6 @@ var defaultConfig = {
        adapters: {},
        time: {
                parser: false, // false == a pattern string from https://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment
-               format: false, // DEPRECATED false == date objects, moment object, callback or a pattern string from https://momentjs.com/docs/#/parsing/string-format/
                unit: false, // false == automatic or override with week, month, year, etc.
                round: false, // none, or override with week, month, year, etc.
                displayFormat: false, // DEPRECATED
index 599b090d6d1c293a3ea9d1a973862e2673008c31..58b6e1132444dcc9aed42bb4baa094f9555e6f6e 100644 (file)
@@ -20,6 +20,9 @@
                     "barPercentage": 1,
                     "categoryPercentage": 1,
                     "barThickness": 128,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 1776b07be167355883fe23b1531555c5684e7501..6b0829dd5613f06fe1948fc53a9de379af593dc9 100644 (file)
@@ -20,6 +20,9 @@
                     "barPercentage": 1,
                     "categoryPercentage": 1,
                     "barThickness": "flex",
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index a220e537fc1ef627b3cd40b8ef6ae042af7a8249..6f63ca93468370335110a67d0072e5062103115f 100644 (file)
@@ -19,6 +19,9 @@
                     "barThickness": "flex",
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels",
                         "reverse": true
index 4ae6973dba66abfd896e1b5472790b4147bfa1d7..f523f4f5fc6113d94d2c2d105d7c7ba2e179fb63 100644 (file)
@@ -19,6 +19,9 @@
                     "barThickness": "flex",
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 0bef9db18283c12f35abf9a893f92ebe796dd75d..c800a0af0673925943d04f192689349735a0e95e 100644 (file)
@@ -19,6 +19,9 @@
                     "barPercentage": 1,
                     "categoryPercentage": 1,
                     "barThickness": "flex",
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 3add5550b72192eadb739915bf3dd41eacd362ae..3430b8c93900f1c5a9c643030760866b202a12ad 100644 (file)
@@ -19,6 +19,9 @@
                     "barPercentage": 1,
                     "categoryPercentage": 1,
                     "maxBarThickness": 8,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index e5861685cd42053683d24b22aa51ff64f1cdacf8..41fd8676a450c425be7f53b02a96d36259fd4117 100644 (file)
@@ -18,6 +18,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index fc39849ae86684bf80d421f022dfda2517fa83ba..3dcddaff0e7c8afb429c12f92b040e182e9af9e8 100644 (file)
@@ -24,6 +24,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 3e9f1f5f5dec93ed7208b2f91b604240bb2103bd..9b06e512718e4b014b58c8f8432a440a8777b1dc 100644 (file)
@@ -24,6 +24,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY-MM"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index b31eb739d2bae1a94c4f08483f3d21269abe6829..78ff4e2dd9c83e92fc93f20878bbdc2de337ed77 100644 (file)
@@ -25,6 +25,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 72b335023be06b919acf89bd22fb52088e58bd58..5e868370f75ebe51b51fd417390c4ed5f0105968 100644 (file)
@@ -24,6 +24,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels",
                         "reverse": true
index 76caa37fa1acc168dc3c6d082c02963e22757c27..20446e80887f1666b0365ec5da4211664165b2f1 100644 (file)
@@ -18,6 +18,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 322af754713994b4816afac8d4309034787500da..59e5fcb9a908ec0d561e190f80d8a8a38c61efd1 100644 (file)
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
-                    "ticks": {
-                        "source": "labels"
-                    },
                     "time": {
+                        "parser": "YYYY"
+                    },
+                    "ticks": {
+                        "source": "labels",
                         "min": "2013"
                     }
                 }],
index aa2d825533f60039ab6a1d0001f4cc128dbe3e01..effb2f4fb713aa61e48a21db0fb5812f3180f372 100644 (file)
@@ -25,6 +25,9 @@
                     "display": false,
                     "barPercentage": 1,
                     "categoryPercentage": 1,
+                    "time": {
+                        "parser": "YYYY"
+                    },
                     "ticks": {
                         "source": "labels"
                     }
index 14be7c0b1c64675578ee79be5b7d2a99d578cfb3..946e9fabec5ce86b7462a838d8d477f53e66426f 100644 (file)
@@ -1170,7 +1170,7 @@ describe('Chart', function() {
                                        responsive: true,
                                        scales: {
                                                xAxes: [{
-                                                       type: 'time'
+                                                       type: 'category'
                                                }],
                                                yAxes: [{
                                                        scaleLabel: {
index 77b3cbf2b66379150ea9420b991d2d3270ff5955..4a534385004a36247fbea680b94fe5fbac546d87 100755 (executable)
@@ -97,7 +97,6 @@ describe('Time scale tests', function() {
                        },
                        time: {
                                parser: false,
-                               format: false,
                                unit: false,
                                round: false,
                                isoWeekday: false,
@@ -433,28 +432,28 @@ describe('Time scale tests', function() {
                });
 
                it('should use the min option when less than first label for building ticks', function() {
-                       config.time.min = '2014-12-29T04:00:00';
+                       config.ticks.min = '2014-12-29T04:00:00';
 
                        var scale = createScale(mockData, config);
                        expect(scale.ticks[0]).toEqual('Jan 1');
                });
 
                it('should use the min option when greater than first label for building ticks', function() {
-                       config.time.min = '2015-01-02T04:00:00';
+                       config.ticks.min = '2015-01-02T04:00:00';
 
                        var scale = createScale(mockData, config);
                        expect(scale.ticks[0]).toEqual('Jan 2');
                });
 
                it('should use the max option when greater than last label for building ticks', function() {
-                       config.time.max = '2015-01-05T06:00:00';
+                       config.ticks.max = '2015-01-05T06:00:00';
 
                        var scale = createScale(mockData, config);
                        expect(scale.ticks[scale.ticks.length - 1]).toEqual('Jan 3');
                });
 
                it('should use the max option when less than last label for building ticks', function() {
-                       config.time.max = '2015-01-02T23:00:00';
+                       config.ticks.max = '2015-01-02T23:00:00';
 
                        var scale = createScale(mockData, config);
                        expect(scale.ticks[scale.ticks.length - 1]).toEqual('Jan 2');
@@ -853,7 +852,7 @@ describe('Time scale tests', function() {
                                scales: {
                                        xAxes: [{
                                                type: 'time',
-                                               time: {
+                                               ticks: {
                                                        min: moment().subtract(1, 'months'),
                                                        max: moment(),
                                                }
@@ -910,8 +909,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
-                               options.time.max = '2051';
+                               options.ticks.min = '2012';
+                               options.ticks.max = '2051';
                                chart.update();
 
                                expect(scale.min).toEqual(+moment('2012', 'YYYY'));
@@ -924,8 +923,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2017';
-                               options.time.max = '2042';
+                               options.ticks.min = '2017';
+                               options.ticks.max = '2042';
                                chart.update();
 
                                expect(scale.min).toEqual(+moment('2017', 'YYYY'));
@@ -1004,8 +1003,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
-                               options.time.max = '2051';
+                               options.ticks.min = '2012';
+                               options.ticks.max = '2051';
                                chart.update();
 
                                expect(scale.min).toEqual(+moment('2012', 'YYYY'));
@@ -1018,8 +1017,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2017';
-                               options.time.max = '2043';
+                               options.ticks.min = '2017';
+                               options.ticks.max = '2043';
                                chart.update();
 
                                expect(scale.min).toEqual(+moment('2017', 'YYYY'));
@@ -1103,7 +1102,7 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
+                               options.ticks.min = '2012';
                                chart.update();
 
                                var start = scale.left;
@@ -1117,7 +1116,7 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.max = '2050';
+                               options.ticks.max = '2050';
                                chart.update();
 
                                var start = scale.left;
@@ -1131,8 +1130,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
-                               options.time.max = '2050';
+                               options.ticks.min = '2012';
+                               options.ticks.max = '2050';
                                chart.update();
 
                                var start = scale.left;
@@ -1187,8 +1186,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
-                               options.time.max = '2050';
+                               options.ticks.min = '2012';
+                               options.ticks.max = '2050';
                                chart.update();
 
                                var start = scale.left;
@@ -1280,7 +1279,7 @@ describe('Time scale tests', function() {
                });
        });
 
-       describe('when time.min and/or time.max are defined', function() {
+       describe('when ticks.min and/or ticks.max are defined', function() {
                ['auto', 'data', 'labels'].forEach(function(source) {
                        ['data', 'ticks'].forEach(function(bounds) {
                                describe('and ticks.source is "' + source + '" and bounds "' + bounds + '"', function() {
@@ -1320,8 +1319,8 @@ describe('Time scale tests', function() {
                                                var min = '02/19 07:00';
                                                var max = '02/24 08:00';
 
-                                               options.time.min = min;
-                                               options.time.max = max;
+                                               options.ticks.min = min;
+                                               options.ticks.max = max;
                                                chart.update();
 
                                                expect(scale.min).toEqual(+moment(min, 'MM/DD HH:mm'));
@@ -1340,8 +1339,8 @@ describe('Time scale tests', function() {
                                                var min = '02/21 07:00';
                                                var max = '02/22 20:00';
 
-                                               options.time.min = min;
-                                               options.time.max = max;
+                                               options.ticks.min = min;
+                                               options.ticks.max = max;
                                                chart.update();
 
                                                expect(scale.min).toEqual(+moment(min, 'MM/DD HH:mm'));
@@ -1414,8 +1413,8 @@ describe('Time scale tests', function() {
                                        var scale = chart.scales.x;
                                        var options = chart.options.scales.xAxes[0];
 
-                                       options.time.min = '2012';
-                                       options.time.max = '2051';
+                                       options.ticks.min = '2012';
+                                       options.ticks.max = '2051';
                                        chart.update();
 
                                        expect(scale.getPixelForValue('2012')).toBeCloseToPixel(scale.left);
@@ -1427,8 +1426,8 @@ describe('Time scale tests', function() {
                                        var scale = chart.scales.x;
                                        var options = chart.options.scales.xAxes[0];
 
-                                       options.time.min = '2012';
-                                       options.time.max = '2051';
+                                       options.ticks.min = '2012';
+                                       options.ticks.max = '2051';
                                        options.offset = true;
                                        chart.update();
 
@@ -1541,7 +1540,7 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
+                               options.ticks.min = '2012';
                                chart.update();
 
                                var start = scale.left;
@@ -1556,7 +1555,7 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.max = '2050';
+                               options.ticks.max = '2050';
                                chart.update();
 
                                var start = scale.left;
@@ -1571,8 +1570,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
-                               options.time.max = '2050';
+                               options.ticks.min = '2012';
+                               options.ticks.max = '2050';
                                chart.update();
 
                                var start = scale.left;
@@ -1629,8 +1628,8 @@ describe('Time scale tests', function() {
                                var scale = chart.scales.x;
                                var options = chart.options.scales.xAxes[0];
 
-                               options.time.min = '2012';
-                               options.time.max = '2050';
+                               options.ticks.min = '2012';
+                               options.ticks.max = '2050';
                                chart.update();
 
                                var start = scale.left;