diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-11-23 15:35:49 -0600 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-12-18 16:13:05 -0600 |
commit | 2ba30096d26174f22851feb8d35f287b8db772e3 (patch) | |
tree | c57d862385712ee8fcda4a41acabdbc7d572792b /spec/javascripts/graphs/stat_graph_contributors_graph_spec.js | |
parent | 36ba5f8272b11e02eda8110eb8e88b5dd4521928 (diff) | |
download | gitlab-ce-2ba30096d26174f22851feb8d35f287b8db772e3.tar.gz |
Modified contributors graph to use d3 v4
Diffstat (limited to 'spec/javascripts/graphs/stat_graph_contributors_graph_spec.js')
-rw-r--r-- | spec/javascripts/graphs/stat_graph_contributors_graph_spec.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js index 861f26e162f..c48c587174d 100644 --- a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js +++ b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js @@ -1,6 +1,10 @@ /* eslint-disable quotes, jasmine/no-suite-dupes, vars-on-top, no-var */ -import d3 from 'd3'; +import { + scaleLinear as d3ScaleLinear, + scaleTime as d3ScaleTime, + timeParse as d3TimeParse, +} from 'd3'; import { ContributorsGraph, ContributorsMasterGraph } from '~/graphs/stat_graph_contributors_graph'; describe("ContributorsGraph", function () { @@ -53,7 +57,7 @@ describe("ContributorsGraph", function () { it("sets the instance's x domain using the prototype's x_domain", function () { ContributorsGraph.prototype.x_domain = 20; var instance = new ContributorsGraph(); - instance.x = d3.time.scale().range([0, 100]).clamp(true); + instance.x = d3ScaleTime().range([0, 100]).clamp(true); spyOn(instance.x, 'domain'); instance.set_x_domain(); expect(instance.x.domain).toHaveBeenCalledWith(20); @@ -64,7 +68,7 @@ describe("ContributorsGraph", function () { it("sets the instance's y domain using the prototype's y_domain", function () { ContributorsGraph.prototype.y_domain = 30; var instance = new ContributorsGraph(); - instance.y = d3.scale.linear().range([100, 0]).nice(); + instance.y = d3ScaleLinear().range([100, 0]).nice(); spyOn(instance.y, 'domain'); instance.set_y_domain(); expect(instance.y.domain).toHaveBeenCalledWith(30); @@ -118,7 +122,7 @@ describe("ContributorsMasterGraph", function () { describe("#parse_dates", function () { it("parses the dates", function () { var graph = new ContributorsMasterGraph(); - var parseDate = d3.time.format("%Y-%m-%d").parse; + var parseDate = d3TimeParse("%Y-%m-%d"); var data = [{ date: "2013-01-01" }, { date: "2012-12-15" }]; var correct = [{ date: parseDate(data[0].date) }, { date: parseDate(data[1].date) }]; graph.parse_dates(data); |