diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-11-28 13:33:17 -0600 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2017-12-18 16:15:17 -0600 |
commit | 4e0e2fd9d297319f323b987944b58bfd3a14ba58 (patch) | |
tree | 68d45e533737ebbc18c19bc8778e8519ea10cec3 /spec/javascripts/graphs | |
parent | 2d4d1290f0ab7baad94af93904c1a3c81fddfe37 (diff) | |
download | gitlab-ce-4e0e2fd9d297319f323b987944b58bfd3a14ba58.tar.gz |
Refactored d3 modules to instead of having a common_d3 dir, to use the micro modules instead
Diffstat (limited to 'spec/javascripts/graphs')
-rw-r--r-- | spec/javascripts/graphs/stat_graph_contributors_graph_spec.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js index ead674b7735..6599839a526 100644 --- a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js +++ b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js @@ -1,12 +1,10 @@ /* eslint-disable quotes, jasmine/no-suite-dupes, vars-on-top, no-var */ - -import { - scaleLinear as d3ScaleLinear, - scaleTime as d3ScaleTime, - timeParse as d3TimeParse, -} from '~/common_d3/index'; +import { scaleLinear, scaleTime } from 'd3-scale'; +import { timeParse } from 'd3-time-format'; import { ContributorsGraph, ContributorsMasterGraph } from '~/graphs/stat_graph_contributors_graph'; +const d3 = { scaleLinear, scaleTime, timeParse }; + describe("ContributorsGraph", function () { describe("#set_x_domain", function () { it("set the x_domain", function () { @@ -57,7 +55,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 = d3ScaleTime().range([0, 100]).clamp(true); + instance.x = d3.scaleTime().range([0, 100]).clamp(true); spyOn(instance.x, 'domain'); instance.set_x_domain(); expect(instance.x.domain).toHaveBeenCalledWith(20); @@ -68,7 +66,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 = d3ScaleLinear().range([100, 0]).nice(); + instance.y = d3.scaleLinear().range([100, 0]).nice(); spyOn(instance.y, 'domain'); instance.set_y_domain(); expect(instance.y.domain).toHaveBeenCalledWith(30); @@ -122,7 +120,7 @@ describe("ContributorsMasterGraph", function () { describe("#parse_dates", function () { it("parses the dates", function () { var graph = new ContributorsMasterGraph(); - var parseDate = d3TimeParse("%Y-%m-%d"); + var parseDate = d3.timeParse("%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); |