Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Bug/bar bugs #316

Merged
merged 7 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update specs
  • Loading branch information
boygirl committed Nov 14, 2017
commit 4e23a90c0d3b00c031beb6230671c34d623edd36
3 changes: 0 additions & 3 deletions test/client/spec/svg-test-helper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { property, max, min } from "lodash";

const FLYOUT_SEQUENCE = ["M", "L", "L", "L", "A", "L", "A", "L", "A", "L", "A", "z"];
const RECTANGLE_SEQUENCE = ["M", "L", "L", "L", "L", "z"];

const parseSvgPathCommands = (commandStr) => {
const matches = commandStr.match(
Expand Down Expand Up @@ -54,8 +53,6 @@ const expectations = {
getBarShape(wrapper) {
const commands = getPathCommandsFromWrapper(wrapper);

expect(exhibitsShapeSequence(wrapper, RECTANGLE_SEQUENCE, commands)).to.equal(true);

const points = commands.filter((command) => { return command.name !== "z"; });
const verticalPoints = points.map(property("args.1"));
const horizontalPoints = points.map(property("args.0"));
Expand Down
11 changes: 5 additions & 6 deletions test/client/spec/victory-primitives/bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ describe("victory-primitives/bar", () => {
it("should render a vertical bar", () => {
const wrapper = shallow(<Bar {...baseProps}/>);
const barShape = SvgTestHelper.getBarShape(wrapper);

expect(barShape.height).to.eql(10);
expect(Math.round(barShape.height)).to.eql(10);
});

it("should render a horizontal bar", () => {
Expand All @@ -36,7 +35,7 @@ describe("victory-primitives/bar", () => {
const wrapper = shallow(<Bar {...props}/>);
const barShape = SvgTestHelper.getBarShape(wrapper);

expect(barShape.width).to.eql(10);
expect(Math.round(barShape.width)).to.eql(10);
});

it("should render a default bar width when one is not provided", () => {
Expand All @@ -49,15 +48,15 @@ describe("victory-primitives/bar", () => {
const wrapper = shallow(<Bar {...props}/>);
const barShape = SvgTestHelper.getBarShape(wrapper);

expect(barShape.width).to.eql(1);
expect(Math.floor(barShape.width)).to.eql(2);
});

it("should allow override of width by passing a style", () => {
const props = Object.assign({}, baseProps, { style: { width: 1 } });
const props = Object.assign({}, baseProps, { style: { width: 3 } });

const wrapper = shallow(<Bar {...props}/>);
const barShape = SvgTestHelper.getBarShape(wrapper);

expect(barShape.width).to.eql(1);
expect(Math.floor(barShape.width)).to.eql(3);
});
});
2 changes: 1 addition & 1 deletion test/client/spec/victory-primitives/path-helper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("path-helpers", () => {
it("draws a path for a star at the correct location", () => {
const pathResult = PathHelpers.star(0, 0, 1);
const angle = Math.PI / 5;
const baseSize = Math.round(1.35 * size);
const baseSize = 1.35 * size;
expect(pathResult).to.contain(`M ${(baseSize) * Math.sin(angle) + x },
${(baseSize) * Math.cos(angle) + y}`);
});
Expand Down