@linzjs/step-ag-grid 15.1.2 → 16.0.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/dist/src/components/GridCell.d.ts +1 -1
- package/dist/src/components/GridIcon.d.ts +2 -2
- package/dist/src/components/GridLoadableCell.d.ts +1 -2
- package/dist/src/components/GridNoRowsOverlay.d.ts +3 -3
- package/dist/src/components/GridPopoverHook.d.ts +1 -1
- package/dist/src/components/GridWrapper.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -2
- package/dist/src/components/gridFilter/GridFilterQuick.d.ts +1 -2
- package/dist/src/components/gridFilter/GridFilters.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +1 -2
- package/dist/src/components/gridForm/GridFormMessage.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -2
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -2
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +1 -1
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -2
- package/dist/src/contexts/GridContext.d.ts +1 -1
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +1 -1
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +1 -1
- package/dist/src/lui/ActionButton.d.ts +1 -1
- package/dist/src/lui/FormError.d.ts +1 -1
- package/dist/src/lui/TextAreaInput.d.ts +1 -1
- package/dist/src/lui/TextInputFormatted.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +3 -3
- package/dist/src/react-menu3/components/FocusableItem.d.ts +2 -2
- package/dist/src/react-menu3/components/Menu.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuButton.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuDivider.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuItem.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -2
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/SubMenu.d.ts +2 -2
- package/dist/src/react-menu3/utils/utils.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +986 -3896
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +987 -3897
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +27 -23
- package/src/components/Grid.tsx +14 -18
- package/src/components/GridIcon.tsx +2 -1
- package/src/components/GridNoRowsOverlay.tsx +7 -10
- package/src/contexts/GridContext.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +32 -13
- package/src/lui/ActionButton.tsx +2 -1
- package/src/lui/TextInputFormatted.tsx +2 -1
- package/src/lui/reactUtils.test.tsx +4 -3
- package/src/stories/components/ActionButton.stories.tsx +2 -1
- package/src/stories/grid/FormTest.tsx +2 -1
- package/src/stories/grid/GridFilterButtons.stories.tsx +5 -15
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +6 -3
- package/src/stories/grid/GridNonEditableRow.stories.tsx +4 -3
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +4 -3
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +4 -3
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +5 -4
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +4 -3
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +4 -3
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +4 -3
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +4 -3
- package/src/stories/grid/GridReadOnly.stories.tsx +12 -3
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +13 -10
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +13 -10
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +13 -10
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +12 -9
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +17 -14
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +17 -14
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +10 -7
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +12 -9
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +4 -1
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +21 -12
- package/src/stories/react-menu/ReactMenu.stories.tsx +6 -4
- package/src/utils/testQuick.ts +10 -2
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { useCallback, useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import {
|
|
8
11
|
ColDefT,
|
|
@@ -26,8 +29,6 @@ import {
|
|
|
26
29
|
import { GridFilterColumnsToggle } from "../../components";
|
|
27
30
|
import { GridFilterDownloadCsvButton } from "../../components";
|
|
28
31
|
import { GridCellFiller } from "../../components/GridCellFiller";
|
|
29
|
-
import "../../styles/GridTheme.scss";
|
|
30
|
-
import "../../styles/index.scss";
|
|
31
32
|
|
|
32
33
|
export default {
|
|
33
34
|
title: "Components / Grids",
|
|
@@ -39,6 +40,14 @@ export default {
|
|
|
39
40
|
selectable: false,
|
|
40
41
|
rowSelection: "single",
|
|
41
42
|
},
|
|
43
|
+
// Storybook hangs otherwise
|
|
44
|
+
parameters: {
|
|
45
|
+
docs: {
|
|
46
|
+
source: {
|
|
47
|
+
type: "code",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
42
51
|
decorators: [
|
|
43
52
|
(Story) => (
|
|
44
53
|
<div style={{ maxWidth: 1024, height: 400, display: "flex", flexDirection: "column" }}>
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
GridContextProvider,
|
|
@@ -82,7 +85,7 @@ GridFormDropDownInteractions_.play = async ({ canvasElement }) => {
|
|
|
82
85
|
const enabledMenuOption = await getOption("Enabled");
|
|
83
86
|
expect(enabledMenuOption).toBeInTheDocument();
|
|
84
87
|
|
|
85
|
-
userEvent.click(enabledMenuOption);
|
|
88
|
+
await userEvent.click(enabledMenuOption);
|
|
86
89
|
expect(updateValue).toHaveBeenCalled();
|
|
87
90
|
expect(onSelectedItem).toHaveBeenCalled();
|
|
88
91
|
|
|
@@ -90,7 +93,7 @@ GridFormDropDownInteractions_.play = async ({ canvasElement }) => {
|
|
|
90
93
|
updateValue.mockClear();
|
|
91
94
|
onSelectedItem.mockClear();
|
|
92
95
|
const disabledMenuOption = await getOption("Disabled");
|
|
93
|
-
userEvent.click(disabledMenuOption);
|
|
96
|
+
await userEvent.click(disabledMenuOption);
|
|
94
97
|
expect(updateValue).not.toHaveBeenCalled();
|
|
95
98
|
expect(onSelectedItem).not.toHaveBeenCalled();
|
|
96
99
|
|
|
@@ -100,38 +103,38 @@ GridFormDropDownInteractions_.play = async ({ canvasElement }) => {
|
|
|
100
103
|
|
|
101
104
|
expect(canvas.queryByPlaceholderText("Text input")).not.toBeInTheDocument();
|
|
102
105
|
|
|
103
|
-
userEvent.click(subTextInput);
|
|
106
|
+
await userEvent.click(subTextInput);
|
|
104
107
|
const textInput = await canvas.findByPlaceholderText("Text input");
|
|
105
108
|
expect(textInput).toBeInTheDocument();
|
|
106
109
|
expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
|
|
107
110
|
|
|
108
|
-
userEvent.type(textInput, "Hello");
|
|
111
|
+
await userEvent.type(textInput, "Hello");
|
|
109
112
|
expect(await canvas.findByText("Press enter or tab to save")).toBeInTheDocument();
|
|
110
113
|
|
|
111
114
|
// Test tab to save
|
|
112
115
|
updateValue.mockClear();
|
|
113
|
-
userEvent.tab();
|
|
116
|
+
await userEvent.tab();
|
|
114
117
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
115
118
|
|
|
116
119
|
// Test shift+tab to save
|
|
117
120
|
updateValue.mockClear();
|
|
118
|
-
userEvent.tab({ shift: true });
|
|
121
|
+
await userEvent.tab({ shift: true });
|
|
119
122
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
120
123
|
|
|
121
124
|
// Test escape to not save
|
|
122
125
|
updateValue.mockClear();
|
|
123
|
-
userEvent.type(textInput, "{Escape}");
|
|
126
|
+
await userEvent.type(textInput, "{Escape}");
|
|
124
127
|
expect(updateValue).not.toHaveBeenCalled();
|
|
125
128
|
|
|
126
129
|
// Test invalid value doesn't save
|
|
127
130
|
updateValue.mockClear();
|
|
128
131
|
userEvent.clear(textInput);
|
|
129
|
-
userEvent.type(textInput, "{Enter}");
|
|
132
|
+
await userEvent.type(textInput, "{Enter}");
|
|
130
133
|
expect(updateValue).not.toHaveBeenCalled();
|
|
131
134
|
|
|
132
135
|
// Test filter
|
|
133
136
|
const filterText = await canvas.findByPlaceholderText("Filter...");
|
|
134
|
-
userEvent.type(filterText, "ena");
|
|
137
|
+
await userEvent.type(filterText, "ena");
|
|
135
138
|
expect(canvas.queryByText("Enabled")).toBeInTheDocument();
|
|
136
139
|
expect(canvas.queryByText("Disabled")).not.toBeInTheDocument();
|
|
137
140
|
expect(canvas.queryByText("Sub menu...")).not.toBeInTheDocument();
|
package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import { GridContextProvider, GridFormEditBearing, GridPopoverEditBearingCorrectionEditorParams } from "../../..";
|
|
11
14
|
|
|
@@ -53,39 +56,39 @@ GridFormEditBearingCorrectionInteractions_.play = async ({ canvasElement }) => {
|
|
|
53
56
|
|
|
54
57
|
// Test formatting a bearing
|
|
55
58
|
expect(inputField).toBeInTheDocument();
|
|
56
|
-
userEvent.type(inputField, "1.2345");
|
|
59
|
+
await userEvent.type(inputField, "1.2345");
|
|
57
60
|
expect(await canvas.findByText("+1° 23' 45\"")).toBeInTheDocument();
|
|
58
61
|
|
|
59
62
|
// Test enter to save
|
|
60
63
|
updateValue.mockClear();
|
|
61
|
-
userEvent.type(inputField, "{Enter}");
|
|
64
|
+
await userEvent.type(inputField, "{Enter}");
|
|
62
65
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 0); // 0 = Enter
|
|
63
66
|
|
|
64
67
|
// Test tab to save
|
|
65
68
|
updateValue.mockClear();
|
|
66
|
-
userEvent.tab();
|
|
69
|
+
await userEvent.tab();
|
|
67
70
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
68
71
|
|
|
69
72
|
// Test shift+tab to save
|
|
70
73
|
updateValue.mockClear();
|
|
71
|
-
userEvent.tab({ shift: true });
|
|
74
|
+
await userEvent.tab({ shift: true });
|
|
72
75
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
73
76
|
|
|
74
77
|
// Test escape not to save
|
|
75
78
|
updateValue.mockClear();
|
|
76
|
-
userEvent.type(inputField, "{Escape}");
|
|
79
|
+
await userEvent.type(inputField, "{Escape}");
|
|
77
80
|
expect(updateValue).not.toHaveBeenCalled();
|
|
78
81
|
|
|
79
82
|
// Test invalid value doesn't save
|
|
80
83
|
updateValue.mockClear();
|
|
81
|
-
userEvent.type(inputField, "xxx");
|
|
84
|
+
await userEvent.type(inputField, "xxx");
|
|
82
85
|
expect(await canvas.findByText("?")).toBeInTheDocument();
|
|
83
86
|
|
|
84
87
|
expect(canvas.getByText("Bearing must be a number in D.MMSSS format")).toBeInTheDocument();
|
|
85
|
-
userEvent.type(inputField, "{Enter}");
|
|
88
|
+
await userEvent.type(inputField, "{Enter}");
|
|
86
89
|
expect(updateValue).not.toHaveBeenCalled();
|
|
87
|
-
userEvent.tab();
|
|
90
|
+
await userEvent.tab();
|
|
88
91
|
expect(updateValue).not.toHaveBeenCalled();
|
|
89
|
-
userEvent.tab({ shift: true });
|
|
92
|
+
await userEvent.tab({ shift: true });
|
|
90
93
|
expect(updateValue).not.toHaveBeenCalled();
|
|
91
94
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import { GridContextProvider, GridFormEditBearing, GridPopoverEditBearingEditorParams } from "../../..";
|
|
11
14
|
|
|
@@ -53,38 +56,38 @@ GridFormEditBearingInteractions_.play = async ({ canvasElement }) => {
|
|
|
53
56
|
|
|
54
57
|
// Test formatting a bearing
|
|
55
58
|
expect(inputField).toBeInTheDocument();
|
|
56
|
-
userEvent.type(inputField, "1.2345");
|
|
59
|
+
await userEvent.type(inputField, "1.2345");
|
|
57
60
|
expect(await canvas.findByText("1° 23' 45\"")).toBeInTheDocument();
|
|
58
61
|
|
|
59
62
|
// Test enter to save
|
|
60
63
|
updateValue.mockClear();
|
|
61
|
-
userEvent.type(inputField, "{Enter}");
|
|
64
|
+
await userEvent.type(inputField, "{Enter}");
|
|
62
65
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 0); // 0 = Enter
|
|
63
66
|
|
|
64
67
|
// Test tab to save
|
|
65
68
|
updateValue.mockClear();
|
|
66
|
-
userEvent.tab();
|
|
69
|
+
await userEvent.tab();
|
|
67
70
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
68
71
|
|
|
69
72
|
// Test shift+tab to save
|
|
70
73
|
updateValue.mockClear();
|
|
71
|
-
userEvent.tab({ shift: true });
|
|
74
|
+
await userEvent.tab({ shift: true });
|
|
72
75
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
73
76
|
|
|
74
77
|
// Test escape not to save
|
|
75
78
|
updateValue.mockClear();
|
|
76
|
-
userEvent.type(inputField, "{Escape}");
|
|
79
|
+
await userEvent.type(inputField, "{Escape}");
|
|
77
80
|
expect(updateValue).not.toHaveBeenCalled();
|
|
78
81
|
|
|
79
82
|
// Test invalid value doesn't save
|
|
80
83
|
updateValue.mockClear();
|
|
81
|
-
userEvent.type(inputField, "xxx");
|
|
84
|
+
await userEvent.type(inputField, "xxx");
|
|
82
85
|
expect(await canvas.findByText("?")).toBeInTheDocument();
|
|
83
86
|
expect(canvas.getByText("Bearing must be a number in D.MMSSS format")).toBeInTheDocument();
|
|
84
|
-
userEvent.type(inputField, "{Enter}");
|
|
87
|
+
await userEvent.type(inputField, "{Enter}");
|
|
85
88
|
expect(updateValue).not.toHaveBeenCalled();
|
|
86
|
-
userEvent.tab();
|
|
89
|
+
await userEvent.tab();
|
|
87
90
|
expect(updateValue).not.toHaveBeenCalled();
|
|
88
|
-
userEvent.tab({ shift: true });
|
|
91
|
+
await userEvent.tab({ shift: true });
|
|
89
92
|
expect(updateValue).not.toHaveBeenCalled();
|
|
90
93
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, waitFor, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
GridContextProvider,
|
|
@@ -86,8 +89,8 @@ GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
|
|
|
86
89
|
const zeroMenuOption = await getOption(/Zero/);
|
|
87
90
|
expect(zeroMenuOption).toBeInTheDocument();
|
|
88
91
|
|
|
89
|
-
userEvent.click(zeroMenuOption);
|
|
90
|
-
userEvent.keyboard("{Tab}");
|
|
92
|
+
await userEvent.click(zeroMenuOption);
|
|
93
|
+
await userEvent.keyboard("{Tab}");
|
|
91
94
|
expect(updateValue).toHaveBeenCalled();
|
|
92
95
|
await waitFor(() => expect(onSave).toHaveBeenCalledWith({ selectedRows: [], addValues: [0], removeValues: [] }));
|
|
93
96
|
|
|
@@ -97,19 +100,19 @@ GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
|
|
|
97
100
|
};
|
|
98
101
|
|
|
99
102
|
// Test left/right arrow
|
|
100
|
-
userEvent.keyboard("{ArrowRight}");
|
|
103
|
+
await userEvent.keyboard("{ArrowRight}");
|
|
101
104
|
check("Three");
|
|
102
|
-
userEvent.keyboard("{ArrowRight}");
|
|
105
|
+
await userEvent.keyboard("{ArrowRight}");
|
|
103
106
|
check("Zero");
|
|
104
|
-
userEvent.keyboard("{ArrowLeft}");
|
|
107
|
+
await userEvent.keyboard("{ArrowLeft}");
|
|
105
108
|
check("Three");
|
|
106
|
-
userEvent.keyboard("{ArrowLeft}");
|
|
109
|
+
await userEvent.keyboard("{ArrowLeft}");
|
|
107
110
|
check("Zero");
|
|
108
111
|
|
|
109
112
|
// Test tab to save
|
|
110
113
|
updateValue.mockClear();
|
|
111
114
|
onSave.mockClear();
|
|
112
|
-
userEvent.tab();
|
|
115
|
+
await userEvent.tab();
|
|
113
116
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
114
117
|
expect(onSave).toHaveBeenCalledWith({
|
|
115
118
|
selectedRows: [],
|
|
@@ -120,7 +123,7 @@ GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
|
|
|
120
123
|
// Test shift+tab to save
|
|
121
124
|
updateValue.mockClear();
|
|
122
125
|
onSave.mockClear();
|
|
123
|
-
userEvent.tab({ shift: true });
|
|
126
|
+
await userEvent.tab({ shift: true });
|
|
124
127
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
125
128
|
expect(onSave).toHaveBeenCalled();
|
|
126
129
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
GridContextProvider,
|
|
@@ -92,8 +95,8 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
92
95
|
const zeroMenuOption = await getOption(/Zero/);
|
|
93
96
|
expect(zeroMenuOption).toBeInTheDocument();
|
|
94
97
|
|
|
95
|
-
userEvent.click(zeroMenuOption);
|
|
96
|
-
userEvent.keyboard("{Tab}");
|
|
98
|
+
await userEvent.click(zeroMenuOption);
|
|
99
|
+
await userEvent.keyboard("{Tab}");
|
|
97
100
|
expect(updateValue).toHaveBeenCalled();
|
|
98
101
|
expect(onSave).toHaveBeenCalledWith({ selectedOptions: [options[0]], selectedRows: [] });
|
|
99
102
|
|
|
@@ -103,19 +106,19 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
103
106
|
|
|
104
107
|
expect(canvas.queryByPlaceholderText("Text input")).not.toBeInTheDocument();
|
|
105
108
|
|
|
106
|
-
userEvent.click(subTextInput);
|
|
109
|
+
await userEvent.click(subTextInput);
|
|
107
110
|
const textInput = await canvas.findByPlaceholderText("Text input");
|
|
108
111
|
expect(textInput).toBeInTheDocument();
|
|
109
112
|
expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
|
|
110
113
|
|
|
111
|
-
userEvent.click(textInput);
|
|
112
|
-
userEvent.type(textInput, "Hello");
|
|
114
|
+
await userEvent.click(textInput);
|
|
115
|
+
await userEvent.type(textInput, "Hello");
|
|
113
116
|
expect(await canvas.findByText("Press enter or tab to save")).toBeInTheDocument();
|
|
114
117
|
|
|
115
118
|
// Test tab to save
|
|
116
119
|
updateValue.mockClear();
|
|
117
120
|
onSave.mockClear();
|
|
118
|
-
userEvent.tab();
|
|
121
|
+
await userEvent.tab();
|
|
119
122
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
120
123
|
expect(onSave).toHaveBeenCalledWith({
|
|
121
124
|
selectedRows: [],
|
|
@@ -128,14 +131,14 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
128
131
|
// Test shift+tab to save
|
|
129
132
|
updateValue.mockClear();
|
|
130
133
|
onSave.mockClear();
|
|
131
|
-
userEvent.tab({ shift: true });
|
|
134
|
+
await userEvent.tab({ shift: true });
|
|
132
135
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
133
136
|
expect(onSave).toHaveBeenCalled();
|
|
134
137
|
|
|
135
138
|
// Test escape to not save
|
|
136
139
|
updateValue.mockClear();
|
|
137
140
|
onSave.mockClear();
|
|
138
|
-
userEvent.type(textInput, "{Escape}");
|
|
141
|
+
await userEvent.type(textInput, "{Escape}");
|
|
139
142
|
expect(updateValue).not.toHaveBeenCalled();
|
|
140
143
|
expect(onSave).not.toHaveBeenCalled();
|
|
141
144
|
|
|
@@ -143,28 +146,28 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
143
146
|
updateValue.mockClear();
|
|
144
147
|
onSave.mockClear();
|
|
145
148
|
userEvent.clear(textInput);
|
|
146
|
-
userEvent.type(textInput, "{Enter}");
|
|
149
|
+
await userEvent.type(textInput, "{Enter}");
|
|
147
150
|
expect(updateValue).not.toHaveBeenCalled();
|
|
148
151
|
expect(onSave).not.toHaveBeenCalled();
|
|
149
152
|
|
|
150
153
|
// Test filter
|
|
151
154
|
const filterText = await canvas.findByPlaceholderText("Filter...");
|
|
152
|
-
userEvent.type(filterText, "o");
|
|
155
|
+
await userEvent.type(filterText, "o");
|
|
153
156
|
await wait(500);
|
|
154
157
|
expect(canvas.queryByText("One")).toBeInTheDocument();
|
|
155
158
|
expect(canvas.queryByText("Other")).toBeInTheDocument();
|
|
156
|
-
userEvent.type(filterText, "n");
|
|
159
|
+
await userEvent.type(filterText, "n");
|
|
157
160
|
expect(canvas.queryByText("One")).toBeInTheDocument();
|
|
158
161
|
expect(canvas.queryByText("Zero")).not.toBeInTheDocument();
|
|
159
162
|
expect(canvas.queryByText("Sub component")).not.toBeInTheDocument();
|
|
160
163
|
expect(canvas.queryByText("Other")).not.toBeInTheDocument();
|
|
161
164
|
|
|
162
|
-
userEvent.type(filterText, "x");
|
|
165
|
+
await userEvent.type(filterText, "x");
|
|
163
166
|
expect(canvas.queryByText("One")).not.toBeInTheDocument();
|
|
164
167
|
expect(canvas.queryByText("No Options")).toBeInTheDocument();
|
|
165
168
|
|
|
166
169
|
// Check enter works to add custom free-text
|
|
167
|
-
userEvent.type(filterText, "{Enter}");
|
|
170
|
+
await userEvent.type(filterText, "{Enter}");
|
|
168
171
|
expect(onSelectFilter).toHaveBeenCalledWith({
|
|
169
172
|
filter: "onx",
|
|
170
173
|
options: [
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
GridBaseRow,
|
|
@@ -90,13 +93,13 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
|
|
|
90
93
|
|
|
91
94
|
const enabledMenuOption = await getOption("Enabled");
|
|
92
95
|
expect(enabledMenuOption).toBeInTheDocument();
|
|
93
|
-
userEvent.click(enabledMenuOption);
|
|
96
|
+
await userEvent.click(enabledMenuOption);
|
|
94
97
|
expect(enabledAction).toHaveBeenCalled();
|
|
95
98
|
|
|
96
99
|
enabledAction.mockClear();
|
|
97
100
|
const disabledMenuOption = await getOption("Disabled");
|
|
98
101
|
expect(disabledMenuOption).toBeInTheDocument();
|
|
99
|
-
userEvent.click(disabledMenuOption);
|
|
102
|
+
await userEvent.click(disabledMenuOption);
|
|
100
103
|
expect(disabledAction).not.toHaveBeenCalled();
|
|
101
104
|
|
|
102
105
|
// Sub input tests
|
|
@@ -108,34 +111,34 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
|
|
|
108
111
|
expect(subTextArea).toBeInTheDocument();
|
|
109
112
|
expect(canvas.queryByPlaceholderText("Text area")).not.toBeInTheDocument();
|
|
110
113
|
|
|
111
|
-
userEvent.click(subTextInput);
|
|
114
|
+
await userEvent.click(subTextInput);
|
|
112
115
|
const textInput = await canvas.findByPlaceholderText("Text input");
|
|
113
116
|
expect(textInput).toBeInTheDocument();
|
|
114
117
|
expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
|
|
115
118
|
expect(canvas.queryByPlaceholderText("Text area")).not.toBeInTheDocument();
|
|
116
119
|
|
|
117
|
-
userEvent.type(textInput, "Hello");
|
|
120
|
+
await userEvent.type(textInput, "Hello");
|
|
118
121
|
expect(await canvas.findByText("Press enter or tab to save")).toBeInTheDocument();
|
|
119
122
|
|
|
120
123
|
// Test tab to save
|
|
121
124
|
updateValue.mockClear();
|
|
122
|
-
userEvent.tab();
|
|
125
|
+
await userEvent.tab();
|
|
123
126
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
124
127
|
|
|
125
128
|
// Test shift+tab to save
|
|
126
129
|
updateValue.mockClear();
|
|
127
|
-
userEvent.tab({ shift: true });
|
|
130
|
+
await userEvent.tab({ shift: true });
|
|
128
131
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
129
132
|
|
|
130
133
|
// Test escape to not save
|
|
131
134
|
updateValue.mockClear();
|
|
132
|
-
userEvent.type(textInput, "{Escape}");
|
|
135
|
+
await userEvent.type(textInput, "{Escape}");
|
|
133
136
|
expect(updateValue).not.toHaveBeenCalled();
|
|
134
137
|
|
|
135
138
|
// Test invalid value doesn't save
|
|
136
139
|
updateValue.mockClear();
|
|
137
140
|
userEvent.clear(textInput);
|
|
138
|
-
userEvent.type(textInput, "{Enter}");
|
|
141
|
+
await userEvent.type(textInput, "{Enter}");
|
|
139
142
|
expect(updateValue).not.toHaveBeenCalled();
|
|
140
143
|
|
|
141
144
|
// Sub text area tests
|
|
@@ -146,27 +149,27 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
|
|
|
146
149
|
expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
|
|
147
150
|
expect(canvas.queryByPlaceholderText("Text input")).not.toBeInTheDocument();
|
|
148
151
|
|
|
149
|
-
userEvent.type(textArea, "Hello");
|
|
152
|
+
await userEvent.type(textArea, "Hello");
|
|
150
153
|
expect(await canvas.findByText("Press tab to save")).toBeInTheDocument();
|
|
151
154
|
|
|
152
155
|
// Test tab to save
|
|
153
156
|
updateValue.mockClear();
|
|
154
|
-
userEvent.tab();
|
|
157
|
+
await userEvent.tab();
|
|
155
158
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
156
159
|
|
|
157
160
|
// Test shift+tab to save
|
|
158
161
|
updateValue.mockClear();
|
|
159
|
-
userEvent.tab({ shift: true });
|
|
162
|
+
await userEvent.tab({ shift: true });
|
|
160
163
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
161
164
|
|
|
162
165
|
// Test escape to not save
|
|
163
166
|
updateValue.mockClear();
|
|
164
|
-
userEvent.type(textArea, "{Escape}");
|
|
167
|
+
await userEvent.type(textArea, "{Escape}");
|
|
165
168
|
expect(updateValue).not.toHaveBeenCalled();
|
|
166
169
|
|
|
167
170
|
// Test invalid value doesn't save
|
|
168
171
|
updateValue.mockClear();
|
|
169
172
|
userEvent.clear(textArea);
|
|
170
|
-
userEvent.type(textArea, "{Enter}");
|
|
173
|
+
await userEvent.type(textArea, "{Enter}");
|
|
171
174
|
expect(updateValue).not.toHaveBeenCalled();
|
|
172
175
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import { GridContextProvider, GridFormTextArea } from "../../..";
|
|
11
14
|
|
|
@@ -47,23 +50,23 @@ GridFormTextAreaInteractions_.play = async ({ canvasElement }) => {
|
|
|
47
50
|
expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
|
|
48
51
|
|
|
49
52
|
const inputField = canvas.getByPlaceholderText("Type here");
|
|
50
|
-
userEvent.type(inputField, "Hello");
|
|
53
|
+
await userEvent.type(inputField, "Hello");
|
|
51
54
|
|
|
52
55
|
expect(await canvas.findByText("Press tab to save")).toBeInTheDocument();
|
|
53
56
|
|
|
54
57
|
// Test tab to save
|
|
55
58
|
updateValue.mockClear();
|
|
56
|
-
userEvent.tab();
|
|
59
|
+
await userEvent.tab();
|
|
57
60
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
58
61
|
|
|
59
62
|
// Test shift+tab to save
|
|
60
63
|
updateValue.mockClear();
|
|
61
|
-
userEvent.tab({ shift: true });
|
|
64
|
+
await userEvent.tab({ shift: true });
|
|
62
65
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
63
66
|
|
|
64
67
|
// Test escape not to save
|
|
65
68
|
updateValue.mockClear();
|
|
66
|
-
userEvent.type(inputField, "{Escape}");
|
|
69
|
+
await userEvent.type(inputField, "{Escape}");
|
|
67
70
|
expect(updateValue).not.toHaveBeenCalled();
|
|
68
71
|
|
|
69
72
|
// Test invalid value doesn't save
|
|
@@ -71,8 +74,8 @@ GridFormTextAreaInteractions_.play = async ({ canvasElement }) => {
|
|
|
71
74
|
userEvent.clear(inputField);
|
|
72
75
|
|
|
73
76
|
expect(canvas.getByText("Must not be empty")).toBeInTheDocument();
|
|
74
|
-
userEvent.tab();
|
|
77
|
+
await userEvent.tab();
|
|
75
78
|
expect(updateValue).not.toHaveBeenCalled();
|
|
76
|
-
userEvent.tab({ shift: true });
|
|
79
|
+
await userEvent.tab({ shift: true });
|
|
77
80
|
expect(updateValue).not.toHaveBeenCalled();
|
|
78
81
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { expect, jest } from "@storybook/jest";
|
|
2
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
7
|
import { userEvent, within } from "@storybook/testing-library";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
|
|
|
5
9
|
import { useRef } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import { GridContextProvider, GridFormTextInput } from "../../..";
|
|
11
14
|
|
|
@@ -47,28 +50,28 @@ GridFormTextInputInteractions_.play = async ({ canvasElement }) => {
|
|
|
47
50
|
expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
|
|
48
51
|
|
|
49
52
|
const inputField = canvas.getByPlaceholderText("Type here");
|
|
50
|
-
userEvent.type(inputField, "Hello");
|
|
53
|
+
await userEvent.type(inputField, "Hello");
|
|
51
54
|
|
|
52
55
|
expect(canvas.getByText("Press enter or tab to save")).toBeInTheDocument();
|
|
53
56
|
|
|
54
57
|
// Test enter to save
|
|
55
58
|
updateValue.mockClear();
|
|
56
|
-
userEvent.type(inputField, "{Enter}");
|
|
59
|
+
await userEvent.type(inputField, "{Enter}");
|
|
57
60
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 0); // 0 = Enter
|
|
58
61
|
|
|
59
62
|
// Test tab to save
|
|
60
63
|
updateValue.mockClear();
|
|
61
|
-
userEvent.tab();
|
|
64
|
+
await userEvent.tab();
|
|
62
65
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
|
|
63
66
|
|
|
64
67
|
// Test shift+tab to save
|
|
65
68
|
updateValue.mockClear();
|
|
66
|
-
userEvent.tab({ shift: true });
|
|
69
|
+
await userEvent.tab({ shift: true });
|
|
67
70
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
|
|
68
71
|
|
|
69
72
|
// Test escape not to save
|
|
70
73
|
updateValue.mockClear();
|
|
71
|
-
userEvent.type(inputField, "{Escape}");
|
|
74
|
+
await userEvent.type(inputField, "{Escape}");
|
|
72
75
|
expect(updateValue).not.toHaveBeenCalled();
|
|
73
76
|
|
|
74
77
|
// Test invalid value doesn't save
|
|
@@ -76,10 +79,10 @@ GridFormTextInputInteractions_.play = async ({ canvasElement }) => {
|
|
|
76
79
|
userEvent.clear(inputField);
|
|
77
80
|
|
|
78
81
|
expect(canvas.getByText("Must not be empty")).toBeInTheDocument();
|
|
79
|
-
userEvent.type(inputField, "{Enter}");
|
|
82
|
+
await userEvent.type(inputField, "{Enter}");
|
|
80
83
|
expect(updateValue).not.toHaveBeenCalled();
|
|
81
|
-
userEvent.tab();
|
|
84
|
+
await userEvent.tab();
|
|
82
85
|
expect(updateValue).not.toHaveBeenCalled();
|
|
83
|
-
userEvent.tab({ shift: true });
|
|
86
|
+
await userEvent.tab({ shift: true });
|
|
84
87
|
expect(updateValue).not.toHaveBeenCalled();
|
|
85
88
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
3
7
|
import { useRef } from "react";
|
|
4
8
|
|
|
5
9
|
import "@linzjs/lui/dist/fonts";
|
|
6
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
7
10
|
|
|
8
11
|
import { GridBaseRow, GridContextProvider, GridFormDropDown, GridFormDropDownProps, MenuHeaderItem } from "../../..";
|
|
9
12
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import "../../../react-menu3/styles/index.scss";
|
|
2
|
+
import "../../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
3
7
|
import { useRef } from "react";
|
|
4
8
|
|
|
5
9
|
import "@linzjs/lui/dist/fonts";
|
|
6
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
7
10
|
|
|
8
11
|
import {
|
|
9
12
|
GridContextProvider,
|