[FIX] code coverage extension
parent
4fe9d89912
commit
2aed62b9f8
|
@ -86,4 +86,20 @@ describe("<Grid/>", () => {
|
||||||
const axisValues = wrapper.find(".x-label").children();
|
const axisValues = wrapper.find(".x-label").children();
|
||||||
expect(axisValues).toHaveLength(5);
|
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)");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,13 +22,13 @@ export function Grid(props: GridProps) {
|
||||||
// Text transform:scale value
|
// Text transform:scale value
|
||||||
const axisTransformValue = zoomLvl <= 1 ? 2 - zoomLvl : 1;
|
const axisTransformValue = zoomLvl <= 1 ? 2 - zoomLvl : 1;
|
||||||
// Start and increment steps to visualize in grid
|
// Start and increment steps to visualize in grid
|
||||||
let axisStep = 0;
|
let axisStep;
|
||||||
if (zoomLvl > 0.5) {
|
if (zoomLvl <= 0.2) {
|
||||||
axisStep = 100;
|
|
||||||
} else if (zoomLvl <= 0.2) {
|
|
||||||
axisStep = 500;
|
axisStep = 500;
|
||||||
} else if (zoomLvl <= 0.5) {
|
} else if (zoomLvl <= 0.5) {
|
||||||
axisStep = 200;
|
axisStep = 200;
|
||||||
|
} else {
|
||||||
|
axisStep = 100;
|
||||||
}
|
}
|
||||||
// End axis-values controls
|
// End axis-values controls
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue