Skip to content

Commit

Permalink
Merge pull request #3 from DaPulse/fix/dorsh/fix_lint_warnings
Browse files Browse the repository at this point in the history
feat: bump version
  • Loading branch information
DorShakedMonday authored Oct 7, 2020
2 parents eb3afce + ed24b97 commit 09cf00f
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 49 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monday-ui-react-core",
"version": "0.0.3",
"version": "0.0.4",
"description": "Official monday.com UI resources for application development in React.js",
"main": "dist/main.js",
"scripts": {
Expand Down
34 changes: 16 additions & 18 deletions src/components/FormattedNumber/FormattedNumber-test.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
import React from "react";
import { render, cleanup } from "@testing-library/react";
import { expect } from "../../test/test-helpers";
import FormattedNumber from "./FormattedNumber";
import { render, cleanup } from "@testing-library/react";

describe("FormattedNumber Tests", () => {
beforeEach(() => cleanup());
afterEach(() => cleanup());

describe("emptyPlaceHolder", () => {
it("no props where provided", () => {
const { getByText } = render(<FormattedNumber id={"test"} />);
const { getByText } = render(<FormattedNumber id="test" />);
expect(getByText("N/A")).to.be.ok;
});

it("invalid value - empty string", () => {
const { getByText } = render(<FormattedNumber id={"test"} value={" "} />);
const { getByText } = render(<FormattedNumber id="test" value={" "} />);
expect(getByText("N/A")).to.be.ok;
});

it("invalid value - mixed content", () => {
const { getByText } = render(
<FormattedNumber id={"test"} value={"a1s2d"} />
);
const { getByText } = render(<FormattedNumber id="test" value="a1s2d" />);
expect(getByText("N/A")).to.be.ok;
});

it("invalid value - mixed content", () => {
const emptyPlaceHolderText = "Test";
const { getByText } = render(
<FormattedNumber id={"test"} emptyPlaceHolder={emptyPlaceHolderText} />
<FormattedNumber id="test" emptyPlaceHolder={emptyPlaceHolderText} />
);
expect(getByText(emptyPlaceHolderText)).to.be.ok;
});
Expand All @@ -42,23 +40,23 @@ describe("FormattedNumber Tests", () => {
it("should format small number without sign", () => {
const expectedText = "98";
const { getByText } = render(
<FormattedNumber id={"test"} value={smallNumber} />
<FormattedNumber id="test" value={smallNumber} />
);
expect(getByText(expectedText)).to.be.ok;
});

it("should format large number with sign", () => {
const expectedText = "987.6543M";
const { getByText } = render(
<FormattedNumber id={"test"} value={largeNumber} decimalPrecision={4} />
<FormattedNumber id="test" value={largeNumber} decimalPrecision={4} />
);
expect(getByText(expectedText)).to.be.ok;
});

it("should format large number without sign", () => {
const expectedText = "987,654,321";
const { getByText } = render(
<FormattedNumber id={"test"} value={largeNumber} compact={false} />
<FormattedNumber id="test" value={largeNumber} compact={false} />
);
expect(getByText(expectedText)).to.be.ok;
});
Expand All @@ -67,7 +65,7 @@ describe("FormattedNumber Tests", () => {
const expectedText = "987,654,321.123";
const { getByText } = render(
<FormattedNumber
id={"test"}
id="test"
value={decimalNumber}
compact={false}
decimalPrecision={3}
Expand All @@ -80,7 +78,7 @@ describe("FormattedNumber Tests", () => {
const expectedText = "987,654,321";
const { getByText } = render(
<FormattedNumber
id={"test"}
id="test"
value={decimalNumber}
compact={false}
decimalPrecision={-10}
Expand All @@ -93,7 +91,7 @@ describe("FormattedNumber Tests", () => {
const expectedText = "987,654,321.123456";
const { getByText } = render(
<FormattedNumber
id={"test"}
id="test"
value={decimalNumber}
compact={false}
decimalPrecision={50}
Expand All @@ -109,7 +107,7 @@ describe("FormattedNumber Tests", () => {
it("should use handle unsupported local", () => {
const badLocal = "bad";
const { container, getByText } = render(
<FormattedNumber id={"test"} value={value} local={badLocal} />
<FormattedNumber id="test" value={value} local={badLocal} />
);
expect(container).is.ok;
expect(getByText("456")).to.be.ok;
Expand All @@ -122,9 +120,9 @@ describe("FormattedNumber Tests", () => {
const suffix = "suf";

it("should render predix and suffix in the correct order if provided", () => {
const { getByText, container } = render(
const { container } = render(
<FormattedNumber
id={"test"}
id="test"
value={value}
prefix={prefix}
suffix={suffix}
Expand All @@ -138,9 +136,9 @@ describe("FormattedNumber Tests", () => {
});

it("should render rtl", () => {
const { getByText, container } = render(
const { container } = render(
<FormattedNumber
id={"test"}
id="test"
value={value}
prefix={prefix}
suffix={suffix}
Expand Down
3 changes: 2 additions & 1 deletion src/components/FormattedNumber/FormattedNumber.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ FormattedNumber.defaultProps = {
decimalPrecision: 2,
compact: true,
local: FormattedNumber.localFallBack,
rtl: false
rtl: false,
className: ""
};

export default FormattedNumber;
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import React from "react";
import FormattedNumber from "../FormattedNumber";
import { text, number, select, boolean } from "@storybook/addon-knobs";
import FormattedNumber from "../FormattedNumber";
import "./formattedNumber.stories.scss";

export const Sandbox = () => (
<div style={{ width: "100%", margin: "40px" }}>
<div style={{ width: "40px", height: "40px" }}>
<FormattedNumber
className={select(
"With custom class",
["formatted-number--custom-class", ""],
""
)}
value={number("Value", 50000)}
prefix={text("Prefix", "$")}
suffix={text("Suffix", "Human")}
decimalPrecision={number("Precision", 2)}
emptyPlaceHolder={text("Place Holder", "N/A")}
local={text("Local", "en-US")}
compact={boolean("Is compact", true)}
rtl={boolean("Right to Left", false)}
/>
</div>
<div style={{ width: "100%", margin: "40px" }}>
<div style={{ width: "40px", height: "40px" }}>
<FormattedNumber
className={select(
"With custom class",
["formatted-number--custom-class", ""],
""
)}
value={number("Value", 50000)}
prefix={text("Prefix", "$")}
suffix={text("Suffix", "Human")}
decimalPrecision={number("Precision", 2)}
emptyPlaceHolder={text("Place Holder", "N/A")}
local={text("Local", "en-US")}
compact={boolean("Is compact", true)}
rtl={boolean("Right to Left", false)}
/>
</div>
</div>
);

export default {
title: "Components/FormattedNumber",
component: FormattedNumber
title: "Components/FormattedNumber",
component: FormattedNumber
};
5 changes: 2 additions & 3 deletions src/components/ProgressBars/LinearProgressBar/Bar/Bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { calculatePercentage } from "../LinearProgressBarHelpers";

const Bar = ({ value, baseClass, barStyle, animated, min, max, color }) => {
const classNames = useMemo(() => {
const classNames = cx(baseClass, `${baseClass}--${barStyle}`, {
return cx(baseClass, `${baseClass}--${barStyle}`, {
[`${baseClass}--animate`]: animated
});
return classNames;
}, [barStyle, animated, animated]);
}, [barStyle, animated, baseClass]);

const valuePercentage = useMemo(() => {
if (value === null || value === undefined) return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { expect, sinon } from "../../../test/test-helpers";
import LinearProgressBar from "./LinearProgressBar";
import { render, cleanup, act, screen } from "@testing-library/react";
import { expect } from "../../../test/test-helpers";
import LinearProgressBar from "./LinearProgressBar";

describe("ProgressBars Tests", () => {
let component;
Expand Down Expand Up @@ -76,7 +76,7 @@ describe("ProgressBars Tests", () => {
const value = 13;
for (let i = 0; i < 2; i++) {
act(() => {
component = rerender(
rerender(
<LinearProgressBar
value={value + i}
max={100}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { boolean, number, select, color } from "@storybook/addon-knobs";
import LinearProgressBar from "../LinearProgressBar";
import colors from "../../../../constants/colors.json";
import { boolean, number, select, color } from "@storybook/addon-knobs";
import "./linearProgressBar.stories.scss";

export const Sandbox = () => (
Expand Down

0 comments on commit 09cf00f

Please sign in to comment.