From b30cf81fb19e9709d0fd57fd8d346d8285521308 Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Thu, 19 Apr 2018 10:42:16 -0400 Subject: [PATCH] change a few times to UTC in tests these may be harmless but we should consistently use UTC in all tests for #1420 --- spec/bar-chart-spec.js | 10 +++++----- spec/biggish-data-spec.js | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/bar-chart-spec.js b/spec/bar-chart-spec.js index 54d6011ae..ba7a3f9e5 100644 --- a/spec/bar-chart-spec.js +++ b/spec/bar-chart-spec.js @@ -1007,7 +1007,7 @@ describe('dc.barChart', function () { chart = dc.barChart('#' + id); chart.width(500) .transitionDuration(0) - .x(d3.scaleTime()) + .x(d3.scaleUtc()) .elasticY(true).elasticX(true) .dimension(dimension) .group(group); @@ -1022,8 +1022,8 @@ describe('dc.barChart', function () { it('should render the right xAxisMax/Min when 10 day padding', function () { chart.xAxisPadding(10) .render(); - var expectedStartDate = d3.timeDay.offset(date, -10); - var expectedEndDate = d3.timeDay.offset(date, 10); + var expectedStartDate = d3.utcDay.offset(date, -10); + var expectedEndDate = d3.utcDay.offset(date, 10); expect(chart.xAxisMin()).toEqual(expectedStartDate); expect(chart.xAxisMax()).toEqual(expectedEndDate); }); @@ -1031,8 +1031,8 @@ describe('dc.barChart', function () { chart.xAxisPaddingUnit('month') .xAxisPadding(2) .render(); - var expectedStartDate = d3.timeMonth.offset(date, -2); - var expectedEndDate = d3.timeMonth.offset(date, 2); + var expectedStartDate = d3.utcMonth.offset(date, -2); + var expectedEndDate = d3.utcMonth.offset(date, 2); expect(chart.xAxisMin()).toEqual(expectedStartDate); expect(chart.xAxisMax()).toEqual(expectedEndDate); }); diff --git a/spec/biggish-data-spec.js b/spec/biggish-data-spec.js index 5476778f8..e6b861a1a 100644 --- a/spec/biggish-data-spec.js +++ b/spec/biggish-data-spec.js @@ -24,9 +24,9 @@ describe('dc.barChart.biggish', function () { // convert event time into d3 date format row.dd = d3.isoParse(row.t); // pre-calculate the day of the time - row.day = d3.timeDay(row.dd); + row.day = d3.utcDay(row.dd); // precalculate the hour of the time - row.hour = d3.timeHour(row.dd); + row.hour = d3.utcHour(row.dd); // coerce n(umber of attempts) into a number row.n = +row.n; }); @@ -81,13 +81,13 @@ describe('dc.barChart.biggish', function () { // calculate day extent (two element array of first and last items in the range) - of the hour data var extentDay = d3.extent(data, function (row) { return row.day; }); // select the following day for the end of the extent - extentDay[1] = d3.timeDay.offset(extentDay[1], 1); + extentDay[1] = d3.utcDay.offset(extentDay[1], 1); chartAttemptSeries .margins({top: 30, right: 50, bottom: 25, left: 40}) .renderArea(true) .height(200) - .x(d3.scaleTime().domain(extentDay)) + .x(d3.scaleUtc().domain(extentDay)) .renderHorizontalGridLines(true) .rangeChart(chartRange) .transitionDuration(1000) @@ -101,7 +101,7 @@ describe('dc.barChart.biggish', function () { .valueAccessor(function (d) { return d.value.bfa; }) .stack(groupHourSeries, 'Horizontal Movement', function (d) { return d.value.hma; }) .stack(groupHourSeries, 'User Account Hacking', function (d) { return d.value.uha; }) - .xUnits(d3.timeHours); + .xUnits(d3.utcHours); chartAttemptSeries.legend(dc.legend().horizontal(true).x(50).y(0).itemWidth(150).gap(5)); @@ -111,10 +111,10 @@ describe('dc.barChart.biggish', function () { .group(groupHourSum) .centerBar(true) .gap(1) - .xUnits(d3.timeHours) - .round(d3.timeHour.round) + .xUnits(d3.utcHours) + .round(d3.utcHour.round) .alwaysUseRounding(true) - .x(d3.scaleTime().domain(extentDay)) + .x(d3.scaleUtc().domain(extentDay)) // hide the range chart's y axis // note: breaks function chaining by returning the yAxis