@datarobot/design-system 28.8.0 → 28.8.2

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.
@@ -23,6 +23,7 @@ function useFullScreenDrawer({
23
23
  setShowCloseWarning(true);
24
24
  } else {
25
25
  onDismissCallback();
26
+ setShowCloseWarning(false);
26
27
  setShow(false);
27
28
  }
28
29
  }, [onDismissCallback, shouldShowCloseWarning, showCloseWarning]);
@@ -33,6 +33,18 @@ describe('useFullScreenDrawer', function () {
33
33
  expect(outerDismiss).not.toHaveBeenCalled();
34
34
  expect(result.current.showCloseWarning).toBe(true);
35
35
  });
36
+ it('should set showCloseWarning to false when onDismiss is called if shouldShowCloseWarning is passed as false', function () {
37
+ const outerDismiss = jest.fn();
38
+ const {
39
+ result
40
+ } = (0, _react.renderHook)(() => (0, _useFullScreenDrawer.useFullScreenDrawer)({
41
+ onDismissCallback: outerDismiss,
42
+ shouldShowCloseWarning: false
43
+ }));
44
+ (0, _react.act)(() => result.current.onDismiss());
45
+ expect(outerDismiss).toHaveBeenCalled();
46
+ expect(result.current.showCloseWarning).toBe(false);
47
+ });
36
48
  it('should close drawer after onDismiss is called twice', function () {
37
49
  const outerDismiss = jest.fn();
38
50
  const {
@@ -17,6 +17,7 @@ export function useFullScreenDrawer({
17
17
  setShowCloseWarning(true);
18
18
  } else {
19
19
  onDismissCallback();
20
+ setShowCloseWarning(false);
20
21
  setShow(false);
21
22
  }
22
23
  }, [onDismissCallback, shouldShowCloseWarning, showCloseWarning]);
@@ -31,6 +31,18 @@ describe('useFullScreenDrawer', function () {
31
31
  expect(outerDismiss).not.toHaveBeenCalled();
32
32
  expect(result.current.showCloseWarning).toBe(true);
33
33
  });
34
+ it('should set showCloseWarning to false when onDismiss is called if shouldShowCloseWarning is passed as false', function () {
35
+ const outerDismiss = jest.fn();
36
+ const {
37
+ result
38
+ } = renderHook(() => useFullScreenDrawer({
39
+ onDismissCallback: outerDismiss,
40
+ shouldShowCloseWarning: false
41
+ }));
42
+ act(() => result.current.onDismiss());
43
+ expect(outerDismiss).toHaveBeenCalled();
44
+ expect(result.current.showCloseWarning).toBe(false);
45
+ });
34
46
  it('should close drawer after onDismiss is called twice', function () {
35
47
  const outerDismiss = jest.fn();
36
48
  const {