[FIX] code coverage extension

pull/1689/head
Fabio Dessi 2020-02-09 14:38:01 +01:00
parent 4fe9d89912
commit 2aed62b9f8
2 changed files with 20 additions and 4 deletions

View File

@ -86,4 +86,20 @@ describe("<Grid/>", () => {
const axisValues = wrapper.find(".x-label").children();
expect(axisValues).toHaveLength(5);
});
it("use transform scale 1 for zoom above 1", () => {
const p = fakeProps();
p.zoomLvl = 1.1;
const wrapper = shallow(<Grid {...p} />);
const textNode = wrapper.find(".x-label").first();
expect(textNode.prop("style")).toHaveProperty("transform", "scale(1)");
});
it("use transform scale 1.5 for zoom on 0.5", () => {
const p = fakeProps();
p.zoomLvl = 0.5;
const wrapper = shallow(<Grid {...p} />);
const textNode = wrapper.find(".x-label").first();
expect(textNode.prop("style")).toHaveProperty("transform", "scale(1.5)");
});
});

View File

@ -22,13 +22,13 @@ export function Grid(props: GridProps) {
// Text transform:scale value
const axisTransformValue = zoomLvl <= 1 ? 2 - zoomLvl : 1;
// Start and increment steps to visualize in grid
let axisStep = 0;
if (zoomLvl > 0.5) {
axisStep = 100;
} else if (zoomLvl <= 0.2) {
let axisStep;
if (zoomLvl <= 0.2) {
axisStep = 500;
} else if (zoomLvl <= 0.5) {
axisStep = 200;
} else {
axisStep = 100;
}
// End axis-values controls