@bigbinary/neetoui 3.2.71 → 3.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neetoui",
3
- "version": "3.2.71",
3
+ "version": "3.3.0-beta.0",
4
4
  "main": "./index.js",
5
5
  "author": "BigBinary",
6
6
  "license": "MIT",
@@ -22,7 +22,6 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@bigbinary/neeto-icons": "^1.8.17",
25
- "@popperjs/core": "^2.9.2",
26
25
  "@reach/auto-id": "^0.15.0",
27
26
  "@tippyjs/react": "^4.2.5",
28
27
  "antd": "4.18.7",
@@ -34,7 +33,6 @@
34
33
  "react-hotkeys-hook": "^3.3.2",
35
34
  "react-linkify": "^1.0.0-alpha",
36
35
  "react-outside-click-handler": "^1.3.0",
37
- "react-popper": "^2.2.5",
38
36
  "react-router-nav-prompt": "^0.4.1"
39
37
  },
40
38
  "devDependencies": {
@@ -1,31 +0,0 @@
1
- version: 2.1
2
- aliases:
3
- - &test_environment
4
- docker:
5
- # replace with your preferred image
6
- - image: circleci/node:14
7
- jobs:
8
- "Snapshot Test":
9
- <<: *test_environment
10
- steps:
11
- - checkout
12
- - run: yarn install
13
- - run:
14
- name: Run Snapshot Tests
15
- command: yarn chromatic test --exit-zero-on-changes --project-token $CHROMATIC_PROJECT_TOKEN
16
- "Unit Test":
17
- <<: *test_environment
18
- steps:
19
- - checkout
20
- - run: yarn install
21
- - run:
22
- name: Run Unit Tests
23
- command: yarn test
24
-
25
- workflows:
26
- neetoui-tests:
27
- jobs:
28
- - "Snapshot Test"
29
- - "Unit Test"
30
-
31
-
@@ -1,20 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // not-auto-fixable: Prefer a default export if module exports a single name.
4
- "import/prefer-default-export": "off",
5
- // not-auto-fixable: Forbid a module from importing a module with a dependency path back to itself.
6
- "import/no-cycle": ["error", { maxDepth: 1, ignoreExternal: true }],
7
- // not-auto-fixable: Prevent unnecessary path segments in import and require statements.
8
- "import/no-useless-path-segments": ["error", { noUselessIndex: true }],
9
- // not-auto-fixable: Report any invalid exports, i.e. re-export of the same name.
10
- "import/export": "error",
11
- // not-auto-fixable: Forbid the use of mutable exports with var or let.
12
- "import/no-mutable-exports": "error",
13
- // not-auto-fixable: Ensure all imports appear before other statements.
14
- "import/first": "error",
15
- // not-auto-fixable: Ensure all exports appear after other statements.
16
- "import/exports-last": "error",
17
- // auto-fixable: Enforce a newline after import statements.
18
- "import/newline-after-import": ["error", { count: 1 }]
19
- }
20
- };
@@ -1,15 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // auto-fixable: Enforce a convention in module import order - we enforce https://www.bigbinary.com/react-best-practices/sort-import-statements
4
- "import/order": [
5
- "error",
6
- {
7
- "newlines-between": "always",
8
- alphabetize: { order: "asc", caseInsensitive: true },
9
- warnOnUnassignedImports: true,
10
- // Ignore react imports so that they're always ordered to the top of the file.
11
- pathGroupsExcludedImportTypes: ["react", "react-native"],
12
- },
13
- ],
14
- },
15
- };
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- // Currently we are using this section for excluding certain files from certain rules.
3
- overrides: [
4
- {
5
- files: [".eslintrc.js", "*.json"],
6
- rules: {
7
- "import/order": "off",
8
- "react-hooks/rules-of-hooks": "off",
9
- },
10
- },
11
- ],
12
- };
@@ -1,34 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // not-auto-fixable: Prevent missing props validation in a React component definition.
4
- "react/prop-types": "off",
5
- // not-auto-fixable: Detect unescaped HTML entities, which might represent malformed tags.
6
- "react/no-unescaped-entities": "off",
7
- // not-auto-fixable: Prevent missing displayName in a React component definition. Useful when using React extensions in browser and checking for component name.
8
- "react/display-name": "error",
9
- // not-auto-fixable: Reports when this.state is accessed within setState.
10
- "react/no-access-state-in-setstate": "error",
11
- // not-auto-fixable: Prevent usage of dangerous JSX props. Currently jam3 plugin will take care of handling this.
12
- "react/no-danger": "off",
13
- // not-auto-fixable: Report when a DOM element is using both children and dangerouslySetInnerHTML.
14
- "react/no-danger-with-children": "warn",
15
- // not-auto-fixable: Prevent definitions of unused prop types.
16
- "react/no-unused-prop-types": "error",
17
- // not-auto-fixable: Report missing key props in iterators/collection literals. Important rule!
18
- "react/jsx-key": "error",
19
- // not-auto-fixable: Enforce no duplicate props.
20
- "react/jsx-no-duplicate-props": "error",
21
- // not-auto-fixable: Disallow undeclared variables in JSX.
22
- "react/jsx-no-undef": "error",
23
- // not-auto-fixable: Enforce PascalCase for user-defined JSX components.
24
- "react/jsx-pascal-case": ["error", { allowNamespace: true }],
25
- // not-auto-fixable: Prevent React to be incorrectly marked as unused.
26
- "react/jsx-uses-react": "error",
27
- // not-auto-fixable: Prevent variables used in JSX to be marked as unused.
28
- "react/jsx-uses-vars": "error",
29
- // not-auto-fixable: Ensures https://reactjs.org/docs/hooks-rules.html.
30
- "react-hooks/rules-of-hooks": "error",
31
- // not-auto-fixable: Ensures https://reactjs.org/docs/hooks-rules.html - Checks effect dependencies.
32
- "react-hooks/exhaustive-deps": "warn",
33
- },
34
- };
package/jest-setup.js DELETED
@@ -1,7 +0,0 @@
1
- import "@testing-library/jest-dom";
2
-
3
-
4
- // Fixes element.getTotalLength is not a function. Refer: https://github.com/framer/motion/issues/204
5
- if (!SVGElement.prototype.getTotalLength) {
6
- SVGElement.prototype.getTotalLength = () => 1;
7
- }
@@ -1,103 +0,0 @@
1
- import React from "react";
2
- import { Accordion } from "../lib/components";
3
- import { render, waitForElementToBeRemoved } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
-
6
-
7
-
8
- describe("Accordion", () => {
9
- it("should render without error", () => {
10
- const { getByText } = render(<Accordion>
11
- <Accordion.Item title="Item 1">
12
- <p>Content 1</p>
13
- </Accordion.Item>
14
- </Accordion>);
15
- expect(getByText("Item 1")).toBeInTheDocument();
16
- });
17
-
18
- it("should not render content when accordion is closed", () => {
19
- const { queryByText } = render(<Accordion>
20
- <Accordion.Item title="Item 1">
21
- <p>Content 1</p>
22
- </Accordion.Item>
23
- </Accordion>);
24
- expect(queryByText("Content 1")).not.toBeInTheDocument();
25
- });
26
-
27
- it("should open accordion and render content when accordion title is clicked", () => {
28
- const { getByText } = render(<Accordion>
29
- <Accordion.Item title="Item 1">
30
- <p>Content 1</p>
31
- </Accordion.Item>
32
- </Accordion>);
33
- userEvent.click(getByText("Item 1"));
34
- expect(getByText("Content 1")).toBeInTheDocument();
35
- });
36
-
37
- it("should toggle accordion when Enter or Space key is pressed", async () => {
38
- const { getByText, queryByText } = render(<Accordion>
39
- <Accordion.Item title="Item 1">
40
- <p>Content 1</p>
41
- </Accordion.Item>
42
- </Accordion>);
43
- userEvent.click(getByText("Item 1"));
44
- expect(getByText("Content 1")).toBeInTheDocument();
45
- userEvent.keyboard("{space}");
46
- await waitForElementToBeRemoved(() => queryByText("Content 1"));
47
- expect(queryByText("Content 1")).not.toBeInTheDocument();
48
- userEvent.keyboard("{enter}");
49
- expect(getByText("Content 1")).toBeInTheDocument();
50
- });
51
-
52
- it("should not toggle accordion when any other keys are pressed", () => {
53
- const { getByText } = render(<Accordion>
54
- <Accordion.Item title="Item 1">
55
- <p>Content 1</p>
56
- </Accordion.Item>
57
- </Accordion>);
58
- userEvent.click(getByText("Item 1"));
59
- expect(getByText("Content 1")).toBeInTheDocument();
60
- userEvent.type(getByText("Item 1"), "a");
61
- expect(getByText("Content 1")).toBeInTheDocument();
62
- });
63
-
64
- it("should trigger onClick when title is clicked", () => {
65
- const onClick = jest.fn();
66
- const { getByText } = render(<Accordion>
67
- <Accordion.Item title="Item 1" onClick={onClick}>
68
- <p>Content 1</p>
69
- </Accordion.Item>
70
- </Accordion>);
71
- userEvent.click(getByText("Item 1"));
72
- expect(onClick).toHaveBeenCalledTimes(1);
73
- });
74
-
75
- it("should only open one accordion at a time", async () => {
76
- const { getByText, queryByText } = render(<Accordion>
77
- <Accordion.Item title="Item 1">
78
- <p>Content 1</p>
79
- </Accordion.Item>
80
- <Accordion.Item title="Item 2">
81
- <p>Content 2</p>
82
- </Accordion.Item>
83
- </Accordion>);
84
- userEvent.click(getByText("Item 1"));
85
- expect(getByText("Content 1")).toBeInTheDocument();
86
- userEvent.click(getByText("Item 2"));
87
- await waitForElementToBeRemoved(() => queryByText("Content 1"));
88
- expect(queryByText("Content 1")).not.toBeInTheDocument();
89
- expect(getByText("Content 2")).toBeInTheDocument();
90
- });
91
-
92
- it("should open the the accordion when defaultActiveKey is provided", () => {
93
- const { getByText } = render(<Accordion defaultActiveKey={1}>
94
- <Accordion.Item title="Item 1">
95
- <p>Content 1</p>
96
- </Accordion.Item>
97
- <Accordion.Item title="Item 2">
98
- <p>Content 2</p>
99
- </Accordion.Item>
100
- </Accordion>);
101
- expect(getByText("Content 2")).toBeInTheDocument();
102
- });
103
- });
@@ -1,126 +0,0 @@
1
- import React from "react";
2
- import { Alert } from "../lib/components";
3
- import { render } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
-
6
- describe("Alert", () => {
7
- it("should render without error", () => {
8
- const { getByText } = render(
9
- <Alert title="Alert title" message="Alert message" isOpen />
10
- );
11
- expect(getByText("Alert title")).toBeInTheDocument();
12
- expect(getByText("Alert message")).toBeInTheDocument();
13
- });
14
-
15
- it("should not display content when isOpen is false", () => {
16
- const { queryByText } = render(
17
- <Alert title="Alert title" message="Alert message" isOpen={false} />
18
- );
19
- expect(queryByText("Alert title")).not.toBeInTheDocument();
20
- expect(queryByText("Alert message")).not.toBeInTheDocument();
21
- });
22
-
23
- it("should call onClose when close button is clicked", () => {
24
- const onClose = jest.fn();
25
- const { getByTestId } = render(
26
- <Alert
27
- title="Alert title"
28
- message="Alert message"
29
- isOpen
30
- onClose={onClose}
31
- />
32
- );
33
- userEvent.click(getByTestId("close-button"));
34
- expect(onClose).toHaveBeenCalledTimes(1);
35
- });
36
-
37
- it("should call onSubmit when submit button is clicked", () => {
38
- const onSubmit = jest.fn();
39
- const { getByText } = render(
40
- <Alert
41
- title="Alert title"
42
- message="Alert message"
43
- isOpen
44
- onSubmit={onSubmit}
45
- submitButtonLabel="Submit"
46
- />
47
- );
48
- userEvent.click(getByText("Submit"));
49
- expect(onSubmit).toHaveBeenCalledTimes(1);
50
- });
51
-
52
- it("should call onClose when cancel button is clicked", () => {
53
- const onClose = jest.fn();
54
- const { getByText } = render(
55
- <Alert
56
- title="Alert title"
57
- message="Alert message"
58
- isOpen
59
- onClose={onClose}
60
- cancelButtonLabel="Cancel"
61
- />
62
- );
63
- userEvent.click(getByText("Cancel"));
64
- expect(onClose).toHaveBeenCalledTimes(1);
65
- });
66
-
67
- it("should close the alert when Esc key is pressed", () => {
68
- const onClose = jest.fn();
69
- const { container } = render(
70
- <Alert
71
- title="Alert title"
72
- message="Alert message"
73
- isOpen
74
- onClose={onClose}
75
- closeOnEsc
76
- />
77
- );
78
- userEvent.type(container, "{esc}");
79
- expect(onClose).toHaveBeenCalledTimes(1);
80
- });
81
-
82
- it("should not close the alert when Esc key is pressed when closeOnEsc is false", () => {
83
- const onClose = jest.fn();
84
- const { container } = render(
85
- <Alert
86
- title="Alert title"
87
- message="Alert message"
88
- isOpen
89
- onClose={onClose}
90
- closeOnEsc={false}
91
- />
92
- );
93
- userEvent.type(container, "{esc}");
94
- expect(onClose).not.toHaveBeenCalled();
95
- });
96
-
97
- it("should close alert when clicking outside", () => {
98
- const onClose = jest.fn();
99
- const { getByTestId } = render(
100
- <Alert
101
- title="Alert title"
102
- message="Alert message"
103
- isOpen
104
- onClose={onClose}
105
- closeOnOutsideClick
106
- />
107
- );
108
- userEvent.click(getByTestId("backdrop"));
109
- expect(onClose).toHaveBeenCalledTimes(1);
110
- });
111
-
112
- it("should not close alert when clicking outside when closeOnOutsideClick is false", () => {
113
- const onClose = jest.fn();
114
- const { getByTestId } = render(
115
- <Alert
116
- title="Alert title"
117
- message="Alert message"
118
- isOpen
119
- onClose={onClose}
120
- closeOnOutsideClick={false}
121
- />
122
- );
123
- userEvent.click(getByTestId("backdrop"));
124
- expect(onClose).not.toHaveBeenCalled();
125
- });
126
- });
@@ -1,73 +0,0 @@
1
- import React from "react";
2
- import { Button } from "../lib/components";
3
- import { render } from "@testing-library/react";
4
- import { BrowserRouter } from "react-router-dom";
5
- import userEvent from "@testing-library/user-event";
6
-
7
- describe("Button", () => {
8
- it("should render without error", () => {
9
- const { getByText } = render(<Button label="Button" />);
10
- expect(getByText("Button")).toBeInTheDocument();
11
- });
12
-
13
- it("should call onClick on button click", () => {
14
- const onClick = jest.fn();
15
- const { getByText } = render(<Button label="Button" onClick={onClick} />);
16
- userEvent.click(getByText("Button"));
17
- expect(onClick).toHaveBeenCalledTimes(1);
18
- });
19
-
20
- it("should not call onClick on button click when disabled", () => {
21
- const onClick = jest.fn();
22
- const { getByText } = render(
23
- <Button label="Button" onClick={onClick} disabled />
24
- );
25
- userEvent.click(getByText("Button"));
26
- expect(onClick).toHaveBeenCalledTimes(0);
27
- });
28
-
29
- it("should not call onClick on button click when loading", () => {
30
- const onClick = jest.fn();
31
- const { getByText } = render(
32
- <Button label="Button" onClick={onClick} loading />
33
- );
34
- userEvent.click(getByText("Button"));
35
- expect(onClick).toHaveBeenCalledTimes(0);
36
- });
37
-
38
- it("should show tooltip when button is hovered", () => {
39
- const { getByText } = render(
40
- <Button label="Button" tooltipProps={{ content: "Tooltip" }} />
41
- );
42
- userEvent.hover(getByText("Button"));
43
- expect(getByText("Tooltip")).toBeInTheDocument();
44
- });
45
-
46
- it("should show icon when icon string is provided", () => {
47
- const { getByTestId } = render(<Button icon="check" />);
48
- expect(getByTestId("class-icon")).toBeInTheDocument();
49
- });
50
-
51
- it("should show icon when icon component is provided", () => {
52
- const { getByTestId } = render(
53
- <Button icon={() => <svg data-testid="svg-icon" />} />
54
- );
55
- expect(getByTestId("svg-icon")).toBeInTheDocument();
56
- });
57
-
58
- it("should render a link when `href` prop is given", () => {
59
- const { getByRole } = render(
60
- <Button label="Link" href="https://example.com" />
61
- );
62
- expect(getByRole("link")).toHaveAttribute("href", "https://example.com");
63
- });
64
-
65
- it("should render a router link when `to` prop is given", () => {
66
- const { getByRole } = render(
67
- <BrowserRouter>
68
- <Button label="Router Link" to="/some-path" />
69
- </BrowserRouter>
70
- );
71
- expect(getByRole("link")).toHaveAttribute("href", "/some-path");
72
- });
73
- });
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- import { Callout } from "../lib/components";
3
- import { Check } from "@bigbinary/neeto-icons";
4
- import { render } from "@testing-library/react";
5
-
6
- describe("Callout", () => {
7
- it("should render without error", () => {
8
- const { getByText } = render(
9
- <Callout>
10
- <p>Tesing Callout</p>
11
- </Callout>
12
- );
13
- expect(getByText("Tesing Callout")).toBeInTheDocument();
14
- });
15
-
16
- it("should show icon when icon component is provided", () => {
17
- const { getByTestId } = render(<Callout icon={Check} />);
18
- expect(getByTestId("callout-icon")).toBeInTheDocument();
19
- });
20
- });
@@ -1,43 +0,0 @@
1
- import React from "react";
2
- import { Checkbox } from "../lib/components";
3
- import { render } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
-
6
- describe("Checkbox", () => {
7
- it("should render without error", () => {
8
- const { getByRole } = render(<Checkbox label="Checkbox" />);
9
- expect(getByRole("checkbox")).toBeInTheDocument();
10
- });
11
-
12
- it("should call onChange when checkbox value is changed", () => {
13
- const onChange = jest.fn();
14
- const { getByRole } = render(
15
- <Checkbox label="Checkbox" onChange={onChange} />
16
- );
17
- userEvent.click(getByRole("checkbox"));
18
- expect(onChange).toHaveBeenCalledTimes(1);
19
- });
20
-
21
- it("should display error message", () => {
22
- const { getByText } = render(
23
- <Checkbox label="Checkbox" error="Error message" />
24
- );
25
- expect(getByText("Error message")).toBeInTheDocument();
26
- });
27
-
28
- it("should be unchecked by default", () => {
29
- const { getByRole } = render(
30
- <Checkbox label="Checkbox"/>
31
- );
32
- expect(getByRole("checkbox")).not.toBeChecked();
33
- });
34
-
35
- it("should be checked on clicking the checkbox", () => {
36
- const { getByRole } = render(
37
- <Checkbox label="Checkbox"/>
38
- );
39
- const checkbox = getByRole("checkbox");
40
- userEvent.click(checkbox);
41
- expect(checkbox).toBeChecked();
42
- });
43
- });
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import Collapse from "../lib/components/Accordion/Collapse";
4
-
5
- describe("Collapse", () => {
6
- it("should render without error", () => {
7
- const { getByText } = render(<Collapse open>
8
- <p>Content</p>
9
- </Collapse>);
10
- expect(getByText("Content")).toBeInTheDocument();
11
- });
12
-
13
- it("should not display content when collapsed", () => {
14
- const { queryByText } = render(<Collapse>
15
- <p>Content</p>
16
- </Collapse>);
17
- expect(queryByText("Content")).not.toBeInTheDocument();
18
- });
19
- });
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { Spinner } from "../lib/components";
3
- import { render } from "@testing-library/react";
4
-
5
- describe("Spinner", () => {
6
- it("should render without error", () => {
7
- const { getByTestId } = render(<Spinner/>);
8
- expect(getByTestId("spinner")).toBeInTheDocument();
9
- });
10
- });
package/tests/Tag.test.js DELETED
@@ -1,40 +0,0 @@
1
- import React from "react";
2
- import { Tag } from "../lib/components";
3
- import { render } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
-
6
- describe("Tag", () => {
7
- it("should render without error", () => {
8
- const { getByText } = render(<Tag label="Tag" />);
9
- expect(getByText("Tag")).toBeInTheDocument();
10
- });
11
-
12
- it("should show icon when icon string is provided", () => {
13
- const { getByTestId } = render(<Tag icon="check" />);
14
- expect(getByTestId("class-icon")).toBeInTheDocument();
15
- });
16
-
17
- it("should show indicator when indicatorColor is provided", () => {
18
- const { getByTestId } = render(<Tag indicatorColor="green" />);
19
- expect(getByTestId("tag-indicator")).toBeInTheDocument();
20
- });
21
-
22
- it("should show close button if onClose function is provided", () => {
23
- const { getByTestId } = render(<Tag onClose={() => {}} />);
24
- expect(getByTestId("tag-close-button")).toBeInTheDocument();
25
- });
26
-
27
- it("should call onClose on button click", () => {
28
- const onClose = jest.fn();
29
- const { getByTestId } = render(<Tag onClose={onClose} />);
30
- userEvent.click(getByTestId("tag-close-button"));
31
- expect(onClose).toHaveBeenCalledTimes(1);
32
- });
33
-
34
- it("should not call onClose function if tag is disabled", () => {
35
- const onClose = jest.fn();
36
- const { getByTestId } = render(<Tag onClose={onClose} disabled />);
37
- userEvent.click(getByTestId("tag-close-button"));
38
- expect(onClose).toHaveBeenCalledTimes(0);
39
- });
40
- });
@@ -1,51 +0,0 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import { Textarea } from "../lib/components";
4
- import userEvent from "@testing-library/user-event";
5
-
6
- describe("Textarea", () => {
7
- it("should render without error", () => {
8
- const { getByLabelText } = render(<Textarea id="text" label="Textarea" />);
9
- expect(getByLabelText("Textarea")).toBeInTheDocument();
10
- });
11
-
12
- it("should update value on input when uncontrolled", () => {
13
- const { getByLabelText } = render(<Textarea id="text" label="Textarea" />);
14
- const textarea = getByLabelText("Textarea");
15
- userEvent.type(textarea, "Test");
16
- expect(textarea).toHaveValue("Test");
17
- });
18
-
19
- it("should call onChange when textarea value changes", () => {
20
- const onChange = jest.fn();
21
- const { getByLabelText } = render(
22
- <Textarea id="text" label="Textarea" onChange={onChange} />
23
- );
24
- userEvent.type(getByLabelText("Textarea"), "Test");
25
- expect(onChange).toHaveBeenCalledTimes(4);
26
- });
27
-
28
- it("should display helpText", () => {
29
- const { getByText } = render(<Textarea id="text" label="Textarea" helpText="Help text" />);
30
- expect(getByText("Help text")).toBeInTheDocument();
31
- });
32
-
33
- it("should display error message", () => {
34
- const { getByText } = render(
35
- <Textarea id="text" label="Textarea" error="Error message" />
36
- );
37
- expect(getByText("Error message")).toBeInTheDocument();
38
- });
39
-
40
- it("should properly handle maxLength", () => {
41
- const { getByLabelText, getByText } = render(
42
- <Textarea id="text" label="Textarea" maxLength={5} />
43
- );
44
- expect(getByText("0 / 5")).toBeInTheDocument();
45
- expect(getByLabelText("Textarea")).toHaveAttribute("maxLength", "5");
46
-
47
- userEvent.type(getByLabelText("Textarea"), "Testing maxLength");
48
- expect(getByText("5 / 5")).toBeInTheDocument();
49
- expect(getByLabelText("Textarea")).toHaveValue("Testi");
50
- });
51
- });
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- import { Typography } from "../lib/components";
3
- import { render } from "@testing-library/react";
4
-
5
- describe("Typography", () => {
6
- it("should render without error", () => {
7
- const { getByText } = render(<Typography style="body1">Typography</Typography>);
8
- expect(getByText("Typography")).toBeInTheDocument();
9
- });
10
-
11
- it("should render a heading when style is of heading type", () => {
12
- const { getByRole } = render(<Typography style="h1">Typography</Typography>);
13
- expect(getByRole("heading", { level: 1 })).toBeInTheDocument();
14
- });
15
-
16
- it("should override default tag when component prop is given", () => {
17
- const { getByRole } = render(<Typography style="h1" component="h2">Typography</Typography>);
18
- expect(getByRole("heading", { level: 2 })).toBeInTheDocument();
19
- });
20
- });