@truedat/audit 8.4.2 → 8.4.4

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": "@truedat/audit",
3
- "version": "8.4.2",
3
+ "version": "8.4.4",
4
4
  "description": "Truedat Web Audit Module",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -51,7 +51,7 @@
51
51
  "@testing-library/jest-dom": "^6.6.3",
52
52
  "@testing-library/react": "^16.3.0",
53
53
  "@testing-library/user-event": "^14.6.1",
54
- "@truedat/test": "8.4.2",
54
+ "@truedat/test": "8.4.4",
55
55
  "identity-obj-proxy": "^3.0.0",
56
56
  "jest": "^29.7.0",
57
57
  "redux-saga-test-plan": "^4.0.6"
@@ -83,5 +83,5 @@
83
83
  "semantic-ui-react": "^3.0.0-beta.2",
84
84
  "swr": "^2.3.3"
85
85
  },
86
- "gitHead": "6ce335c57b6311c56828ce132b816322aa79d9ea"
86
+ "gitHead": "0d8d2a2f4526c425fcef656a6004484cbd755774"
87
87
  }
@@ -63,7 +63,7 @@ export const SubscriptionWatchForm = ({
63
63
  {children}
64
64
  <div>
65
65
  <Button
66
- type="submit"
66
+ type="button"
67
67
  onClick={handleSubmit}
68
68
  disabled={disabled}
69
69
  loading={subscriptionUpdating}
@@ -71,7 +71,7 @@ export const SubscriptionWatchForm = ({
71
71
  <FormattedMessage id="actions.save" />
72
72
  </Button>
73
73
  {subscription?.id ? (
74
- <Button type="submit" onClick={handleDelete}>
74
+ <Button type="button" onClick={handleDelete}>
75
75
  <Icon name="trash alternate outline" color="red" />
76
76
  <FormattedMessage id="ruleSubscription.actions.remove" />
77
77
  </Button>
@@ -72,4 +72,27 @@ describe("<SubscriptionWatchForm />", () => {
72
72
 
73
73
  expect(handleDelete).toHaveBeenCalledTimes(1);
74
74
  });
75
+
76
+ it("renders save and remove buttons as button type", async () => {
77
+ const rendered = render(<SubscriptionWatchForm {...props} />);
78
+ await waitForLoad(rendered);
79
+
80
+ const saveButton = rendered.getByRole("button", { name: /save/i });
81
+ const removeButton = rendered.getByRole("button", { name: /remove/i });
82
+
83
+ expect(saveButton).toHaveAttribute("type", "button");
84
+ expect(removeButton).toHaveAttribute("type", "button");
85
+ });
86
+
87
+ it("does not render remove button when subscription has no id", async () => {
88
+ const rendered = render(
89
+ <SubscriptionWatchForm
90
+ {...props}
91
+ subscription={{ ...subscription, id: undefined }}
92
+ />
93
+ );
94
+ await waitForLoad(rendered);
95
+
96
+ expect(rendered.queryByRole("button", { name: /remove/i })).toBeNull();
97
+ });
75
98
  });
@@ -73,13 +73,13 @@ exports[`<SubscriptionWatchForm /> matches the latest snapshot 1`] = `
73
73
  <div>
74
74
  <button
75
75
  class="ui button"
76
- type="submit"
76
+ type="button"
77
77
  >
78
78
  actions.save
79
79
  </button>
80
80
  <button
81
81
  class="ui button"
82
- type="submit"
82
+ type="button"
83
83
  >
84
84
  <i
85
85
  aria-hidden="true"