From 7cb4bf5c93461531f8ce22088dfd3d32529dfbf2 Mon Sep 17 00:00:00 2001 From: boygirl Date: Mon, 17 Jul 2017 16:12:46 -0700 Subject: [PATCH 1/2] let axes set their own default tick formats --- src/components/victory-chart/helper-methods.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/victory-chart/helper-methods.js b/src/components/victory-chart/helper-methods.js index 6c96aff5..afec03cf 100644 --- a/src/components/victory-chart/helper-methods.js +++ b/src/components/victory-chart/helper-methods.js @@ -139,7 +139,7 @@ export default { const dataTicks = ["", ...dataNames, ""]; return (x) => dataTicks[x]; } else { - return calculatedProps.scale[currentAxis].tickFormat() || identity; + return undefined; } }, From dade6db23c1434a5a0c02f49ba17d74ce214b4b4 Mon Sep 17 00:00:00 2001 From: boygirl Date: Mon, 17 Jul 2017 16:16:15 -0700 Subject: [PATCH 2/2] fix spec --- .../spec/components/victory-chart/helper-methods.spec.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/client/spec/components/victory-chart/helper-methods.spec.js b/test/client/spec/components/victory-chart/helper-methods.spec.js index c7bb0b7a..c54d0dda 100644 --- a/test/client/spec/components/victory-chart/helper-methods.spec.js +++ b/test/client/spec/components/victory-chart/helper-methods.spec.js @@ -161,7 +161,6 @@ describe("victory-chart/helpers-methods", () => { describe("getTickFormat", () => { const stringMap = { x: { "a": 1, "b": 2, "c": 3 } }; const nullStringMap = { x: null }; - const scale = { x: { tickFormat: () => () => "scaleFormatTick" } }; it("returns the identity function when tickValues are numerical", () => { const props = { tickValues: [1, 2, 3] }; @@ -179,12 +178,12 @@ describe("victory-chart/helpers-methods", () => { expect(formatResult(1)).to.equal("a"); }); - it("returns the tickFormat function from scale", () => { + it("returns undefined if no tickValues or stringMaps exist", () => { const victoryAxis = getVictoryAxis({}); const formatResult = Helpers.getTickFormat( - victoryAxis, "x", { stringMap: nullStringMap, scale } + victoryAxis, "x", { stringMap: nullStringMap } ); - expect(formatResult(1)).to.equal("scaleFormatTick"); + expect(formatResult).to.equal(undefined); }); });