@linzjs/step-ag-grid 23.0.0 → 24.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/ComponentLoadingWrapper.d.ts +1 -1
- package/dist/src/components/Grid.d.ts +17 -17
- package/dist/src/components/GridCell.d.ts +9 -9
- package/dist/src/components/GridCellFiller.d.ts +2 -2
- package/dist/src/components/GridCellMultiEditor.d.ts +6 -6
- package/dist/src/components/GridCellMultiSelectClassRules.d.ts +1 -1
- package/dist/src/components/GridIcon.d.ts +2 -2
- package/dist/src/components/GridNoRowsOverlay.d.ts +1 -1
- package/dist/src/components/GridPopoverHook.d.ts +2 -2
- package/dist/src/components/GridWrapper.d.ts +1 -1
- package/dist/src/components/PostSortRowsHook.d.ts +1 -1
- package/dist/src/components/clickInputWhenContainingCellClicked.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +5 -5
- package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterHeaderIconButton.d.ts +2 -2
- package/dist/src/components/gridFilter/GridFilters.d.ts +1 -1
- package/dist/src/components/gridFilter/index.d.ts +7 -7
- package/dist/src/components/gridFilter/useGridFilter.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +8 -8
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormMessage.d.ts +3 -3
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormMultiSelectGrid.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +5 -5
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +3 -3
- package/dist/src/components/gridForm/index.d.ts +10 -10
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -1
- package/dist/src/components/gridHeader/index.d.ts +1 -1
- package/dist/src/components/gridHook/index.d.ts +1 -1
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridButton.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridEditBoolean.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/index.d.ts +11 -11
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +5 -5
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -1
- package/dist/src/components/gridRender/index.d.ts +2 -2
- package/dist/src/components/gridUtil.d.ts +1 -1
- package/dist/src/components/index.d.ts +19 -19
- package/dist/src/contexts/GridContext.d.ts +4 -4
- package/dist/src/contexts/GridContextProvider.d.ts +3 -3
- package/dist/src/contexts/GridPopoverContext.d.ts +3 -3
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +4 -4
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +1 -1
- package/dist/src/index.d.ts +17 -17
- package/dist/src/lui/ActionButton.d.ts +9 -9
- package/dist/src/lui/FormError.d.ts +2 -2
- package/dist/src/lui/TextAreaInput.d.ts +1 -1
- package/dist/src/lui/TextInputFormatted.d.ts +2 -2
- package/dist/src/lui/reactUtils.d.ts +1 -1
- package/dist/src/lui/stateDeferredHook.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +2 -2
- package/dist/src/react-menu3/components/FocusableItem.d.ts +3 -3
- package/dist/src/react-menu3/components/Menu.d.ts +3 -3
- package/dist/src/react-menu3/components/MenuButton.d.ts +2 -2
- 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 +3 -3
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/SubMenu.d.ts +5 -5
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +2 -2
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/SettingsContext.d.ts +2 -2
- package/dist/src/react-menu3/hooks/index.d.ts +9 -9
- package/dist/src/react-menu3/hooks/useBEM.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItemEffect.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItemState.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItems.d.ts +2 -2
- package/dist/src/react-menu3/hooks/useMenuChange.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +1 -1
- package/dist/src/react-menu3/index.d.ts +11 -11
- package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/index.d.ts +3 -3
- package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +4 -4
- package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +5 -5
- package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +2 -2
- package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +5 -5
- package/dist/src/react-menu3/style-utils/index.d.ts +1 -1
- package/dist/src/react-menu3/types.d.ts +15 -15
- package/dist/src/react-menu3/utils/constants.d.ts +1 -1
- package/dist/src/react-menu3/utils/index.d.ts +3 -3
- package/dist/src/react-menu3/utils/utils.d.ts +5 -5
- package/dist/src/react-menu3/utils/withHovering.d.ts +1 -1
- package/dist/src/utils/testQuick.d.ts +2 -2
- package/dist/src/utils/testUtil.d.ts +2 -2
- package/dist/src/utils/textValidator.d.ts +2 -2
- package/dist/step-ag-grid.cjs.js +966 -952
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +968 -954
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +26 -41
- package/src/components/ComponentLoadingWrapper.tsx +5 -6
- package/src/components/Grid.tsx +85 -83
- package/src/components/GridCell.test.tsx +15 -15
- package/src/components/GridCell.tsx +46 -44
- package/src/components/GridCellFiller.tsx +5 -4
- package/src/components/GridCellMultiEditor.tsx +7 -7
- package/src/components/GridCellMultiSelectClassRules.tsx +3 -3
- package/src/components/GridIcon.tsx +6 -7
- package/src/components/GridLoadableCell.tsx +2 -2
- package/src/components/GridNoRowsOverlay.tsx +8 -8
- package/src/components/GridPopoverHook.tsx +16 -16
- package/src/components/GridWrapper.tsx +2 -2
- package/src/components/PostSortRowsHook.ts +11 -11
- package/src/components/clickInputWhenContainingCellClicked.tsx +5 -5
- package/src/components/gridFilter/GridFilterButtons.tsx +8 -9
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +25 -26
- package/src/components/gridFilter/GridFilterDownloadCsvButton.tsx +12 -13
- package/src/components/gridFilter/GridFilterHeaderIconButton.tsx +9 -10
- package/src/components/gridFilter/GridFilterQuick.tsx +6 -6
- package/src/components/gridFilter/GridFilters.tsx +1 -1
- package/src/components/gridFilter/index.ts +7 -7
- package/src/components/gridFilter/useGridFilter.ts +3 -3
- package/src/components/gridForm/GridFormDropDown.tsx +56 -52
- package/src/components/gridForm/GridFormEditBearing.tsx +12 -12
- package/src/components/gridForm/GridFormMessage.tsx +10 -10
- package/src/components/gridForm/GridFormMultiSelect.tsx +53 -51
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +25 -26
- package/src/components/gridForm/GridFormPopoverMenu.tsx +32 -29
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +10 -10
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +8 -8
- package/src/components/gridForm/GridFormTextArea.tsx +11 -11
- package/src/components/gridForm/GridFormTextInput.tsx +11 -11
- package/src/components/gridForm/index.ts +10 -10
- package/src/components/gridHeader/GridHeaderSelect.tsx +9 -9
- package/src/components/gridHeader/index.ts +1 -1
- package/src/components/gridHook/index.ts +1 -1
- package/src/components/gridHook/useGridContextMenu.tsx +7 -7
- package/src/components/gridPopoverEdit/GridButton.tsx +13 -12
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +19 -18
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +7 -6
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.ts +7 -6
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +9 -9
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +8 -7
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +6 -6
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +4 -4
- package/src/components/gridPopoverEdit/index.ts +11 -11
- package/src/components/gridRender/GridRenderGenericCell.tsx +5 -5
- package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +8 -9
- package/src/components/gridRender/index.ts +2 -2
- package/src/components/gridUtil.ts +3 -3
- package/src/components/index.ts +19 -19
- package/src/contexts/GridContext.tsx +52 -46
- package/src/contexts/GridContextProvider.test.tsx +14 -14
- package/src/contexts/GridContextProvider.tsx +42 -41
- package/src/contexts/GridPopoverContext.tsx +10 -7
- package/src/contexts/GridPopoverContextProvider.tsx +12 -10
- package/src/contexts/GridSubComponentContext.ts +6 -5
- package/src/contexts/GridUpdatingContext.tsx +5 -4
- package/src/contexts/GridUpdatingContextProvider.tsx +3 -3
- package/src/index.ts +17 -21
- package/src/lui/ActionButton.tsx +42 -41
- package/src/lui/FormError.tsx +4 -4
- package/src/lui/TextAreaInput.tsx +9 -9
- package/src/lui/TextInputFormatted.tsx +11 -11
- package/src/lui/reactUtils.test.tsx +8 -8
- package/src/lui/reactUtils.tsx +2 -2
- package/src/lui/stateDeferredHook.tsx +3 -5
- package/src/lui/timeoutHook.test.tsx +5 -5
- package/src/lui/timeoutHook.tsx +1 -1
- package/src/react-app-env.d.ts +1 -1
- package/src/react-menu3/components/ControlledMenu.tsx +48 -48
- package/src/react-menu3/components/FocusableItem.tsx +7 -7
- package/src/react-menu3/components/Menu.tsx +11 -11
- package/src/react-menu3/components/MenuButton.tsx +4 -4
- package/src/react-menu3/components/MenuDivider.tsx +4 -4
- package/src/react-menu3/components/MenuGroup.tsx +5 -5
- package/src/react-menu3/components/MenuHeader.tsx +4 -4
- package/src/react-menu3/components/MenuItem.tsx +14 -14
- package/src/react-menu3/components/MenuList.tsx +55 -55
- package/src/react-menu3/components/MenuRadioGroup.tsx +7 -7
- package/src/react-menu3/components/SubMenu.tsx +24 -24
- package/src/react-menu3/contexts/EventHandlersContext.ts +2 -2
- package/src/react-menu3/contexts/HoverItemContext.ts +1 -1
- package/src/react-menu3/contexts/ItemSettingsContext.ts +1 -1
- package/src/react-menu3/contexts/MenuListContext.ts +2 -2
- package/src/react-menu3/contexts/MenuListItemContext.ts +2 -2
- package/src/react-menu3/contexts/RadioGroupContext.ts +2 -2
- package/src/react-menu3/contexts/SettingsContext.ts +2 -2
- package/src/react-menu3/hooks/index.ts +9 -9
- package/src/react-menu3/hooks/useBEM.ts +4 -4
- package/src/react-menu3/hooks/useCombinedRef.ts +2 -2
- package/src/react-menu3/hooks/useIsomorphicLayoutEffect.ts +4 -4
- package/src/react-menu3/hooks/useItemEffect.ts +3 -3
- package/src/react-menu3/hooks/useItemState.ts +5 -5
- package/src/react-menu3/hooks/useItems.ts +8 -8
- package/src/react-menu3/hooks/useMenuChange.ts +3 -3
- package/src/react-menu3/hooks/useMenuState.ts +5 -5
- package/src/react-menu3/hooks/useMenuStateAndFocus.ts +4 -4
- package/src/react-menu3/index.ts +11 -11
- package/src/react-menu3/positionUtils/getPositionHelpers.ts +2 -2
- package/src/react-menu3/positionUtils/index.ts +3 -3
- package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +1 -1
- package/src/react-menu3/positionUtils/placeArrowVertical.ts +1 -1
- package/src/react-menu3/positionUtils/placeLeftorRight.ts +13 -13
- package/src/react-menu3/positionUtils/placeToporBottom.ts +15 -15
- package/src/react-menu3/positionUtils/positionContextMenu.ts +4 -4
- package/src/react-menu3/positionUtils/positionMenu.ts +14 -14
- package/src/react-menu3/style-utils/index.ts +24 -24
- package/src/react-menu3/types.ts +15 -15
- package/src/react-menu3/utils/constants.ts +33 -33
- package/src/react-menu3/utils/index.ts +3 -4
- package/src/react-menu3/utils/propTypes2.ts +10 -10
- package/src/react-menu3/utils/utils.ts +14 -14
- package/src/react-menu3/utils/withHovering.tsx +3 -3
- package/src/stories/components/ActionButton.stories.tsx +23 -24
- package/src/stories/grid/FormTest.tsx +15 -16
- package/src/stories/grid/GridDragRow.stories.tsx +33 -34
- package/src/stories/grid/GridFilterButtons.stories.tsx +32 -33
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +9 -10
- package/src/stories/grid/GridNonEditableRow.stories.tsx +40 -41
- package/src/stories/grid/GridPinnedRow.stories.tsx +25 -26
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +33 -32
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +21 -22
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +18 -19
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +50 -49
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +25 -26
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +93 -94
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +62 -63
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +28 -28
- package/src/stories/grid/GridReadOnly.stories.tsx +66 -67
- package/src/stories/grid/GridViewList.stories.tsx +37 -38
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +37 -38
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +25 -26
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +25 -26
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +31 -31
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +47 -48
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +44 -45
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +19 -20
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +21 -22
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +40 -41
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +14 -15
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +14 -15
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +10 -11
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +20 -21
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +16 -17
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +13 -14
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +13 -14
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +68 -71
- package/src/stories/react-menu/ReactMenu.stories.tsx +26 -26
- package/src/utils/bearing.test.ts +44 -44
- package/src/utils/bearing.ts +20 -20
- package/src/utils/deferredPromise.ts +1 -1
- package/src/utils/storybookTestUtil.ts +2 -2
- package/src/utils/testQuick.ts +15 -14
- package/src/utils/testUtil.ts +31 -36
- package/src/utils/textMatcher.test.ts +9 -9
- package/src/utils/textMatcher.ts +8 -8
- package/src/utils/textValidator.test.ts +56 -56
- package/src/utils/textValidator.ts +11 -11
- package/src/utils/util.test.ts +20 -20
- package/src/utils/util.ts +7 -7
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import '../../../react-menu3/styles/index.scss';
|
|
2
|
+
import '../../../styles/index.scss';
|
|
3
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
4
|
+
import '@linzjs/lui/dist/fonts';
|
|
4
5
|
|
|
5
|
-
import { StoryFn } from
|
|
6
|
-
import { expect, fn, userEvent, within } from
|
|
7
|
-
import { GridPopoverContext } from
|
|
8
|
-
import { useRef } from
|
|
9
|
-
|
|
10
|
-
import "@linzjs/lui/dist/fonts";
|
|
6
|
+
import { StoryFn } from '@storybook/react';
|
|
7
|
+
import { expect, fn, userEvent, within } from '@storybook/test';
|
|
8
|
+
import { GridPopoverContext } from 'contexts/GridPopoverContext';
|
|
9
|
+
import { useRef } from 'react';
|
|
11
10
|
|
|
12
11
|
import {
|
|
13
12
|
GridContext,
|
|
@@ -16,10 +15,10 @@ import {
|
|
|
16
15
|
GridFormSubComponentTextInput,
|
|
17
16
|
MultiSelectOption,
|
|
18
17
|
wait,
|
|
19
|
-
} from
|
|
18
|
+
} from '../../..';
|
|
20
19
|
|
|
21
20
|
export default {
|
|
22
|
-
title:
|
|
21
|
+
title: 'GridForm / Interactions',
|
|
23
22
|
component: GridFormMultiSelect,
|
|
24
23
|
args: {},
|
|
25
24
|
};
|
|
@@ -32,28 +31,28 @@ const onSelectFilter = fn();
|
|
|
32
31
|
let options: MultiSelectOption[] = [];
|
|
33
32
|
const Template: StoryFn<typeof GridFormMultiSelect> = (props: GridFormMultiSelectProps<any>) => {
|
|
34
33
|
options = [
|
|
35
|
-
{ label:
|
|
36
|
-
{ label:
|
|
34
|
+
{ label: 'Zero', value: 0 },
|
|
35
|
+
{ label: 'One', value: 1 },
|
|
37
36
|
{
|
|
38
|
-
label:
|
|
37
|
+
label: 'Sub component',
|
|
39
38
|
value: 2,
|
|
40
39
|
subComponent: () => (
|
|
41
|
-
<GridFormSubComponentTextInput placeholder={
|
|
40
|
+
<GridFormSubComponentTextInput placeholder={'Text input'} maxLength={5} required defaultValue={''} />
|
|
42
41
|
),
|
|
43
42
|
},
|
|
44
|
-
{ label:
|
|
43
|
+
{ label: 'Other', value: 3 },
|
|
45
44
|
];
|
|
46
45
|
const config: GridFormMultiSelectProps<any> = {
|
|
47
46
|
filtered: true,
|
|
48
47
|
onSelectFilter,
|
|
49
|
-
filterHelpText:
|
|
48
|
+
filterHelpText: 'Press enter to add free-text',
|
|
50
49
|
onSave,
|
|
51
50
|
options,
|
|
52
51
|
};
|
|
53
52
|
const anchorRef = useRef<HTMLHeadingElement>(null);
|
|
54
53
|
|
|
55
54
|
return (
|
|
56
|
-
<div className={
|
|
55
|
+
<div className={'react-menu-inline-test'}>
|
|
57
56
|
<GridContext.Provider
|
|
58
57
|
value={
|
|
59
58
|
{
|
|
@@ -67,10 +66,10 @@ const Template: StoryFn<typeof GridFormMultiSelect> = (props: GridFormMultiSelec
|
|
|
67
66
|
value={{
|
|
68
67
|
anchorRef,
|
|
69
68
|
updateValue,
|
|
70
|
-
data: { value:
|
|
71
|
-
colId:
|
|
72
|
-
value:
|
|
73
|
-
field:
|
|
69
|
+
data: { value: '' },
|
|
70
|
+
colId: '',
|
|
71
|
+
value: '',
|
|
72
|
+
field: 'value',
|
|
74
73
|
selectedRows: [],
|
|
75
74
|
saving: false,
|
|
76
75
|
setSaving: () => {},
|
|
@@ -92,14 +91,14 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
92
91
|
|
|
93
92
|
const canvas = within(canvasElement);
|
|
94
93
|
|
|
95
|
-
const getOption = (name: RegExp | string) => canvas.findByRole(
|
|
94
|
+
const getOption = (name: RegExp | string) => canvas.findByRole('menuitem', { name });
|
|
96
95
|
|
|
97
96
|
// Check enabled menu handles click
|
|
98
97
|
const zeroMenuOption = await getOption(/Zero/);
|
|
99
98
|
expect(zeroMenuOption).toBeInTheDocument();
|
|
100
99
|
|
|
101
100
|
await userEvent.click(zeroMenuOption);
|
|
102
|
-
await userEvent.keyboard(
|
|
101
|
+
await userEvent.keyboard('{Tab}');
|
|
103
102
|
expect(updateValue).toHaveBeenCalled();
|
|
104
103
|
expect(onSave).toHaveBeenCalledWith({ selectedOptions: [options[0]], selectedRows: [] });
|
|
105
104
|
|
|
@@ -107,16 +106,16 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
107
106
|
const subTextInput = await getOption(/Sub component/);
|
|
108
107
|
expect(subTextInput).toBeInTheDocument();
|
|
109
108
|
|
|
110
|
-
expect(canvas.queryByPlaceholderText(
|
|
109
|
+
expect(canvas.queryByPlaceholderText('Text input')).not.toBeInTheDocument();
|
|
111
110
|
|
|
112
111
|
await userEvent.click(subTextInput);
|
|
113
|
-
const textInput = await canvas.findByPlaceholderText(
|
|
112
|
+
const textInput = await canvas.findByPlaceholderText('Text input');
|
|
114
113
|
expect(textInput).toBeInTheDocument();
|
|
115
|
-
expect(await canvas.findByText(
|
|
114
|
+
expect(await canvas.findByText('Must not be empty')).toBeInTheDocument();
|
|
116
115
|
|
|
117
116
|
// textInput should be autofocus
|
|
118
|
-
await userEvent.type(textInput,
|
|
119
|
-
expect(await canvas.findByText(
|
|
117
|
+
await userEvent.type(textInput, 'Hello');
|
|
118
|
+
expect(await canvas.findByText('Press enter or tab to save')).toBeInTheDocument();
|
|
120
119
|
|
|
121
120
|
// Test tab to save
|
|
122
121
|
updateValue.mockClear();
|
|
@@ -126,8 +125,8 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
126
125
|
expect(onSave).toHaveBeenCalledWith({
|
|
127
126
|
selectedRows: [],
|
|
128
127
|
selectedOptions: [
|
|
129
|
-
{ label:
|
|
130
|
-
{ label:
|
|
128
|
+
{ label: 'Zero', value: 0, checked: true },
|
|
129
|
+
{ label: 'Sub component', value: 2, checked: true, subValue: 'Hello', subComponent: expect.anything() },
|
|
131
130
|
],
|
|
132
131
|
});
|
|
133
132
|
|
|
@@ -141,7 +140,7 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
141
140
|
// Test escape to not save
|
|
142
141
|
updateValue.mockClear();
|
|
143
142
|
onSave.mockClear();
|
|
144
|
-
await userEvent.type(textInput,
|
|
143
|
+
await userEvent.type(textInput, '{Escape}');
|
|
145
144
|
expect(updateValue).not.toHaveBeenCalled();
|
|
146
145
|
expect(onSave).not.toHaveBeenCalled();
|
|
147
146
|
|
|
@@ -149,30 +148,30 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
|
|
|
149
148
|
updateValue.mockClear();
|
|
150
149
|
onSave.mockClear();
|
|
151
150
|
await userEvent.clear(textInput);
|
|
152
|
-
await userEvent.type(textInput,
|
|
151
|
+
await userEvent.type(textInput, '{Enter}');
|
|
153
152
|
expect(updateValue).not.toHaveBeenCalled();
|
|
154
153
|
expect(onSave).not.toHaveBeenCalled();
|
|
155
154
|
|
|
156
155
|
// Test filter
|
|
157
|
-
const filterText = await canvas.findByPlaceholderText(
|
|
158
|
-
await userEvent.type(filterText,
|
|
156
|
+
const filterText = await canvas.findByPlaceholderText('Filter...');
|
|
157
|
+
await userEvent.type(filterText, 'o');
|
|
159
158
|
await wait(500);
|
|
160
|
-
expect(canvas.queryByText(
|
|
161
|
-
expect(canvas.queryByText(
|
|
162
|
-
await userEvent.type(filterText,
|
|
163
|
-
expect(canvas.queryByText(
|
|
164
|
-
expect(canvas.queryByText(
|
|
165
|
-
expect(canvas.queryByText(
|
|
166
|
-
expect(canvas.queryByText(
|
|
167
|
-
|
|
168
|
-
await userEvent.type(filterText,
|
|
169
|
-
expect(canvas.queryByText(
|
|
170
|
-
expect(canvas.queryByText(
|
|
159
|
+
expect(canvas.queryByText('One')).toBeInTheDocument();
|
|
160
|
+
expect(canvas.queryByText('Other')).toBeInTheDocument();
|
|
161
|
+
await userEvent.type(filterText, 'n');
|
|
162
|
+
expect(canvas.queryByText('One')).toBeInTheDocument();
|
|
163
|
+
expect(canvas.queryByText('Zero')).not.toBeInTheDocument();
|
|
164
|
+
expect(canvas.queryByText('Sub component')).not.toBeInTheDocument();
|
|
165
|
+
expect(canvas.queryByText('Other')).not.toBeInTheDocument();
|
|
166
|
+
|
|
167
|
+
await userEvent.type(filterText, 'x');
|
|
168
|
+
expect(canvas.queryByText('One')).not.toBeInTheDocument();
|
|
169
|
+
expect(canvas.queryByText('No Options')).toBeInTheDocument();
|
|
171
170
|
|
|
172
171
|
// Check enter works to add custom free-text
|
|
173
|
-
await userEvent.type(filterText,
|
|
172
|
+
await userEvent.type(filterText, '{Enter}');
|
|
174
173
|
expect(onSelectFilter).toHaveBeenCalledWith({
|
|
175
|
-
filter:
|
|
174
|
+
filter: 'onx',
|
|
176
175
|
options: [
|
|
177
176
|
{
|
|
178
177
|
...options[0],
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import '../../../react-menu3/styles/index.scss';
|
|
2
|
+
import '../../../styles/index.scss';
|
|
3
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
4
|
+
import '@linzjs/lui/dist/fonts';
|
|
4
5
|
|
|
5
|
-
import { StoryFn } from
|
|
6
|
-
import * as test from
|
|
7
|
-
import { expect, userEvent, within } from
|
|
8
|
-
import { GridPopoverContext } from
|
|
9
|
-
import { useRef } from
|
|
10
|
-
|
|
11
|
-
import "@linzjs/lui/dist/fonts";
|
|
6
|
+
import { StoryFn } from '@storybook/react';
|
|
7
|
+
import * as test from '@storybook/test';
|
|
8
|
+
import { expect, userEvent, within } from '@storybook/test';
|
|
9
|
+
import { GridPopoverContext } from 'contexts/GridPopoverContext';
|
|
10
|
+
import { useRef } from 'react';
|
|
12
11
|
|
|
13
12
|
import {
|
|
14
13
|
GridBaseRow,
|
|
@@ -19,10 +18,10 @@ import {
|
|
|
19
18
|
GridFormSubComponentTextInput,
|
|
20
19
|
PopoutMenuSeparator,
|
|
21
20
|
SelectedMenuOptionResult,
|
|
22
|
-
} from
|
|
21
|
+
} from '../../..';
|
|
23
22
|
|
|
24
23
|
export default {
|
|
25
|
-
title:
|
|
24
|
+
title: 'GridForm / Interactions',
|
|
26
25
|
component: GridFormPopoverMenu,
|
|
27
26
|
args: {},
|
|
28
27
|
};
|
|
@@ -43,7 +42,7 @@ const Template: StoryFn<typeof GridFormPopoverMenu> = (props: GridFormPopoverMen
|
|
|
43
42
|
const anchorRef = useRef<HTMLHeadingElement>(null);
|
|
44
43
|
|
|
45
44
|
return (
|
|
46
|
-
<div className={
|
|
45
|
+
<div className={'react-menu-inline-test'}>
|
|
47
46
|
<GridContext.Provider
|
|
48
47
|
value={
|
|
49
48
|
{
|
|
@@ -58,9 +57,9 @@ const Template: StoryFn<typeof GridFormPopoverMenu> = (props: GridFormPopoverMen
|
|
|
58
57
|
anchorRef,
|
|
59
58
|
value: null,
|
|
60
59
|
updateValue,
|
|
61
|
-
data: { value:
|
|
62
|
-
colId:
|
|
63
|
-
field:
|
|
60
|
+
data: { value: '' },
|
|
61
|
+
colId: '',
|
|
62
|
+
field: 'value',
|
|
64
63
|
selectedRows: [],
|
|
65
64
|
saving: false,
|
|
66
65
|
setSaving: () => {},
|
|
@@ -69,25 +68,25 @@ const Template: StoryFn<typeof GridFormPopoverMenu> = (props: GridFormPopoverMen
|
|
|
69
68
|
>
|
|
70
69
|
<GridFormPopoverMenu
|
|
71
70
|
{...props}
|
|
72
|
-
options={
|
|
73
|
-
{ label:
|
|
71
|
+
options={() => [
|
|
72
|
+
{ label: 'Enabled', value: 1, action: enabledAction },
|
|
74
73
|
PopoutMenuSeparator,
|
|
75
|
-
{ label:
|
|
74
|
+
{ label: 'Disabled', value: 0, disabled: true, action: disabledAction },
|
|
76
75
|
{
|
|
77
|
-
label:
|
|
76
|
+
label: 'Sub text input',
|
|
78
77
|
value: 0,
|
|
79
78
|
subComponent: () => (
|
|
80
|
-
<GridFormSubComponentTextInput placeholder={
|
|
79
|
+
<GridFormSubComponentTextInput placeholder={'Text input'} maxLength={5} required defaultValue={''} />
|
|
81
80
|
),
|
|
82
81
|
},
|
|
83
82
|
{
|
|
84
|
-
label:
|
|
83
|
+
label: 'Sub text area',
|
|
85
84
|
value: 0,
|
|
86
85
|
subComponent: () => (
|
|
87
|
-
<GridFormSubComponentTextArea placeholder={
|
|
86
|
+
<GridFormSubComponentTextArea placeholder={'Text area'} maxLength={5} required defaultValue={''} />
|
|
88
87
|
),
|
|
89
88
|
},
|
|
90
|
-
{ label:
|
|
89
|
+
{ label: 'ERROR! this should be hidden', value: 3, hidden: true },
|
|
91
90
|
]}
|
|
92
91
|
/>
|
|
93
92
|
</GridPopoverContext.Provider>
|
|
@@ -100,36 +99,36 @@ export const GridFormPopoverMenuInteractions_: typeof Template = Template.bind({
|
|
|
100
99
|
GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
|
|
101
100
|
const canvas = within(canvasElement);
|
|
102
101
|
|
|
103
|
-
const getOption = (name: string) => canvas.findByRole(
|
|
102
|
+
const getOption = (name: string) => canvas.findByRole('menuitem', { name });
|
|
104
103
|
|
|
105
|
-
const enabledMenuOption = await getOption(
|
|
104
|
+
const enabledMenuOption = await getOption('Enabled');
|
|
106
105
|
expect(enabledMenuOption).toBeInTheDocument();
|
|
107
106
|
await userEvent.click(enabledMenuOption);
|
|
108
107
|
expect(enabledAction).toHaveBeenCalled();
|
|
109
108
|
|
|
110
109
|
enabledAction.mockClear();
|
|
111
|
-
const disabledMenuOption = await getOption(
|
|
110
|
+
const disabledMenuOption = await getOption('Disabled');
|
|
112
111
|
expect(disabledMenuOption).toBeInTheDocument();
|
|
113
112
|
await userEvent.click(disabledMenuOption);
|
|
114
113
|
expect(disabledAction).not.toHaveBeenCalled();
|
|
115
114
|
|
|
116
115
|
// Sub input tests
|
|
117
|
-
const subTextInput = await getOption(
|
|
116
|
+
const subTextInput = await getOption('Sub text input');
|
|
118
117
|
expect(subTextInput).toBeInTheDocument();
|
|
119
|
-
expect(canvas.queryByPlaceholderText(
|
|
118
|
+
expect(canvas.queryByPlaceholderText('Text input')).not.toBeInTheDocument();
|
|
120
119
|
|
|
121
|
-
const subTextArea = await getOption(
|
|
120
|
+
const subTextArea = await getOption('Sub text area');
|
|
122
121
|
expect(subTextArea).toBeInTheDocument();
|
|
123
|
-
expect(canvas.queryByPlaceholderText(
|
|
122
|
+
expect(canvas.queryByPlaceholderText('Text area')).not.toBeInTheDocument();
|
|
124
123
|
|
|
125
124
|
await userEvent.click(subTextInput);
|
|
126
|
-
const textInput = await canvas.findByPlaceholderText(
|
|
125
|
+
const textInput = await canvas.findByPlaceholderText('Text input');
|
|
127
126
|
expect(textInput).toBeInTheDocument();
|
|
128
|
-
expect(await canvas.findByText(
|
|
129
|
-
expect(canvas.queryByPlaceholderText(
|
|
127
|
+
expect(await canvas.findByText('Must not be empty')).toBeInTheDocument();
|
|
128
|
+
expect(canvas.queryByPlaceholderText('Text area')).not.toBeInTheDocument();
|
|
130
129
|
|
|
131
|
-
await userEvent.type(textInput,
|
|
132
|
-
expect(await canvas.findByText(
|
|
130
|
+
await userEvent.type(textInput, 'Hello');
|
|
131
|
+
expect(await canvas.findByText('Press enter or tab to save')).toBeInTheDocument();
|
|
133
132
|
|
|
134
133
|
// Test tab to save
|
|
135
134
|
updateValue.mockClear();
|
|
@@ -143,25 +142,25 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
|
|
|
143
142
|
|
|
144
143
|
// Test escape to not save
|
|
145
144
|
updateValue.mockClear();
|
|
146
|
-
await userEvent.type(textInput,
|
|
145
|
+
await userEvent.type(textInput, '{Escape}');
|
|
147
146
|
expect(updateValue).not.toHaveBeenCalled();
|
|
148
147
|
|
|
149
148
|
// Test invalid value doesn't save
|
|
150
149
|
updateValue.mockClear();
|
|
151
150
|
await userEvent.clear(textInput);
|
|
152
|
-
await userEvent.type(textInput,
|
|
151
|
+
await userEvent.type(textInput, '{Enter}');
|
|
153
152
|
expect(updateValue).not.toHaveBeenCalled();
|
|
154
153
|
|
|
155
154
|
// Sub text area tests
|
|
156
155
|
subTextArea.click();
|
|
157
156
|
|
|
158
|
-
const textArea = await canvas.findByPlaceholderText(
|
|
157
|
+
const textArea = await canvas.findByPlaceholderText('Text area');
|
|
159
158
|
expect(textArea).toBeInTheDocument();
|
|
160
|
-
expect(await canvas.findByText(
|
|
161
|
-
expect(canvas.queryByPlaceholderText(
|
|
159
|
+
expect(await canvas.findByText('Must not be empty')).toBeInTheDocument();
|
|
160
|
+
expect(canvas.queryByPlaceholderText('Text input')).not.toBeInTheDocument();
|
|
162
161
|
|
|
163
|
-
await userEvent.type(textArea,
|
|
164
|
-
expect(await canvas.findByText(
|
|
162
|
+
await userEvent.type(textArea, 'Hello');
|
|
163
|
+
expect(await canvas.findByText('Press tab to save')).toBeInTheDocument();
|
|
165
164
|
|
|
166
165
|
// Test tab to save
|
|
167
166
|
updateValue.mockClear();
|
|
@@ -175,12 +174,12 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
|
|
|
175
174
|
|
|
176
175
|
// Test escape to not save
|
|
177
176
|
updateValue.mockClear();
|
|
178
|
-
await userEvent.type(textArea,
|
|
177
|
+
await userEvent.type(textArea, '{Escape}');
|
|
179
178
|
expect(updateValue).not.toHaveBeenCalled();
|
|
180
179
|
|
|
181
180
|
// Test invalid value doesn't save
|
|
182
181
|
updateValue.mockClear();
|
|
183
182
|
await userEvent.clear(textArea);
|
|
184
|
-
await userEvent.type(textArea,
|
|
183
|
+
await userEvent.type(textArea, '{Enter}');
|
|
185
184
|
expect(updateValue).not.toHaveBeenCalled();
|
|
186
185
|
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import '../../../react-menu3/styles/index.scss';
|
|
2
|
+
import '../../../styles/index.scss';
|
|
3
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
4
|
+
import '@linzjs/lui/dist/fonts';
|
|
4
5
|
|
|
5
|
-
import { StoryFn } from
|
|
6
|
-
import { expect, fn, userEvent, within } from
|
|
7
|
-
import { GridPopoverContext } from
|
|
8
|
-
import { useRef } from
|
|
6
|
+
import { StoryFn } from '@storybook/react';
|
|
7
|
+
import { expect, fn, userEvent, within } from '@storybook/test';
|
|
8
|
+
import { GridPopoverContext } from 'contexts/GridPopoverContext';
|
|
9
|
+
import { useRef } from 'react';
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import { GridContext, GridFormTextArea, GridFormTextAreaProps } from "../../..";
|
|
11
|
+
import { GridContext, GridFormTextArea, GridFormTextAreaProps } from '../../..';
|
|
13
12
|
|
|
14
13
|
export default {
|
|
15
|
-
title:
|
|
14
|
+
title: 'GridForm / Interactions',
|
|
16
15
|
component: GridFormTextArea,
|
|
17
16
|
args: {},
|
|
18
17
|
};
|
|
@@ -23,7 +22,7 @@ const Template: StoryFn<typeof GridFormTextArea> = (props: GridFormTextAreaProps
|
|
|
23
22
|
const anchorRef = useRef<HTMLHeadingElement>(null);
|
|
24
23
|
|
|
25
24
|
return (
|
|
26
|
-
<div className={
|
|
25
|
+
<div className={'react-menu-inline-test'}>
|
|
27
26
|
<GridContext.Provider
|
|
28
27
|
value={
|
|
29
28
|
{
|
|
@@ -39,8 +38,8 @@ const Template: StoryFn<typeof GridFormTextArea> = (props: GridFormTextAreaProps
|
|
|
39
38
|
value: null,
|
|
40
39
|
updateValue,
|
|
41
40
|
data: { value: null },
|
|
42
|
-
colId:
|
|
43
|
-
field:
|
|
41
|
+
colId: '',
|
|
42
|
+
field: 'value',
|
|
44
43
|
selectedRows: [],
|
|
45
44
|
saving: false,
|
|
46
45
|
setSaving: () => {},
|
|
@@ -58,12 +57,12 @@ export const GridFormTextAreaInteractions_: typeof Template = Template.bind({});
|
|
|
58
57
|
GridFormTextAreaInteractions_.play = async ({ canvasElement }) => {
|
|
59
58
|
const canvas = within(canvasElement);
|
|
60
59
|
|
|
61
|
-
expect(await canvas.findByText(
|
|
60
|
+
expect(await canvas.findByText('Must not be empty')).toBeInTheDocument();
|
|
62
61
|
|
|
63
|
-
const inputField = canvas.getByPlaceholderText(
|
|
64
|
-
await userEvent.type(inputField,
|
|
62
|
+
const inputField = canvas.getByPlaceholderText('Type here');
|
|
63
|
+
await userEvent.type(inputField, 'Hello');
|
|
65
64
|
|
|
66
|
-
expect(await canvas.findByText(
|
|
65
|
+
expect(await canvas.findByText('Press tab to save')).toBeInTheDocument();
|
|
67
66
|
|
|
68
67
|
// Test tab to save
|
|
69
68
|
updateValue.mockClear();
|
|
@@ -77,14 +76,14 @@ GridFormTextAreaInteractions_.play = async ({ canvasElement }) => {
|
|
|
77
76
|
|
|
78
77
|
// Test escape not to save
|
|
79
78
|
updateValue.mockClear();
|
|
80
|
-
await userEvent.type(inputField,
|
|
79
|
+
await userEvent.type(inputField, '{Escape}');
|
|
81
80
|
expect(updateValue).not.toHaveBeenCalled();
|
|
82
81
|
|
|
83
82
|
// Test invalid value doesn't save
|
|
84
83
|
updateValue.mockClear();
|
|
85
84
|
await userEvent.clear(inputField);
|
|
86
85
|
|
|
87
|
-
expect(canvas.getByText(
|
|
86
|
+
expect(canvas.getByText('Must not be empty')).toBeInTheDocument();
|
|
88
87
|
await userEvent.tab();
|
|
89
88
|
expect(updateValue).not.toHaveBeenCalled();
|
|
90
89
|
await userEvent.tab({ shift: true });
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import '../../../react-menu3/styles/index.scss';
|
|
2
|
+
import '../../../styles/index.scss';
|
|
3
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
4
|
+
import '@linzjs/lui/dist/fonts';
|
|
4
5
|
|
|
5
|
-
import { StoryFn } from
|
|
6
|
-
import { expect, fn, userEvent, within } from
|
|
7
|
-
import { GridPopoverContext } from
|
|
8
|
-
import { useRef } from
|
|
6
|
+
import { StoryFn } from '@storybook/react';
|
|
7
|
+
import { expect, fn, userEvent, within } from '@storybook/test';
|
|
8
|
+
import { GridPopoverContext } from 'contexts/GridPopoverContext';
|
|
9
|
+
import { useRef } from 'react';
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import { GridContext, GridFormTextInput, GridFormTextInputProps } from "../../..";
|
|
11
|
+
import { GridContext, GridFormTextInput, GridFormTextInputProps } from '../../..';
|
|
13
12
|
|
|
14
13
|
export default {
|
|
15
|
-
title:
|
|
14
|
+
title: 'GridForm / Interactions',
|
|
16
15
|
component: GridFormTextInput,
|
|
17
16
|
args: {},
|
|
18
17
|
};
|
|
@@ -23,7 +22,7 @@ const Template: StoryFn<typeof GridFormTextInput> = (props: GridFormTextInputPro
|
|
|
23
22
|
const anchorRef = useRef<HTMLHeadingElement>(null);
|
|
24
23
|
|
|
25
24
|
return (
|
|
26
|
-
<div className={
|
|
25
|
+
<div className={'react-menu-inline-test'}>
|
|
27
26
|
<GridContext.Provider
|
|
28
27
|
value={
|
|
29
28
|
{
|
|
@@ -39,8 +38,8 @@ const Template: StoryFn<typeof GridFormTextInput> = (props: GridFormTextInputPro
|
|
|
39
38
|
value: null,
|
|
40
39
|
updateValue,
|
|
41
40
|
data: { value: null },
|
|
42
|
-
colId:
|
|
43
|
-
field:
|
|
41
|
+
colId: '',
|
|
42
|
+
field: 'value',
|
|
44
43
|
selectedRows: [],
|
|
45
44
|
saving: false,
|
|
46
45
|
setSaving: () => {},
|
|
@@ -58,16 +57,16 @@ export const GridFormTextInputInteractions_: typeof Template = Template.bind({})
|
|
|
58
57
|
GridFormTextInputInteractions_.play = async ({ canvasElement }) => {
|
|
59
58
|
const canvas = within(canvasElement);
|
|
60
59
|
|
|
61
|
-
expect(await canvas.findByText(
|
|
60
|
+
expect(await canvas.findByText('Must not be empty')).toBeInTheDocument();
|
|
62
61
|
|
|
63
|
-
const inputField = canvas.getByPlaceholderText(
|
|
64
|
-
await userEvent.type(inputField,
|
|
62
|
+
const inputField = canvas.getByPlaceholderText('Type here');
|
|
63
|
+
await userEvent.type(inputField, 'Hello');
|
|
65
64
|
|
|
66
|
-
expect(canvas.getByText(
|
|
65
|
+
expect(canvas.getByText('Press enter or tab to save')).toBeInTheDocument();
|
|
67
66
|
|
|
68
67
|
// Test enter to save
|
|
69
68
|
updateValue.mockClear();
|
|
70
|
-
await userEvent.type(inputField,
|
|
69
|
+
await userEvent.type(inputField, '{Enter}');
|
|
71
70
|
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 0); // 0 = Enter
|
|
72
71
|
|
|
73
72
|
// Test tab to save
|
|
@@ -82,15 +81,15 @@ GridFormTextInputInteractions_.play = async ({ canvasElement }) => {
|
|
|
82
81
|
|
|
83
82
|
// Test escape not to save
|
|
84
83
|
updateValue.mockClear();
|
|
85
|
-
await userEvent.type(inputField,
|
|
84
|
+
await userEvent.type(inputField, '{Escape}');
|
|
86
85
|
expect(updateValue).not.toHaveBeenCalled();
|
|
87
86
|
|
|
88
87
|
// Test invalid value doesn't save
|
|
89
88
|
updateValue.mockClear();
|
|
90
89
|
await userEvent.clear(inputField);
|
|
91
90
|
|
|
92
|
-
expect(canvas.getByText(
|
|
93
|
-
await userEvent.type(inputField,
|
|
91
|
+
expect(canvas.getByText('Must not be empty')).toBeInTheDocument();
|
|
92
|
+
await userEvent.type(inputField, '{Enter}');
|
|
94
93
|
expect(updateValue).not.toHaveBeenCalled();
|
|
95
94
|
await userEvent.tab();
|
|
96
95
|
expect(updateValue).not.toHaveBeenCalled();
|