@tsed/react-formio 1.10.10 → 1.10.11

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": "@tsed/react-formio",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.modern.js",
6
6
  "source": "src/index.ts",
@@ -13,7 +13,7 @@
13
13
  "prettier": "prettier '{src,test}/**/*.{ts,tsx}' --write"
14
14
  },
15
15
  "dependencies": {
16
- "@tsed/redux-utils": "1.10.10",
16
+ "@tsed/redux-utils": "1.10.11",
17
17
  "eventemitter2": "^6.4.3",
18
18
  "prop-types": "^15.7.2"
19
19
  },
@@ -28,8 +28,8 @@
28
28
  "tooltip.js": "^1.3.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@tsed/tailwind": "1.10.10",
32
- "@tsed/tailwind-formio": "1.10.10",
31
+ "@tsed/tailwind": "1.10.11",
32
+ "@tsed/tailwind-formio": "1.10.11",
33
33
  "eslint-plugin-jsx-a11y": "^6.5.1"
34
34
  },
35
35
  "repository": "https://github.com/TypedProject/tsed-formio",
@@ -8,32 +8,30 @@ describe("ActionsTable", () => {
8
8
  it("should render the table actions", async () => {
9
9
  const onAddAction = jest.fn();
10
10
 
11
- const { getByTestId, getAllByRole } = render(
11
+ const { getByRole, getAllByRole } = render(
12
12
  <Sandbox {...Sandbox.args} onAddAction={onAddAction} />
13
13
  );
14
14
 
15
- const btn = getByTestId("submit");
15
+ const btn = getByRole("button", { name: /add action/i });
16
16
  const cells = getAllByRole("cell");
17
- const select = getByTestId("select");
17
+ const options = getAllByRole("option");
18
18
 
19
- expect(btn).toHaveAttribute("disabled");
20
- expect(btn).toHaveTextContent("Add action");
21
- expect(cells[0]).toHaveTextContent("Save Submission");
22
- expect(select.children.length).toEqual(
23
- Sandbox.args.availableActions.length + 1
24
- );
19
+ expect(btn).toHaveProperty("disabled");
20
+ expect(btn.innerHTML).toMatch("Add action");
21
+ expect(cells[0].innerHTML).toMatch("Save Submission");
22
+ expect(options.length).toEqual(Sandbox.args.availableActions.length + 1);
25
23
 
26
- expect(select.children[0]).toHaveTextContent("Select an action");
27
- expect(select.children[1]).toHaveTextContent("Email");
24
+ expect(options[0].innerHTML).toMatch("Select an action");
25
+ expect(options[1].innerHTML).toMatch("Email");
28
26
  });
29
27
  it("should not call addAction when the default item is selected", async () => {
30
28
  const onAddAction = jest.fn();
31
29
 
32
- const { getByTestId } = render(
30
+ const { getByRole } = render(
33
31
  <Sandbox {...Sandbox.args} onAddAction={onAddAction} />
34
32
  );
35
33
 
36
- const btn = getByTestId("submit");
34
+ const btn = getByRole("button", { name: /add action/i });
37
35
 
38
36
  await fireEvent.click(btn);
39
37
  expect(onAddAction).not.toHaveBeenCalled();
@@ -41,12 +39,12 @@ describe("ActionsTable", () => {
41
39
  it("should call addAction with the selected action", async () => {
42
40
  const onAddAction = jest.fn();
43
41
 
44
- const { getByTestId } = render(
42
+ const { getByRole } = render(
45
43
  <Sandbox {...Sandbox.args} onAddAction={onAddAction} />
46
44
  );
47
45
 
48
- const btn = getByTestId("submit");
49
- const select = getByTestId("select");
46
+ const btn = getByRole("button", { name: /add action/i });
47
+ const select = getByRole("combobox");
50
48
 
51
49
  await userEvent.selectOptions(
52
50
  select,
@@ -55,7 +53,7 @@ describe("ActionsTable", () => {
55
53
 
56
54
  await fireEvent.click(btn);
57
55
 
58
- expect(btn).not.toHaveAttribute("disabled");
56
+ expect(btn).not.toHaveProperty("disabled", true);
59
57
  expect(onAddAction).toHaveBeenCalledWith("webhook");
60
58
  });
61
59
  });
@@ -53,6 +53,7 @@ export function ActionsTable({
53
53
  disabled={currentAction === ""}
54
54
  className={"btn btn-success"}
55
55
  onClick={() => currentAction && onAddAction(currentAction)}
56
+ type={"submit"}
56
57
  >
57
58
  <i className={classnames(iconClass(undefined, "plus"), "mr-1")} />{" "}
58
59
  {i18n("Add action")}
@@ -84,6 +84,7 @@ export function FormSettings(props: FormSettingsProps) {
84
84
  disabled={!isValid}
85
85
  className={"mt-5 btn btn-primary"}
86
86
  onClick={onSubmit}
87
+ type={"submit"}
87
88
  >
88
89
  {i18n("Save settings")}
89
90
  </button>
@@ -56,7 +56,7 @@ export function InputText<T = any>({
56
56
  <input
57
57
  type={type || "text"}
58
58
  {...props}
59
- data-testid={"input"}
59
+ data-testid={`input_${name}`}
60
60
  className={classnames("form-control", size && `form-control-${size}`)}
61
61
  id={name}
62
62
  required={required}
@@ -6,7 +6,7 @@ describe("Loader", () => {
6
6
  it("should render a component (with isActive = true)", () => {
7
7
  const { getByTestId } = render(<Loader isActive={true} />);
8
8
 
9
- const icon = getByTestId("icon");
9
+ const icon = getByTestId("icon_radio-circle");
10
10
 
11
11
  expect(icon).toBeTruthy();
12
12
  });
@@ -14,7 +14,7 @@ describe("Loader", () => {
14
14
  it("should render a component (with isActive = false)", () => {
15
15
  const { queryByTestId } = render(<Loader isActive={false} />);
16
16
 
17
- const icon = queryByTestId("icon");
17
+ const icon = queryByTestId("icon_radio-circle");
18
18
 
19
19
  expect(icon).toBeFalsy();
20
20
  });
@@ -25,7 +25,7 @@ export function Loader({
25
25
  )}
26
26
  >
27
27
  <span
28
- data-testid={"icon"}
28
+ data-testid={`icon_${icon}`}
29
29
  color={color}
30
30
  className={`text-11xl ${iconClass(undefined, icon, true)}`}
31
31
  />
@@ -71,7 +71,7 @@ export function Select<T = any>({
71
71
  <select
72
72
  ref={ref}
73
73
  {...props}
74
- data-testid={"select"}
74
+ data-testid={`select_${name}`}
75
75
  className={classnames("form-control", size && `form-control-${size}`)}
76
76
  name={name}
77
77
  id={name}
@@ -12,13 +12,13 @@ describe("DefaultColumnFilter", () => {
12
12
  column: { id: "id", filterValue: "", setFilter: jest.fn() }
13
13
  };
14
14
 
15
- const { getByTestId } = render(
15
+ const { getByRole } = render(
16
16
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
17
17
  // @ts-ignore
18
18
  <DefaultColumnFilter {...props} />
19
19
  );
20
20
 
21
- const input = getByTestId("input");
21
+ const input = getByRole("textbox");
22
22
 
23
23
  await act(async () => {
24
24
  fireEvent.change(input, { target: { value: "value-test" } });