orc-shared 1.3.0-dev.7 → 1.3.0-dev.8

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.
@@ -140,11 +140,9 @@ var SubPage = function SubPage(_ref) {
140
140
  variant: action.isPrimary ? "contained" : "outlined",
141
141
  color: action.isPrimary ? "primary" : "default",
142
142
  disableElevation: action.isPrimary,
143
- onMouseDown: function onMouseDown(e) {
144
- setTimeout(function () {
145
- action.handler && action.handler(e);
146
- closeSubPage();
147
- }, action.timeoutDelay || 200);
143
+ onClick: function onClick(e) {
144
+ action.handler && action.handler(e);
145
+ closeSubPage();
148
146
  }
149
147
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, action.label));
150
148
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-shared",
3
- "version": "1.3.0-dev.7",
3
+ "version": "1.3.0-dev.8",
4
4
  "description": "Shared code for Orckestra applications",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
@@ -78,11 +78,9 @@ export const SubPage = ({ config, match, location, history, root, modulePrependP
78
78
  variant={action.isPrimary ? "contained" : "outlined"}
79
79
  color={action.isPrimary ? "primary" : "default"}
80
80
  disableElevation={action.isPrimary}
81
- onMouseDown={e => {
82
- setTimeout(() => {
83
- action.handler && action.handler(e);
84
- closeSubPage();
85
- }, action.timeoutDelay || 200);
81
+ onClick={e => {
82
+ action.handler && action.handler(e);
83
+ closeSubPage();
86
84
  }}
87
85
  >
88
86
  <FormattedMessage {...action.label} />
@@ -11,7 +11,6 @@ import Modal from "../MaterialUI/DataDisplay/Modal";
11
11
  import ModalProps from "../MaterialUI/DataDisplay/modalProps";
12
12
  import Button from "@material-ui/core/Button";
13
13
  import translations from "~/translations/en-US.json";
14
- import { act } from "unexpected-reaction";
15
14
  import { TestWrapper, createMuiTheme } from "../../utils/testUtils";
16
15
  import sharedMessages from "../../sharedMessages";
17
16
 
@@ -183,8 +182,6 @@ describe("SubPage", () => {
183
182
  });
184
183
 
185
184
  it("renders action panel passed from props", () => {
186
- const clock = sinon.useFakeTimers();
187
-
188
185
  const actions = () => [{ label: sharedMessages.cancel }, { label: sharedMessages.applyChanges }];
189
186
 
190
187
  const component = (
@@ -217,11 +214,7 @@ describe("SubPage", () => {
217
214
  const closeButton = mountedComponent.find("button").at(0);
218
215
  const applyButton = mountedComponent.find("button").at(1);
219
216
 
220
- closeButton.invoke("onMouseDown")();
221
-
222
- act(() => {
223
- clock.tick(500); // Wait for the setTimeout inside the onMouseDown event to execute
224
- });
217
+ closeButton.invoke("onClick")();
225
218
 
226
219
  expect(applyButton, "not to be", null);
227
220
  expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
@@ -230,11 +223,8 @@ describe("SubPage", () => {
230
223
 
231
224
  it("Executes handler from button received from props", () => {
232
225
  const someEvent = sinon.spy().named("someEvent");
233
- const clock = sinon.useFakeTimers();
234
226
 
235
- const actions = () => [
236
- { label: sharedMessages.applyChanges, isPrimary: true, handler: someEvent, timeoutDelay: 500 },
237
- ];
227
+ const actions = () => [{ label: sharedMessages.applyChanges, isPrimary: true, handler: someEvent }];
238
228
 
239
229
  const component = (
240
230
  <TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
@@ -265,11 +255,7 @@ describe("SubPage", () => {
265
255
 
266
256
  const applyButton = mountedComponent.find("button").at(0);
267
257
 
268
- applyButton.invoke("onMouseDown")();
269
-
270
- act(() => {
271
- clock.tick(500); // Wait for the setTimeout inside the onMouseDown event to execute
272
- });
258
+ applyButton.invoke("onClick")();
273
259
 
274
260
  const applyButtonClassName = applyButton.props().className;
275
261
  expect(applyButtonClassName, "to contain", "MuiButton-contained");