diff options
| author | Mike Greiling <mike@pixelcog.com> | 2017-12-20 21:28:34 +0000 |
|---|---|---|
| committer | Mike Greiling <mike@pixelcog.com> | 2017-12-20 21:28:34 +0000 |
| commit | ecd1b816644080cc5ccab9c2eddaba9676b47b49 (patch) | |
| tree | 89f98ff9653574a778400582629d5bd79c54725d /spec/javascripts | |
| parent | 95c5d0d92ba5633b710b501ab64548789cbe4601 (diff) | |
| parent | 8d822b1ece4f77e41214b81a3f1c92f8b1a65fe9 (diff) | |
| download | gitlab-ce-ecd1b816644080cc5ccab9c2eddaba9676b47b49.tar.gz | |
Merge branch 'jivl-replace-d3-v3-v4' into 'master'
Update d3 to v4 to enable tree shaking (and reduce the size of our webpack bundles)
Closes #37013
See merge request gitlab-org/gitlab-ce!15585
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/graphs/stat_graph_contributors_graph_spec.js | 12 |
1 files changed, 7 insertions, 5 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..6599839a526 100644 --- a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js +++ b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js @@ -1,8 +1,10 @@ /* eslint-disable quotes, jasmine/no-suite-dupes, vars-on-top, no-var */ - -import d3 from 'd3'; +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 () { @@ -53,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 = d3.time.scale().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); @@ -64,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 = d3.scale.linear().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); @@ -118,7 +120,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 = 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); |
