]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Convert some of the time scale tests to fixtures (#7154)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Fri, 28 Feb 2020 23:56:22 +0000 (01:56 +0200)
committerGitHub <noreply@github.com>
Fri, 28 Feb 2020 23:56:22 +0000 (18:56 -0500)
* Convert some of time scale tick tests to fixtures
* A little more threshold

59 files changed:
test/fixtures/scale.time/autoskip-major.js [new file with mode: 0644]
test/fixtures/scale.time/autoskip-major.png [new file with mode: 0644]
test/fixtures/scale.time/custom-parser.js [new file with mode: 0644]
test/fixtures/scale.time/custom-parser.png [new file with mode: 0644]
test/fixtures/scale.time/data-ty.js [new file with mode: 0644]
test/fixtures/scale.time/data-ty.png [new file with mode: 0644]
test/fixtures/scale.time/data-xy.js [new file with mode: 0644]
test/fixtures/scale.time/data-xy.png [new file with mode: 0644]
test/fixtures/scale.time/labels-date.js [new file with mode: 0644]
test/fixtures/scale.time/labels-date.png [new file with mode: 0644]
test/fixtures/scale.time/labels-strings.js [new file with mode: 0644]
test/fixtures/scale.time/labels-strings.png [new file with mode: 0644]
test/fixtures/scale.time/labels.js [new file with mode: 0644]
test/fixtures/scale.time/labels.png [new file with mode: 0644]
test/fixtures/scale.time/source-auto-linear.js [new file with mode: 0644]
test/fixtures/scale.time/source-auto-linear.png [new file with mode: 0644]
test/fixtures/scale.time/source-auto-series.js [new file with mode: 0644]
test/fixtures/scale.time/source-auto-series.png [new file with mode: 0644]
test/fixtures/scale.time/source-data-linear.js [new file with mode: 0644]
test/fixtures/scale.time/source-data-linear.png [new file with mode: 0644]
test/fixtures/scale.time/source-data-series-offset-min-max.js [new file with mode: 0644]
test/fixtures/scale.time/source-data-series-offset-min-max.png [new file with mode: 0644]
test/fixtures/scale.time/source-data-series.js [new file with mode: 0644]
test/fixtures/scale.time/source-data-series.png [new file with mode: 0644]
test/fixtures/scale.time/source-labels-linear-offset-min-max.js [new file with mode: 0644]
test/fixtures/scale.time/source-labels-linear-offset-min-max.png [new file with mode: 0644]
test/fixtures/scale.time/source-labels-linear.js [new file with mode: 0644]
test/fixtures/scale.time/source-labels-linear.png [new file with mode: 0644]
test/fixtures/scale.time/source-labels-series-offset-min-max.js [new file with mode: 0644]
test/fixtures/scale.time/source-labels-series-offset-min-max.png [new file with mode: 0644]
test/fixtures/scale.time/source-labels-series.js [new file with mode: 0644]
test/fixtures/scale.time/source-labels-series.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-capacity.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-capacity.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-minunit.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-minunit.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-linear-min-max.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-linear-min-max.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-linear.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-linear.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-offset.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-offset.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series-max.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series-max.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series-min-max.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series-min-max.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series-min.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series-min.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse-series.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-reverse.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-round.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-round.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-stepsize.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-stepsize.png [new file with mode: 0644]
test/fixtures/scale.time/ticks-unit.js [new file with mode: 0644]
test/fixtures/scale.time/ticks-unit.png [new file with mode: 0644]
test/specs/scale.time.tests.js

diff --git a/test/fixtures/scale.time/autoskip-major.js b/test/fixtures/scale.time/autoskip-major.js
new file mode 100644 (file)
index 0000000..b72e22e
--- /dev/null
@@ -0,0 +1,41 @@
+var date = moment('Jan 01 1990', 'MMM DD YYYY');
+var data = [];
+for (var i = 0; i < 60; i++) {
+       data.push({x: date.valueOf(), y: i});
+       date = date.clone().add(1, 'month');
+}
+
+module.exports = {
+       threshold: 0.05,
+       config: {
+               type: 'line',
+               data: {
+                       datasets: [{
+                               xAxisID: 'x',
+                               data: data,
+                               fill: false
+                       }],
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       ticks: {
+                                               major: {
+                                                       enabled: true
+                                               },
+                                               source: 'data',
+                                               autoSkip: true
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/autoskip-major.png b/test/fixtures/scale.time/autoskip-major.png
new file mode 100644 (file)
index 0000000..09d03b8
Binary files /dev/null and b/test/fixtures/scale.time/autoskip-major.png differ
diff --git a/test/fixtures/scale.time/custom-parser.js b/test/fixtures/scale.time/custom-parser.js
new file mode 100644 (file)
index 0000000..d3b516f
--- /dev/null
@@ -0,0 +1,41 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['foo', 'bar'],
+                       datasets: [{
+                               data: [0, 1],
+                               fill: false
+                       }],
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       position: 'bottom',
+                                       time: {
+                                               unit: 'day',
+                                               round: true,
+                                               parser: function(label) {
+                                                       return label === 'foo' ?
+                                                               moment('2000/01/02', 'YYYY/MM/DD') :
+                                                               moment('2016/05/08', 'YYYY/MM/DD');
+                                               }
+                                       },
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 256, height: 128}
+       }
+};
diff --git a/test/fixtures/scale.time/custom-parser.png b/test/fixtures/scale.time/custom-parser.png
new file mode 100644 (file)
index 0000000..9f873af
Binary files /dev/null and b/test/fixtures/scale.time/custom-parser.png differ
diff --git a/test/fixtures/scale.time/data-ty.js b/test/fixtures/scale.time/data-ty.js
new file mode 100644 (file)
index 0000000..a2ded6e
--- /dev/null
@@ -0,0 +1,53 @@
+function newDateFromRef(days) {
+       return moment('01/01/2015 12:00', 'DD/MM/YYYY HH:mm').add(days, 'd').toDate();
+}
+
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       datasets: [{
+                               data: [{
+                                       t: newDateFromRef(0),
+                                       y: 1
+                               }, {
+                                       t: newDateFromRef(1),
+                                       y: 10
+                               }, {
+                                       t: newDateFromRef(2),
+                                       y: 0
+                               }, {
+                                       t: newDateFromRef(4),
+                                       y: 5
+                               }, {
+                                       t: newDateFromRef(6),
+                                       y: 77
+                               }, {
+                                       t: newDateFromRef(7),
+                                       y: 9
+                               }, {
+                                       t: newDateFromRef(9),
+                                       y: 5
+                               }],
+                               fill: false
+                       }],
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       position: 'bottom'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 800, height: 200}
+       }
+};
diff --git a/test/fixtures/scale.time/data-ty.png b/test/fixtures/scale.time/data-ty.png
new file mode 100644 (file)
index 0000000..8b37e76
Binary files /dev/null and b/test/fixtures/scale.time/data-ty.png differ
diff --git a/test/fixtures/scale.time/data-xy.js b/test/fixtures/scale.time/data-xy.js
new file mode 100644 (file)
index 0000000..7dd448e
--- /dev/null
@@ -0,0 +1,53 @@
+function newDateFromRef(days) {
+       return moment('01/01/2015 12:00', 'DD/MM/YYYY HH:mm').add(days, 'd').toDate();
+}
+
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       datasets: [{
+                               data: [{
+                                       x: newDateFromRef(0),
+                                       y: 1
+                               }, {
+                                       x: newDateFromRef(1),
+                                       y: 10
+                               }, {
+                                       x: newDateFromRef(2),
+                                       y: 0
+                               }, {
+                                       x: newDateFromRef(4),
+                                       y: 5
+                               }, {
+                                       x: newDateFromRef(6),
+                                       y: 77
+                               }, {
+                                       x: newDateFromRef(7),
+                                       y: 9
+                               }, {
+                                       x: newDateFromRef(9),
+                                       y: 5
+                               }],
+                               fill: false
+                       }],
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       position: 'bottom'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 800, height: 200}
+       }
+};
diff --git a/test/fixtures/scale.time/data-xy.png b/test/fixtures/scale.time/data-xy.png
new file mode 100644 (file)
index 0000000..8b37e76
Binary files /dev/null and b/test/fixtures/scale.time/data-xy.png differ
diff --git a/test/fixtures/scale.time/labels-date.js b/test/fixtures/scale.time/labels-date.js
new file mode 100644 (file)
index 0000000..d7cdd5e
--- /dev/null
@@ -0,0 +1,29 @@
+function newDateFromRef(days) {
+       return moment('01/01/2015 12:00', 'DD/MM/YYYY HH:mm').add(days, 'd').toDate();
+}
+
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: [newDateFromRef(0), newDateFromRef(1), newDateFromRef(2), newDateFromRef(4), newDateFromRef(6), newDateFromRef(7), newDateFromRef(9)],
+                       fill: false
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 1000, height: 200}
+       }
+};
diff --git a/test/fixtures/scale.time/labels-date.png b/test/fixtures/scale.time/labels-date.png
new file mode 100644 (file)
index 0000000..567239a
Binary files /dev/null and b/test/fixtures/scale.time/labels-date.png differ
diff --git a/test/fixtures/scale.time/labels-strings.js b/test/fixtures/scale.time/labels-strings.js
new file mode 100644 (file)
index 0000000..0e7eb1e
--- /dev/null
@@ -0,0 +1,24 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2015-01-01T12:00:00', '2015-01-02T21:00:00', '2015-01-03T22:00:00', '2015-01-05T23:00:00', '2015-01-07T03:00', '2015-01-08T10:00', '2015-01-10T12:00']
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 1000, height: 200}
+       }
+};
diff --git a/test/fixtures/scale.time/labels-strings.png b/test/fixtures/scale.time/labels-strings.png
new file mode 100644 (file)
index 0000000..567239a
Binary files /dev/null and b/test/fixtures/scale.time/labels-strings.png differ
diff --git a/test/fixtures/scale.time/labels.js b/test/fixtures/scale.time/labels.js
new file mode 100644 (file)
index 0000000..78f300c
--- /dev/null
@@ -0,0 +1,47 @@
+var timeOpts = {
+       parser: 'YYYY',
+       unit: 'year',
+       displayFormats: {
+               year: 'YYYY'
+       }
+};
+
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['1975', '1976', '1977'],
+                       xLabels: ['1985', '1986', '1987'],
+                       yLabels: ['1995', '1996', '1997']
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       labels: ['2015', '2016', '2017'],
+                                       time: timeOpts
+                               },
+                               x2: {
+                                       type: 'time',
+                                       position: 'bottom',
+                                       time: timeOpts
+                               },
+                               y: {
+                                       type: 'time',
+                                       time: timeOpts
+                               },
+                               y2: {
+                                       position: 'left',
+                                       type: 'time',
+                                       labels: ['2005', '2006', '2007'],
+                                       time: timeOpts
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/labels.png b/test/fixtures/scale.time/labels.png
new file mode 100644 (file)
index 0000000..77f2677
Binary files /dev/null and b/test/fixtures/scale.time/labels.png differ
diff --git a/test/fixtures/scale.time/source-auto-linear.js b/test/fixtures/scale.time/source-auto-linear.js
new file mode 100644 (file)
index 0000000..5ef7209
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2025'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'auto'
+                                       },
+                                       distribution: 'linear'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-auto-linear.png b/test/fixtures/scale.time/source-auto-linear.png
new file mode 100644 (file)
index 0000000..24dae2c
Binary files /dev/null and b/test/fixtures/scale.time/source-auto-linear.png differ
diff --git a/test/fixtures/scale.time/source-auto-series.js b/test/fixtures/scale.time/source-auto-series.js
new file mode 100644 (file)
index 0000000..7962581
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2025'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'auto'
+                                       },
+                                       distribution: 'series'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-auto-series.png b/test/fixtures/scale.time/source-auto-series.png
new file mode 100644 (file)
index 0000000..9798547
Binary files /dev/null and b/test/fixtures/scale.time/source-auto-series.png differ
diff --git a/test/fixtures/scale.time/source-data-linear.js b/test/fixtures/scale.time/source-data-linear.js
new file mode 100644 (file)
index 0000000..a8492cf
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2025'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'data'
+                                       },
+                                       distribution: 'linear'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-data-linear.png b/test/fixtures/scale.time/source-data-linear.png
new file mode 100644 (file)
index 0000000..9b2c94a
Binary files /dev/null and b/test/fixtures/scale.time/source-data-linear.png differ
diff --git a/test/fixtures/scale.time/source-data-series-offset-min-max.js b/test/fixtures/scale.time/source-data-series-offset-min-max.js
new file mode 100644 (file)
index 0000000..e651864
--- /dev/null
@@ -0,0 +1,34 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       min: '2012',
+                                       max: '2051',
+                                       offset: true,
+                                       time: {
+                                               parser: 'YYYY',
+                                       },
+                                       ticks: {
+                                               source: 'data'
+                                       },
+                                       distribution: 'series'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-data-series-offset-min-max.png b/test/fixtures/scale.time/source-data-series-offset-min-max.png
new file mode 100644 (file)
index 0000000..9a9f8b4
Binary files /dev/null and b/test/fixtures/scale.time/source-data-series-offset-min-max.png differ
diff --git a/test/fixtures/scale.time/source-data-series.js b/test/fixtures/scale.time/source-data-series.js
new file mode 100644 (file)
index 0000000..15f74a1
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2025'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'data'
+                                       },
+                                       distribution: 'series'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-data-series.png b/test/fixtures/scale.time/source-data-series.png
new file mode 100644 (file)
index 0000000..05163aa
Binary files /dev/null and b/test/fixtures/scale.time/source-data-series.png differ
diff --git a/test/fixtures/scale.time/source-labels-linear-offset-min-max.js b/test/fixtures/scale.time/source-labels-linear-offset-min-max.js
new file mode 100644 (file)
index 0000000..96be59c
--- /dev/null
@@ -0,0 +1,34 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       min: '2012',
+                                       max: '2051',
+                                       offset: true,
+                                       time: {
+                                               parser: 'YYYY',
+                                       },
+                                       ticks: {
+                                               source: 'labels'
+                                       },
+                                       distribution: 'linear'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-labels-linear-offset-min-max.png b/test/fixtures/scale.time/source-labels-linear-offset-min-max.png
new file mode 100644 (file)
index 0000000..4127fbf
Binary files /dev/null and b/test/fixtures/scale.time/source-labels-linear-offset-min-max.png differ
diff --git a/test/fixtures/scale.time/source-labels-linear.js b/test/fixtures/scale.time/source-labels-linear.js
new file mode 100644 (file)
index 0000000..635e4fa
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2025'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'labels'
+                                       },
+                                       distribution: 'linear'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-labels-linear.png b/test/fixtures/scale.time/source-labels-linear.png
new file mode 100644 (file)
index 0000000..9b2c94a
Binary files /dev/null and b/test/fixtures/scale.time/source-labels-linear.png differ
diff --git a/test/fixtures/scale.time/source-labels-series-offset-min-max.js b/test/fixtures/scale.time/source-labels-series-offset-min-max.js
new file mode 100644 (file)
index 0000000..612fd53
--- /dev/null
@@ -0,0 +1,34 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       min: '2012',
+                                       max: '2051',
+                                       offset: true,
+                                       time: {
+                                               parser: 'YYYY',
+                                       },
+                                       ticks: {
+                                               source: 'labels'
+                                       },
+                                       distribution: 'series'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-labels-series-offset-min-max.png b/test/fixtures/scale.time/source-labels-series-offset-min-max.png
new file mode 100644 (file)
index 0000000..9a9f8b4
Binary files /dev/null and b/test/fixtures/scale.time/source-labels-series-offset-min-max.png differ
diff --git a/test/fixtures/scale.time/source-labels-series.js b/test/fixtures/scale.time/source-labels-series.js
new file mode 100644 (file)
index 0000000..f5b22e2
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2025'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'labels'
+                                       },
+                                       distribution: 'series'
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/source-labels-series.png b/test/fixtures/scale.time/source-labels-series.png
new file mode 100644 (file)
index 0000000..05163aa
Binary files /dev/null and b/test/fixtures/scale.time/source-labels-series.png differ
diff --git a/test/fixtures/scale.time/ticks-capacity.js b/test/fixtures/scale.time/ticks-capacity.js
new file mode 100644 (file)
index 0000000..bc950bd
--- /dev/null
@@ -0,0 +1,29 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: [
+                               '2012-01-01', '2013-01-01', '2014-01-01', '2015-01-01',
+                               '2016-01-01', '2017-01-01', '2018-01-01', '2019-01-01'
+                       ]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               unit: 'year'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-capacity.png b/test/fixtures/scale.time/ticks-capacity.png
new file mode 100644 (file)
index 0000000..d4cba0d
Binary files /dev/null and b/test/fixtures/scale.time/ticks-capacity.png differ
diff --git a/test/fixtures/scale.time/ticks-minunit.js b/test/fixtures/scale.time/ticks-minunit.js
new file mode 100644 (file)
index 0000000..84bf001
--- /dev/null
@@ -0,0 +1,28 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2015-01-01T20:00:00', '2015-01-02T21:00:00'],
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       bounds: 'ticks',
+                                       time: {
+                                               minUnit: 'day'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 256, height: 128}
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-minunit.png b/test/fixtures/scale.time/ticks-minunit.png
new file mode 100644 (file)
index 0000000..a6add12
Binary files /dev/null and b/test/fixtures/scale.time/ticks-minunit.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-linear-min-max.js b/test/fixtures/scale.time/ticks-reverse-linear-min-max.js
new file mode 100644 (file)
index 0000000..054ac4f
--- /dev/null
@@ -0,0 +1,34 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       min: '2012',
+                                       max: '2050',
+                                       time: {
+                                               parser: 'YYYY'
+                                       },
+                                       distribution: 'linear',
+                                       reverse: true,
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-linear-min-max.png b/test/fixtures/scale.time/ticks-reverse-linear-min-max.png
new file mode 100644 (file)
index 0000000..e01a4e0
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-linear-min-max.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-linear.js b/test/fixtures/scale.time/ticks-reverse-linear.js
new file mode 100644 (file)
index 0000000..1b12265
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY'
+                                       },
+                                       distribution: 'linear',
+                                       reverse: true,
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-linear.png b/test/fixtures/scale.time/ticks-reverse-linear.png
new file mode 100644 (file)
index 0000000..ff2b517
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-linear.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-offset.js b/test/fixtures/scale.time/ticks-reverse-offset.js
new file mode 100644 (file)
index 0000000..6db92bf
--- /dev/null
@@ -0,0 +1,33 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2021'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       reverse: true,
+                                       offset: true,
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'labels',
+                                       },
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-offset.png b/test/fixtures/scale.time/ticks-reverse-offset.png
new file mode 100644 (file)
index 0000000..bfdbaf5
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-offset.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-series-max.js b/test/fixtures/scale.time/ticks-reverse-series-max.js
new file mode 100644 (file)
index 0000000..72840e0
--- /dev/null
@@ -0,0 +1,33 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       max: '2050',
+                                       time: {
+                                               parser: 'YYYY'
+                                       },
+                                       distribution: 'series',
+                                       reverse: true,
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-series-max.png b/test/fixtures/scale.time/ticks-reverse-series-max.png
new file mode 100644 (file)
index 0000000..589ef39
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-series-max.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-series-min-max.js b/test/fixtures/scale.time/ticks-reverse-series-min-max.js
new file mode 100644 (file)
index 0000000..4e67f72
--- /dev/null
@@ -0,0 +1,34 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       min: '2012',
+                                       max: '2050',
+                                       time: {
+                                               parser: 'YYYY'
+                                       },
+                                       distribution: 'series',
+                                       reverse: true,
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-series-min-max.png b/test/fixtures/scale.time/ticks-reverse-series-min-max.png
new file mode 100644 (file)
index 0000000..f7add03
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-series-min-max.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-series-min.js b/test/fixtures/scale.time/ticks-reverse-series-min.js
new file mode 100644 (file)
index 0000000..89ddb83
--- /dev/null
@@ -0,0 +1,33 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       min: '2012',
+                                       time: {
+                                               parser: 'YYYY'
+                                       },
+                                       distribution: 'series',
+                                       reverse: true,
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-series-min.png b/test/fixtures/scale.time/ticks-reverse-series-min.png
new file mode 100644 (file)
index 0000000..7a82b0f
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-series-min.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse-series.js b/test/fixtures/scale.time/ticks-reverse-series.js
new file mode 100644 (file)
index 0000000..ba2dd3e
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2019', '2020', '2025', '2042'],
+                       datasets: [{data: [0, 1, 2, 3, 4, 5], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               parser: 'YYYY'
+                                       },
+                                       distribution: 'series',
+                                       reverse: true,
+                                       ticks: {
+                                               source: 'labels'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse-series.png b/test/fixtures/scale.time/ticks-reverse-series.png
new file mode 100644 (file)
index 0000000..134b4e6
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse-series.png differ
diff --git a/test/fixtures/scale.time/ticks-reverse.js b/test/fixtures/scale.time/ticks-reverse.js
new file mode 100644 (file)
index 0000000..7358113
--- /dev/null
@@ -0,0 +1,32 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2017', '2018', '2019', '2020', '2021'],
+                       datasets: [{data: [0, 1, 2, 3, 4], fill: false}]
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       reverse: true,
+                                       time: {
+                                               parser: 'YYYY',
+                                               unit: 'year'
+                                       },
+                                       ticks: {
+                                               source: 'labels',
+                                       },
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-reverse.png b/test/fixtures/scale.time/ticks-reverse.png
new file mode 100644 (file)
index 0000000..eff4f5e
Binary files /dev/null and b/test/fixtures/scale.time/ticks-reverse.png differ
diff --git a/test/fixtures/scale.time/ticks-round.js b/test/fixtures/scale.time/ticks-round.js
new file mode 100644 (file)
index 0000000..7e313b9
--- /dev/null
@@ -0,0 +1,29 @@
+module.exports = {
+       threshold: 0.05,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2015-01-01T20:00:00', '2015-02-02T21:00:00', '2015-02-21T01:00:00']
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       bounds: 'ticks',
+                                       time: {
+                                               unit: 'week',
+                                               round: 'week'
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 512, height: 256}
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-round.png b/test/fixtures/scale.time/ticks-round.png
new file mode 100644 (file)
index 0000000..4047716
Binary files /dev/null and b/test/fixtures/scale.time/ticks-round.png differ
diff --git a/test/fixtures/scale.time/ticks-stepsize.js b/test/fixtures/scale.time/ticks-stepsize.js
new file mode 100644 (file)
index 0000000..3b62bb1
--- /dev/null
@@ -0,0 +1,29 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2015-01-01T20:00:00', '2015-01-01T21:00:00']
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       bounds: 'ticks',
+                                       time: {
+                                               unit: 'hour',
+                                               stepSize: 2
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 512, height: 128}
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-stepsize.png b/test/fixtures/scale.time/ticks-stepsize.png
new file mode 100644 (file)
index 0000000..ea51b06
Binary files /dev/null and b/test/fixtures/scale.time/ticks-stepsize.png differ
diff --git a/test/fixtures/scale.time/ticks-unit.js b/test/fixtures/scale.time/ticks-unit.js
new file mode 100644 (file)
index 0000000..fce6214
--- /dev/null
@@ -0,0 +1,27 @@
+module.exports = {
+       threshold: 0.01,
+       config: {
+               type: 'line',
+               data: {
+                       labels: ['2015-01-01T20:00:00', '2015-01-02T21:00:00'],
+               },
+               options: {
+                       scales: {
+                               x: {
+                                       type: 'time',
+                                       time: {
+                                               unit: 'hour',
+                                       }
+                               },
+                               y: {
+                                       display: false
+                               }
+                       },
+                       legend: false
+               }
+       },
+       options: {
+               spriteText: true,
+               canvas: {width: 1200, height: 200}
+       }
+};
diff --git a/test/fixtures/scale.time/ticks-unit.png b/test/fixtures/scale.time/ticks-unit.png
new file mode 100644 (file)
index 0000000..0485c2e
Binary files /dev/null and b/test/fixtures/scale.time/ticks-unit.png differ
index 7610ec14a5187bab29460867ffeb38d82cfa6d68..a41341f37d6da51705d781433cfde01ce0d7c1f2 100644 (file)
@@ -1,5 +1,7 @@
 // Time scale tests
 describe('Time scale tests', function() {
+       describe('auto', jasmine.fixture.specs('scale.time'));
+
        function createScale(data, options, dimensions) {
                var width = (dimensions && dimensions.width) || 400;
                var height = (dimensions && dimensions.height) || 50;
@@ -111,203 +113,6 @@ describe('Time scale tests', function() {
                expect(defaultConfig.ticks.callback).toEqual(jasmine.any(Function));
        });
 
-       describe('when given inputs of different types', function() {
-               // Helper to build date objects
-               function newDateFromRef(days) {
-                       return moment('01/01/2015 12:00', 'DD/MM/YYYY HH:mm').add(days, 'd').toDate();
-               }
-
-               it('should accept labels as strings', function() {
-                       var mockData = {
-                               labels: ['2015-01-01T12:00:00', '2015-01-02T21:00:00', '2015-01-03T22:00:00', '2015-01-05T23:00:00', '2015-01-07T03:00', '2015-01-08T10:00', '2015-01-10T12:00'], // days
-                       };
-
-                       var scaleOptions = Chart.scaleService.getScaleDefaults('time');
-                       var scale = createScale(mockData, scaleOptions, {width: 1000, height: 200});
-                       var ticks = getLabels(scale);
-
-                       // `bounds === 'data'`: first and last ticks removed since outside the data range
-                       expect(ticks.length).toEqual(44);
-               });
-
-               it('should accept labels as date objects', function() {
-                       var mockData = {
-                               labels: [newDateFromRef(0), newDateFromRef(1), newDateFromRef(2), newDateFromRef(4), newDateFromRef(6), newDateFromRef(7), newDateFromRef(9)], // days
-                       };
-                       var scale = createScale(mockData, Chart.scaleService.getScaleDefaults('time'), {width: 1000, height: 200});
-                       var ticks = getLabels(scale);
-
-                       // `bounds === 'data'`: first and last ticks removed since outside the data range
-                       expect(ticks.length).toEqual(44);
-               });
-
-               it('should accept data as xy points', function() {
-                       var chart = window.acquireChart({
-                               type: 'line',
-                               data: {
-                                       datasets: [{
-                                               xAxisID: 'x',
-                                               data: [{
-                                                       x: newDateFromRef(0),
-                                                       y: 1
-                                               }, {
-                                                       x: newDateFromRef(1),
-                                                       y: 10
-                                               }, {
-                                                       x: newDateFromRef(2),
-                                                       y: 0
-                                               }, {
-                                                       x: newDateFromRef(4),
-                                                       y: 5
-                                               }, {
-                                                       x: newDateFromRef(6),
-                                                       y: 77
-                                               }, {
-                                                       x: newDateFromRef(7),
-                                                       y: 9
-                                               }, {
-                                                       x: newDateFromRef(9),
-                                                       y: 5
-                                               }]
-                                       }],
-                               },
-                               options: {
-                                       scales: {
-                                               x: {
-                                                       type: 'time',
-                                                       position: 'bottom'
-                                               },
-                                       }
-                               }
-                       }, {canvas: {width: 800, height: 200}});
-
-                       var xScale = chart.scales.x;
-                       var ticks = getLabels(xScale);
-
-                       // `bounds === 'data'`: first and last ticks removed since outside the data range
-                       expect(ticks.length).toEqual(37);
-               });
-
-               it('should accept data as ty points', function() {
-                       var chart = window.acquireChart({
-                               type: 'line',
-                               data: {
-                                       datasets: [{
-                                               xAxisID: 'x',
-                                               data: [{
-                                                       t: newDateFromRef(0),
-                                                       y: 1
-                                               }, {
-                                                       t: newDateFromRef(1),
-                                                       y: 10
-                                               }, {
-                                                       t: newDateFromRef(2),
-                                                       y: 0
-                                               }, {
-                                                       t: newDateFromRef(4),
-                                                       y: 5
-                                               }, {
-                                                       t: newDateFromRef(6),
-                                                       y: 77
-                                               }, {
-                                                       t: newDateFromRef(7),
-                                                       y: 9
-                                               }, {
-                                                       t: newDateFromRef(9),
-                                                       y: 5
-                                               }]
-                                       }],
-                               },
-                               options: {
-                                       scales: {
-                                               x: {
-                                                       type: 'time',
-                                                       position: 'bottom'
-                                               },
-                                       }
-                               }
-                       }, {canvas: {width: 800, height: 200}});
-
-                       var tScale = chart.scales.x;
-                       var ticks = getLabels(tScale);
-
-                       // `bounds === 'data'`: first and last ticks removed since outside the data range
-                       expect(ticks.length).toEqual(37);
-               });
-       });
-
-       it('should allow custom time parsers', function() {
-               var chart = window.acquireChart({
-                       type: 'line',
-                       data: {
-                               labels: ['foo', 'bar'],
-                               datasets: [{
-                                       xAxisID: 'x',
-                                       data: [0, 1]
-                               }],
-                       },
-                       options: {
-                               scales: {
-                                       x: {
-                                               type: 'time',
-                                               position: 'bottom',
-                                               time: {
-                                                       unit: 'day',
-                                                       round: true,
-                                                       parser: function(label) {
-                                                               return label === 'foo' ?
-                                                                       moment('2000/01/02', 'YYYY/MM/DD') :
-                                                                       moment('2016/05/08', 'YYYY/MM/DD');
-                                                       }
-                                               },
-                                               ticks: {
-                                                       source: 'labels'
-                                               }
-                                       },
-                               }
-                       }
-               });
-
-               // Counts down because the lines are drawn top to bottom
-               var labels = getLabels(chart.scales.x);
-
-               // Counts down because the lines are drawn top to bottom
-               expect(labels[0]).toBe('Jan 2');
-               expect(labels[1]).toBe('May 8');
-       });
-
-       it('should build ticks using the config unit', function() {
-               var mockData = {
-                       labels: ['2015-01-01T20:00:00', '2015-01-02T21:00:00'], // days
-               };
-
-               var config = Chart.helpers.clone(Chart.scaleService.getScaleDefaults('time'));
-               config.time.unit = 'hour';
-
-               var scale = createScale(mockData, config, {width: 2500, height: 200});
-               var ticks = getLabels(scale);
-
-               expect(ticks).toEqual(['8PM', '9PM', '10PM', '11PM', '12AM', '1AM', '2AM', '3AM', '4AM', '5AM', '6AM', '7AM', '8AM', '9AM', '10AM', '11AM', '12PM', '1PM', '2PM', '3PM', '4PM', '5PM', '6PM', '7PM', '8PM', '9PM']);
-       });
-
-       it('should build ticks honoring the minUnit', function() {
-               var mockData = {
-                       labels: ['2015-01-01T20:00:00', '2015-01-02T21:00:00'], // days
-               };
-
-               var config = Chart.helpers.mergeIf({
-                       bounds: 'ticks',
-                       time: {
-                               minUnit: 'day'
-                       }
-               }, Chart.scaleService.getScaleDefaults('time'));
-
-               var scale = createScale(mockData, config);
-               var ticks = getLabels(scale);
-
-               expect(ticks).toEqual(['Jan 1', 'Jan 2', 'Jan 3']);
-       });
-
        it('should correctly determine the unit', function() {
                var date = moment('Jan 01 1990', 'MMM DD YYYY');
                var data = [];
@@ -342,67 +147,6 @@ describe('Time scale tests', function() {
                expect(scale._unit).toEqual('month');
        });
 
-       it('should build ticks based on the appropriate label capacity', function() {
-               var mockData = {
-                       labels: [
-                               '2012-01-01', '2013-01-01', '2014-01-01', '2015-01-01',
-                               '2016-01-01', '2017-01-01', '2018-01-01', '2019-01-01'
-                       ]
-               };
-
-               var config = Chart.helpers.mergeIf({
-                       time: {
-                               unit: 'year'
-                       }
-               }, Chart.scaleService.getScaleDefaults('time'));
-
-               var scale = createScale(mockData, config);
-               var ticks = getLabels(scale);
-
-               expect(ticks).toEqual(['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019']);
-       });
-
-       it('should build ticks using the config diff', function() {
-               var mockData = {
-                       labels: ['2015-01-01T20:00:00', '2015-02-02T21:00:00', '2015-02-21T01:00:00'], // days
-               };
-
-               var config = Chart.helpers.mergeIf({
-                       bounds: 'ticks',
-                       time: {
-                               unit: 'week',
-                               round: 'week'
-                       }
-               }, Chart.scaleService.getScaleDefaults('time'));
-
-               var scale = createScale(mockData, config, {width: 800, height: 200});
-               var ticks = getLabels(scale);
-
-               // last date is feb 15 because we round to start of week
-               expect(ticks).toEqual(['Dec 28, 2014', 'Jan 4, 2015', 'Jan 11, 2015', 'Jan 18, 2015', 'Jan 25, 2015', 'Feb 1, 2015', 'Feb 8, 2015', 'Feb 15, 2015']);
-       });
-
-       describe('config step size', function() {
-               it('should use the stepSize property', function() {
-                       var mockData = {
-                               labels: ['2015-01-01T20:00:00', '2015-01-01T21:00:00'],
-                       };
-
-                       var config = Chart.helpers.mergeIf({
-                               bounds: 'ticks',
-                               time: {
-                                       unit: 'hour',
-                                       stepSize: 2
-                               }
-                       }, Chart.scaleService.getScaleDefaults('time'));
-
-                       var scale = createScale(mockData, config, {width: 2500, height: 200});
-                       var ticks = getLabels(scale);
-
-                       expect(ticks).toEqual(['8PM', '10PM']);
-               });
-       });
-
        describe('when specifying limits', function() {
                var mockData = {
                        labels: ['2015-01-01T20:00:00', '2015-01-02T20:00:00', '2015-01-03T20:00:00'],
@@ -1425,338 +1169,6 @@ describe('Time scale tests', function() {
                });
        });
 
-       describe('when reverse', function() {
-               describe('is "true"', function() {
-                       beforeEach(function() {
-                               this.chart = window.acquireChart({
-                                       type: 'line',
-                                       data: {
-                                               labels: ['2017', '2018', '2019', '2020', '2021'],
-                                               datasets: [{data: [0, 1, 2, 3, 4]}]
-                                       },
-                                       options: {
-                                               scales: {
-                                                       x: {
-                                                               type: 'time',
-                                                               reverse: true,
-                                                               time: {
-                                                                       parser: 'YYYY',
-                                                                       unit: 'year'
-                                                               },
-                                                               ticks: {
-                                                                       source: 'labels',
-                                                               }
-                                                       },
-                                                       y: {
-                                                               display: false
-                                                       }
-                                               }
-                                       }
-                               });
-                       });
-
-                       it ('should reverse the labels', function() {
-                               var scale = this.chart.scales.x;
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(scale.left + scale.width);
-                               expect(scale.getPixelForValue(moment('2021').valueOf())).toBeCloseToPixel(scale.left);
-                       });
-
-                       it ('should reverse the values for pixels', function() {
-                               var scale = this.chart.scales.x;
-                               expect(scale.getValueForPixel(scale.left)).toBeCloseToTime({
-                                       value: moment('2021-01-01T00:00:00'),
-                                       unit: 'hour',
-                               });
-                               expect(scale.getValueForPixel(scale.left + scale.width)).toBeCloseToTime({
-                                       value: moment('2017-01-01T00:00:00'),
-                                       unit: 'hour',
-                               });
-                       });
-
-                       it ('should reverse the bars and add offsets if offset is true', function() {
-                               var chart = this.chart;
-                               var scale = chart.scales.x;
-                               var options = chart.options.scales.x;
-
-                               options.offset = true;
-                               chart.update();
-
-                               var numTicks = scale.ticks.length;
-                               var firstTickInterval = scale.getPixelForTick(numTicks - 2) - scale.getPixelForTick(numTicks - 1);
-                               var lastTickInterval = scale.getPixelForTick(0) - scale.getPixelForTick(1);
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(scale.left + scale.width - lastTickInterval / 2);
-                               expect(scale.getPixelForValue(moment('2021').valueOf())).toBeCloseToPixel(scale.left + firstTickInterval / 2);
-                       });
-
-                       it ('should reverse the values for pixels if offset is true', function() {
-                               var chart = this.chart;
-                               var scale = chart.scales.x;
-                               var options = chart.options.scales.x;
-
-                               options.offset = true;
-                               chart.update();
-
-                               var numTicks = scale.ticks.length;
-                               var firstTickInterval = scale.getPixelForTick(numTicks - 2) - scale.getPixelForTick(numTicks - 1);
-                               var lastTickInterval = scale.getPixelForTick(0) - scale.getPixelForTick(1);
-
-                               expect(scale.getValueForPixel(scale.left + lastTickInterval / 2)).toBeCloseToTime({
-                                       value: moment('2021-01-01T00:00:00'),
-                                       unit: 'year',
-                               });
-                               expect(scale.getValueForPixel(scale.left + scale.width - firstTickInterval / 2)).toBeCloseToTime({
-                                       value: moment('2017-01-01T00:00:00'),
-                                       unit: 'hour',
-                               });
-                       });
-               });
-       });
-
-       describe('when reverse is "true" and distribution', function() {
-               describe('is "series"', function() {
-                       beforeEach(function() {
-                               this.chart = window.acquireChart({
-                                       type: 'line',
-                                       data: {
-                                               labels: ['2017', '2019', '2020', '2025', '2042'],
-                                               datasets: [{data: [0, 1, 2, 3, 4, 5]}]
-                                       },
-                                       options: {
-                                               scales: {
-                                                       x: {
-                                                               type: 'time',
-                                                               time: {
-                                                                       parser: 'YYYY'
-                                                               },
-                                                               distribution: 'series',
-                                                               reverse: true,
-                                                               ticks: {
-                                                                       source: 'labels'
-                                                               }
-                                                       },
-                                                       y: {
-                                                               display: false
-                                                       }
-                                               }
-                                       }
-                               });
-                       });
-
-                       it ('should reverse the labels and space data out with the same gap, whatever their time values', function() {
-                               var scale = this.chart.scales.x;
-                               var start = scale.left;
-                               var slice = scale.width / 4;
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(start + slice * 4);
-                               expect(scale.getPixelForValue(moment('2019').valueOf())).toBeCloseToPixel(start + slice * 3);
-                               expect(scale.getPixelForValue(moment('2020').valueOf())).toBeCloseToPixel(start + slice * 2);
-                               expect(scale.getPixelForValue(moment('2025').valueOf())).toBeCloseToPixel(start + slice);
-                               expect(scale.getPixelForValue(moment('2042').valueOf())).toBeCloseToPixel(start);
-                       });
-
-                       it ('should reverse the labels and should add a step before if scale.min is before the first data', function() {
-                               var chart = this.chart;
-                               var scale = chart.scales.x;
-                               var options = chart.options.scales.x;
-
-                               options.min = '2012';
-                               chart.update();
-
-                               var start = scale.left;
-                               var slice = scale.width / 5;
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(start + slice * 4);
-                               expect(scale.getPixelForValue(moment('2042').valueOf())).toBeCloseToPixel(start);
-                       });
-
-                       it ('should reverse the labels and should add a step after if scale.max is after the last data', function() {
-                               var chart = this.chart;
-                               var scale = chart.scales.x;
-                               var options = chart.options.scales.x;
-
-                               options.max = '2050';
-                               chart.update();
-
-                               var start = scale.left;
-                               var slice = scale.width / 5;
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(start + slice * 5);
-                               expect(scale.getPixelForValue(moment('2042').valueOf())).toBeCloseToPixel(start + slice);
-                       });
-
-                       it ('should reverse the labels and should add steps before and after if scale.min/max are outside the data range', function() {
-                               var chart = this.chart;
-                               var scale = chart.scales.x;
-                               var options = chart.options.scales.x;
-
-                               options.min = '2012';
-                               options.max = '2050';
-                               chart.update();
-
-                               var start = scale.left;
-                               var slice = scale.width / 6;
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(start + slice * 5);
-                               expect(scale.getPixelForValue(moment('2042').valueOf())).toBeCloseToPixel(start + slice);
-                       });
-               });
-               describe('is "linear"', function() {
-                       beforeEach(function() {
-                               this.chart = window.acquireChart({
-                                       type: 'line',
-                                       data: {
-                                               labels: ['2017', '2019', '2020', '2025', '2042'],
-                                               datasets: [{data: [0, 1, 2, 3, 4, 5]}]
-                                       },
-                                       options: {
-                                               scales: {
-                                                       x: {
-                                                               type: 'time',
-                                                               time: {
-                                                                       parser: 'YYYY'
-                                                               },
-                                                               distribution: 'linear',
-                                                               reverse: true,
-                                                               ticks: {
-                                                                       source: 'labels'
-                                                               }
-                                                       },
-                                                       y: {
-                                                               display: false
-                                                       }
-                                               }
-                                       }
-                               });
-                       });
-
-                       it ('should reverse the labels and should space data out with a gap relative to their time values', function() {
-                               var scale = this.chart.scales.x;
-                               var start = scale.left;
-                               var slice = scale.width / (2042 - 2017);
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(start + slice * (2042 - 2017));
-                               expect(scale.getPixelForValue(moment('2019').valueOf())).toBeCloseToPixel(start + slice * (2042 - 2019));
-                               expect(scale.getPixelForValue(moment('2020').valueOf())).toBeCloseToPixel(start + slice * (2042 - 2020));
-                               expect(scale.getPixelForValue(moment('2025').valueOf())).toBeCloseToPixel(start + slice * (2042 - 2025));
-                               expect(scale.getPixelForValue(moment('2042').valueOf())).toBeCloseToPixel(start);
-                       });
-
-                       it ('should reverse the labels and should take in account scale min and max if outside the ticks range', function() {
-                               var chart = this.chart;
-                               var scale = chart.scales.x;
-                               var options = chart.options.scales.x;
-
-                               options.min = '2012';
-                               options.max = '2050';
-                               chart.update();
-
-                               var start = scale.left;
-                               var slice = scale.width / (2050 - 2012);
-
-                               expect(scale.getPixelForValue(moment('2017').valueOf())).toBeCloseToPixel(start + slice * (2050 - 2017));
-                               expect(scale.getPixelForValue(moment('2019').valueOf())).toBeCloseToPixel(start + slice * (2050 - 2019));
-                               expect(scale.getPixelForValue(moment('2020').valueOf())).toBeCloseToPixel(start + slice * (2050 - 2020));
-                               expect(scale.getPixelForValue(moment('2025').valueOf())).toBeCloseToPixel(start + slice * (2050 - 2025));
-                               expect(scale.getPixelForValue(moment('2042').valueOf())).toBeCloseToPixel(start + slice * (2050 - 2042));
-                       });
-               });
-       });
-
-       describe('labels', function() {
-               it('should read labels from scale / xLabels / yLabels', function() {
-                       var timeOpts = {
-                               parser: 'YYYY',
-                               unit: 'year',
-                               displayFormats: {
-                                       year: 'YYYY'
-                               }
-                       };
-                       var chart = window.acquireChart({
-                               type: 'line',
-                               data: {
-                                       labels: ['1975', '1976', '1977'],
-                                       xLabels: ['1985', '1986', '1987'],
-                                       yLabels: ['1995', '1996', '1997']
-                               },
-                               options: {
-                                       scales: {
-                                               x: {
-                                                       type: 'time',
-                                                       labels: ['2015', '2016', '2017'],
-                                                       time: timeOpts
-                                               },
-                                               x2: {
-                                                       type: 'time',
-                                                       position: 'bottom',
-                                                       time: timeOpts
-                                               },
-                                               y: {
-                                                       type: 'time',
-                                                       time: timeOpts
-                                               },
-                                               y2: {
-                                                       position: 'left',
-                                                       type: 'time',
-                                                       labels: ['2005', '2006', '2007'],
-                                                       time: timeOpts
-                                               }
-                                       }
-                               }
-                       });
-
-                       expect(getLabels(chart.scales.x)).toEqual(['2015', '2016', '2017']);
-                       expect(getLabels(chart.scales.x2)).toEqual(['1985', '1986', '1987']);
-                       expect(getLabels(chart.scales.y)).toEqual(['1995', '1996', '1997']);
-                       expect(getLabels(chart.scales.y2)).toEqual(['2005', '2006', '2007']);
-               });
-       });
-
-       it('should handle autoskip with major and minor ticks', function() {
-               var date = moment('Jan 01 1990', 'MMM DD YYYY');
-               var data = [];
-               for (var i = 0; i < 60; i++) {
-                       data.push({x: date.valueOf(), y: Math.random()});
-                       date = date.clone().add(1, 'month');
-               }
-
-               var chart = window.acquireChart({
-                       type: 'line',
-                       data: {
-                               datasets: [{
-                                       xAxisID: 'x',
-                                       data: data
-                               }],
-                       },
-                       options: {
-                               scales: {
-                                       x: {
-                                               type: 'time',
-                                               ticks: {
-                                                       major: {
-                                                               enabled: true
-                                                       },
-                                                       source: 'data',
-                                                       autoSkip: true
-                                               }
-                                       },
-                               }
-                       }
-               });
-
-               var scale = chart.scales.x;
-
-               var labels = scale.ticks.map(function(t) {
-                       return t.label;
-               });
-               expect(labels).toEqual([
-                       '1990', 'Apr 1990', 'Jul 1990', 'Oct 1990',
-                       '1991', 'Apr 1991', 'Jul 1991', 'Oct 1991',
-                       '1992', 'Apr 1992', 'Jul 1992', 'Oct 1992',
-                       '1993', 'Apr 1993', 'Jul 1993', 'Oct 1993',
-                       '1994', 'Apr 1994', 'Jul 1994', 'Oct 1994']);
-       });
-
        describe('Deprecations', function() {
                describe('options.time.displayFormats', function() {
                        it('should generate defaults from adapter presets', function() {