@axinom/mosaic-ui 0.63.0-rc.0 → 0.63.0-rc.10

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.
Files changed (61) hide show
  1. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  2. package/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts +1 -1
  3. package/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts.map +1 -1
  4. package/dist/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
  5. package/dist/components/Explorer/Explorer.d.ts.map +1 -1
  6. package/dist/components/Explorer/Explorer.model.d.ts +1 -1
  7. package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
  8. package/dist/components/FieldSelection/FieldSelection.d.ts +2 -0
  9. package/dist/components/FieldSelection/FieldSelection.d.ts.map +1 -1
  10. package/dist/components/FormElements/DateTimeField/DateTimeText.d.ts +1 -1
  11. package/dist/components/FormElements/DateTimeField/DateTimeText.d.ts.map +1 -1
  12. package/dist/components/FormElements/DateTimeField/DateTimeTextField.d.ts.map +1 -1
  13. package/dist/components/FormStation/FormStation.d.ts +12 -1
  14. package/dist/components/FormStation/FormStation.d.ts.map +1 -1
  15. package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts +3 -0
  16. package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +1 -1
  17. package/dist/components/FormStation/helpers/useDataProvider.d.ts +1 -1
  18. package/dist/components/FormStation/helpers/useDataProvider.d.ts.map +1 -1
  19. package/dist/components/Icons/Icons.d.ts.map +1 -1
  20. package/dist/components/Icons/Icons.models.d.ts +2 -1
  21. package/dist/components/Icons/Icons.models.d.ts.map +1 -1
  22. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
  23. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +2 -0
  24. package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts.map +1 -1
  25. package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +1 -1
  26. package/dist/index.es.js +4 -4
  27. package/dist/index.es.js.map +1 -1
  28. package/dist/index.js +4 -4
  29. package/dist/index.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/components/Accordion/Accordion.scss +14 -4
  32. package/src/components/Accordion/Accordion.spec.tsx +44 -64
  33. package/src/components/Accordion/Accordion.stories.tsx +52 -2
  34. package/src/components/Accordion/Accordion.tsx +9 -3
  35. package/src/components/Accordion/AccordionItem/AccordionItem.scss +1 -0
  36. package/src/components/Accordion/AccordionItem/AccordionItem.spec.tsx +46 -84
  37. package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.spec.tsx +22 -18
  38. package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.tsx +94 -20
  39. package/src/components/Explorer/BulkEdit/useBulkEdit.tsx +6 -8
  40. package/src/components/Explorer/Explorer.model.ts +1 -1
  41. package/src/components/Explorer/Explorer.tsx +1 -0
  42. package/src/components/Explorer/helpers/useActions.ts +1 -1
  43. package/src/components/FieldSelection/FieldSelection.scss +7 -0
  44. package/src/components/FieldSelection/FieldSelection.spec.tsx +0 -2
  45. package/src/components/FieldSelection/FieldSelection.tsx +13 -11
  46. package/src/components/FormElements/DateTimeField/DateTimeText.tsx +8 -14
  47. package/src/components/FormElements/DateTimeField/DateTimeTextField.tsx +18 -5
  48. package/src/components/FormStation/Create/Create.stories.tsx +9 -0
  49. package/src/components/FormStation/FormStation.stories.tsx +2 -2
  50. package/src/components/FormStation/FormStation.tsx +16 -1
  51. package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +20 -3
  52. package/src/components/FormStation/helpers/useDataProvider.ts +6 -2
  53. package/src/components/Icons/Icons.models.ts +1 -0
  54. package/src/components/Icons/Icons.tsx +17 -0
  55. package/src/components/PageHeader/PageHeader.stories.tsx +8 -0
  56. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +2 -0
  57. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.scss +28 -0
  58. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.spec.tsx +0 -10
  59. package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +4 -3
  60. package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx +5 -1
  61. package/src/styles/variables.scss +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.63.0-rc.0",
3
+ "version": "0.63.0-rc.10",
4
4
  "description": "UI components for building Axinom Mosaic applications",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -112,5 +112,5 @@
112
112
  "publishConfig": {
113
113
  "access": "public"
114
114
  },
115
- "gitHead": "c111f5f22c27fa1ceaff19826888a61590b80651"
115
+ "gitHead": "1190cb91471f96c64d9c8c49574a4963f7b560c8"
116
116
  }
@@ -42,6 +42,7 @@
42
42
 
43
43
  .button {
44
44
  transition: transform 200ms ease;
45
+
45
46
  svg {
46
47
  height: 40%;
47
48
  }
@@ -49,10 +50,19 @@
49
50
  svg * {
50
51
  stroke: var(--accordion-item-arrow-color, $accordion-item-arrow-color);
51
52
  }
53
+
54
+ &.disabled {
55
+ svg * {
56
+ stroke: var(
57
+ --accordion-item-arrow-disabled-color,
58
+ $accordion-item-arrow-disabled-color
59
+ );
60
+ }
61
+ }
62
+
63
+ &.rotated {
64
+ transform: rotate(90deg);
65
+ }
52
66
  }
53
67
  }
54
68
  }
55
-
56
- .rotated {
57
- transform: rotate(90deg);
58
- }
@@ -1,59 +1,30 @@
1
- import { mount, shallow } from 'enzyme';
1
+ import '@testing-library/jest-dom';
2
+ import { configure, fireEvent, render, screen } from '@testing-library/react';
2
3
  import React from 'react';
3
- import { Button } from '../Buttons';
4
- import { IconName } from '../Icons';
5
4
  import { Accordion } from './Accordion';
6
5
  import { AccordionItem } from './AccordionItem/AccordionItem';
7
6
 
7
+ configure({ testIdAttribute: 'data-test-id' });
8
+
8
9
  describe('Accordion', () => {
9
10
  it('renders the component without crashing', () => {
10
- const wrapper = shallow(<Accordion />);
11
-
12
- expect(wrapper).toBeTruthy();
13
- });
11
+ render(<Accordion />);
14
12
 
15
- it('contains a wrapper', () => {
16
- const wrapper = shallow(<Accordion header={<b>Header</b>} />);
17
-
18
- const accWrapper = wrapper.find('.container > div');
19
-
20
- expect(accWrapper.hasClass('wrapper')).toBe(true);
13
+ expect(screen.getByTestId('accordion')).toBeInTheDocument();
21
14
  });
22
15
 
23
16
  it('renders the component header', () => {
24
- const wrapper = shallow(<Accordion header={<b>Header</b>} />);
25
-
26
- expect(wrapper.find('.header').exists()).toBeTruthy();
17
+ render(<Accordion header={<b>Header</b>} />);
18
+ expect(screen.getByTestId('accordion-header')).toBeInTheDocument();
27
19
  });
28
20
 
29
21
  it('does not render a header when the prop is not provided', () => {
30
- const wrapper = shallow(<Accordion />);
31
-
32
- expect(wrapper.find('.header').exists()).toBeFalsy();
33
- });
34
-
35
- it('populates toggleExpanded and isExpanded props of child AccordionItem components', () => {
36
- const wrapper = mount(
37
- <Accordion header={<b>Header</b>}>
38
- <div id="extra"></div>
39
- <AccordionItem header={<b>Item 1</b>}>
40
- <p>Content 1</p>
41
- </AccordionItem>
42
- </Accordion>,
43
- );
44
-
45
- const item = wrapper.find(AccordionItem);
46
- const extra = wrapper.find('#extra');
47
-
48
- expect(item.prop('isExpanded')).toBeDefined();
49
- expect(item.prop('toggleExpanded')).toBeDefined();
50
-
51
- expect(extra.prop('isExpanded')).toBeUndefined();
52
- expect(extra.prop('toggleExpanded')).toBeUndefined();
22
+ render(<Accordion />);
23
+ expect(screen.queryByTestId('accordion-header')).not.toBeInTheDocument();
53
24
  });
54
25
 
55
26
  it('expands / collapses all children when the button is clicked', () => {
56
- const wrapper = mount(
27
+ render(
57
28
  <Accordion header={<b>Header</b>}>
58
29
  <AccordionItem header={<b>Item 1</b>}>
59
30
  <p>Content 1</p>
@@ -67,26 +38,31 @@ describe('Accordion', () => {
67
38
  </Accordion>,
68
39
  );
69
40
 
70
- const button = wrapper.find('.header .button').first();
71
- button.simulate('click');
41
+ // Find the expand/collapse all button (assuming it's the first button in header)
42
+ const headerButton = screen.getByTestId('accordion-toggle-all');
43
+ fireEvent.click(headerButton);
72
44
 
73
- let items = wrapper.find(AccordionItem);
45
+ // All items should be expanded (content visible)
46
+ let rows = screen.getAllByTestId('accordion-item-content');
47
+ expect(rows).toHaveLength(3);
74
48
 
75
- items.forEach((item) => {
76
- expect(item.prop('isExpanded')).toBe(true);
49
+ rows.forEach((row) => {
50
+ expect(row).toHaveClass('expanded');
77
51
  });
78
52
 
79
- button.simulate('click');
53
+ fireEvent.click(headerButton);
80
54
 
81
- items = wrapper.find(AccordionItem);
55
+ // All items should be collapsed (content not visible)
56
+ rows = screen.getAllByTestId('accordion-item-content');
57
+ expect(rows).toHaveLength(3);
82
58
 
83
- items.forEach((item) => {
84
- expect(item.prop('isExpanded')).toBe(false);
59
+ rows.forEach((row) => {
60
+ expect(row).not.toHaveClass('expanded');
85
61
  });
86
62
  });
87
63
 
88
64
  it('displays rotated ChevronRight icon when one or more children are expanded', () => {
89
- const wrapper = mount(
65
+ render(
90
66
  <Accordion header={<b>Header</b>}>
91
67
  <AccordionItem header={<b>Item 1</b>}>
92
68
  <p>Content 1</p>
@@ -100,25 +76,29 @@ describe('Accordion', () => {
100
76
  </Accordion>,
101
77
  );
102
78
 
103
- let button = wrapper.find(Button).first();
104
-
105
- expect(button.prop('icon')).toBe(IconName.ChevronRight);
106
- expect(button.hasClass('rotated')).toBe(false);
79
+ // The button in the header should have the ChevronRight icon and not be rotated initially
80
+ const headerButton = screen.getByTestId('accordion-toggle-all');
81
+ expect(headerButton.querySelector('.rotated')).not.toBeInTheDocument();
107
82
 
108
- const item = wrapper.find(AccordionItem).last();
83
+ // Expand the last item
84
+ const lastItemButton = screen.getAllByRole('button')[2];
85
+ fireEvent.click(lastItemButton);
109
86
 
110
- item.find('button').simulate('click');
87
+ // Now the header button should have the rotated class
88
+ expect(headerButton).toHaveClass('rotated');
111
89
 
112
- button = wrapper.find(Button).first();
90
+ // Collapse the last item
91
+ fireEvent.click(lastItemButton);
113
92
 
114
- expect(button.prop('icon')).toBe(IconName.ChevronRight);
115
- expect(button.hasClass('rotated')).toBe(true);
116
-
117
- item.find('button').simulate('click');
93
+ // The header button should not have the rotated class anymore
94
+ expect(headerButton).not.toHaveClass('rotated');
95
+ });
118
96
 
119
- button = wrapper.find(Button).first();
97
+ it('disables the expand/collapse all button when there are no children', () => {
98
+ render(<Accordion header={<b>Header</b>} />);
120
99
 
121
- expect(button.prop('icon')).toBe(IconName.ChevronRight);
122
- expect(button.hasClass('rotated')).toBe(false);
100
+ // The button should be disabled when there are no children
101
+ const headerButton = screen.getByTestId('accordion-toggle-all');
102
+ expect(headerButton).toBeDisabled();
123
103
  });
124
104
  });
@@ -5,6 +5,7 @@ import { default as React, ReactNode, useEffect, useState } from 'react';
5
5
  import { createGroups, generateItemArray } from '../../helpers/storybook';
6
6
  import { TextButton } from '../Buttons/TextButton/TextButton';
7
7
  import { Divider } from '../FormElements';
8
+ import { List } from '../List';
8
9
  import { Accordion } from './Accordion';
9
10
  import { AccordionItem } from './AccordionItem/AccordionItem';
10
11
 
@@ -17,12 +18,13 @@ const groups = createGroups({
17
18
  const generateItems = (
18
19
  startIndex?: number,
19
20
  sticky?: boolean,
21
+ children?: JSX.Element,
20
22
  ): JSX.Element[] => {
21
23
  return generateItemArray(10, (index) => {
22
24
  const key = index + (startIndex ?? 1);
23
25
  return (
24
26
  <AccordionItem key={key} header={<b>Item {key}</b>} sticky={sticky}>
25
- <p>{faker.lorem.paragraph(20)}</p>
27
+ {children ?? <p>{faker.lorem.paragraph(20)}</p>}
26
28
  </AccordionItem>
27
29
  );
28
30
  });
@@ -56,7 +58,7 @@ export const Default: StoryObj<typeof Accordion> = {
56
58
  render: (args) => <Accordion {...args} header={<b>{args.header}</b>} />,
57
59
  args: {
58
60
  children: generateItems(),
59
- header: 'Header' as any,
61
+ header: 'Header' as unknown as JSX.Element,
60
62
  },
61
63
  name: 'Default',
62
64
  };
@@ -103,3 +105,51 @@ export const AddingAndShuffling: StoryObj<typeof Accordion> = {
103
105
  },
104
106
  name: 'Adding and shuffling',
105
107
  };
108
+
109
+ export const NestedSticky: StoryObj<typeof Accordion> = {
110
+ args: {
111
+ ...Default.args,
112
+ children: generateItems(
113
+ 1,
114
+ true,
115
+ <div style={{ height: '350px' }}>
116
+ <List
117
+ columns={[
118
+ {
119
+ propertyName: 'id',
120
+ label: 'Id',
121
+ size: '50px',
122
+ },
123
+ {
124
+ propertyName: 'title',
125
+ label: 'Title',
126
+ },
127
+ {
128
+ propertyName: 'desc',
129
+ label: 'Description',
130
+ },
131
+ ]}
132
+ data={generateItemArray(10, (index) => ({
133
+ id: index + 1,
134
+ desc: `Description ${index + 1}: ${faker.lorem.words(
135
+ faker.datatype.number({ min: 10, max: 50 }),
136
+ )}`,
137
+ title: `Item ${index + 1}: ${faker.random.words(
138
+ faker.datatype.number({ min: 1, max: 3 }),
139
+ )}`,
140
+ }))}
141
+ />
142
+ </div>,
143
+ ),
144
+ stickyRows: true,
145
+ },
146
+ name: 'Nested Sticky',
147
+ };
148
+
149
+ export const NoChildren: StoryObj<typeof Accordion> = {
150
+ args: {
151
+ ...Default.args,
152
+ children: undefined,
153
+ },
154
+ name: 'No children',
155
+ };
@@ -58,18 +58,21 @@ export const Accordion: React.FC<AccordionProps> = ({
58
58
  }) => {
59
59
  const expandAll = useExpand();
60
60
  const [expanded, setExpanded] = useState<ExpandedState>({});
61
+ const disabled = !React.Children.count(children);
61
62
 
62
63
  useEffect(() => {
63
64
  setExpanded((oldState) => {
64
- const updatedState: ExpandedState = { ...oldState };
65
+ const updatedState: ExpandedState = {};
65
66
 
66
- React.Children.map(children, (child, i) => {
67
+ React.Children.forEach(children, (child, i) => {
67
68
  if (React.isValidElement(child)) {
68
69
  if (child.type === AccordionItem) {
69
70
  const keyString = String(child.key ?? i);
70
71
 
71
- if (!Object.keys(updatedState).includes(keyString)) {
72
+ if (!Object.keys(oldState).includes(keyString)) {
72
73
  updatedState[keyString] = expandedByDefault;
74
+ } else {
75
+ updatedState[keyString] = oldState[keyString];
73
76
  }
74
77
  }
75
78
  }
@@ -110,8 +113,11 @@ export const Accordion: React.FC<AccordionProps> = ({
110
113
  }}
111
114
  className={clsx(classes.button, {
112
115
  [classes.rotated]: expandAll.isExpanded,
116
+ [classes.disabled]: disabled,
113
117
  })}
114
118
  buttonContext={ButtonContext.None}
119
+ disabled={disabled}
120
+ dataTestId="accordion-toggle-all"
115
121
  ></Button>
116
122
  {header}
117
123
  </div>
@@ -23,6 +23,7 @@
23
23
  }
24
24
 
25
25
  &.sticky {
26
+ z-index: 1;
26
27
  position: sticky;
27
28
  top: 50px;
28
29
  }
@@ -1,111 +1,73 @@
1
- import { mount, shallow } from 'enzyme';
1
+ import '@testing-library/jest-dom';
2
+ import { configure, fireEvent, render, screen } from '@testing-library/react';
2
3
  import React from 'react';
3
4
  import { AccordionItem } from './AccordionItem';
4
5
 
5
- describe('AccordionItem', () => {
6
- it('renders the component without crashing', () => {
7
- const wrapper = shallow(<AccordionItem header={<b>Item 1</b>} />);
8
-
9
- expect(wrapper).toBeTruthy();
10
- });
6
+ configure({ testIdAttribute: 'data-test-id' });
11
7
 
12
- it('renders expanded content', () => {
13
- const wrapper = shallow(
14
- <AccordionItem header={<b>Item 1</b>} isExpanded={true} />,
15
- );
16
-
17
- const content = wrapper.find('.expanded');
8
+ describe('AccordionItem', () => {
9
+ const header = <span>Header</span>;
10
+ const content = <div>Accordion Content</div>;
18
11
 
19
- expect(content).toHaveLength(1);
12
+ it('renders header and children', () => {
13
+ render(<AccordionItem header={header}>{content}</AccordionItem>);
14
+ expect(screen.getByText('Header')).toBeInTheDocument();
15
+ expect(screen.getByText('Accordion Content')).toBeInTheDocument();
20
16
  });
21
17
 
22
- it('does not render expanded content when isExpanded is false', () => {
23
- const wrapper = shallow(
24
- <AccordionItem header={<b>Item 1</b>} isExpanded={false} />,
18
+ it('calls toggleExpanded when row is clicked', () => {
19
+ const toggleExpanded = jest.fn();
20
+ render(
21
+ <AccordionItem header={header} toggleExpanded={toggleExpanded}>
22
+ {content}
23
+ </AccordionItem>,
25
24
  );
26
-
27
- const content = wrapper.find('.expanded');
28
-
29
- expect(content).toHaveLength(0);
25
+ fireEvent.click(screen.getByTestId('accordion-item-row'));
26
+ expect(toggleExpanded).toHaveBeenCalled();
30
27
  });
31
28
 
32
- it('triggers toggleExpanded callback when the expand button is pressed', () => {
33
- const spy = jest.fn();
34
- const wrapper = mount(
35
- <AccordionItem header={<b>Item 1</b>} toggleExpanded={spy} />,
36
- );
37
-
38
- const button = wrapper.find('button');
39
-
40
- button.simulate('click');
41
-
42
- expect(spy).toHaveBeenCalledTimes(1);
43
- });
44
-
45
- it('adds 50px spacing element by default', () => {
46
- const wrapper = shallow(
47
- <AccordionItem header={<b>Item 1</b>}>
48
- <div></div>
29
+ it('shows expanded styles and rotates icon when isExpanded is true', () => {
30
+ render(
31
+ <AccordionItem header={header} isExpanded>
32
+ {content}
49
33
  </AccordionItem>,
50
34
  );
51
-
52
- const contentStyles = wrapper
53
- .find('.content')
54
- .prop('style') as React.CSSProperties;
55
- const children = wrapper.find('.content > div');
56
-
57
- expect(contentStyles.gridTemplateColumns).toBeUndefined();
58
- expect(children).toHaveLength(2);
35
+ const row = screen.getByTestId('accordion-item-row');
36
+ expect(row.className).toMatch(/rowExpanded/);
37
+ const button = row.querySelector('button');
38
+ expect(button?.className).toMatch(/rotated/);
39
+ const contentDiv = screen.getByTestId('accordion-item-content');
40
+ expect(contentDiv.className).toMatch(/expanded/);
59
41
  });
60
42
 
61
- it(`doesn't add 50px spacing element if 'allowLeftSpacing' is set to false`, () => {
62
- const wrapper = shallow(
63
- <AccordionItem header={<b>Item 1</b>} allowLeftSpacing={false}>
64
- <div></div>
43
+ it('applies sticky class when sticky is true', () => {
44
+ render(
45
+ <AccordionItem header={header} sticky>
46
+ {content}
65
47
  </AccordionItem>,
66
48
  );
67
-
68
- const contentStyles = wrapper
69
- .find('.content')
70
- .prop('style') as React.CSSProperties;
71
- const children = wrapper.find('.content > div');
72
-
73
- expect(contentStyles.gridTemplateColumns).toBe('1fr');
74
- expect(children).toHaveLength(1);
49
+ const row = screen.getByTestId('accordion-item-row');
50
+ expect(row.className).toMatch(/sticky/);
75
51
  });
76
52
 
77
- it(`should set expanded class when 'isExpanded' is true`, () => {
78
- const wrapper = mount(
79
- <AccordionItem header={<b>Item 1</b>} isExpanded={true}>
80
- <div></div>
53
+ it('does not add left spacing when allowLeftSpacing is false', () => {
54
+ render(
55
+ <AccordionItem header={header} allowLeftSpacing={false}>
56
+ {content}
81
57
  </AccordionItem>,
82
58
  );
83
-
84
- const expanded = wrapper.find('.expanded');
85
-
86
- expect(expanded).toHaveLength(1);
59
+ const contentDiv = screen.getByText('Accordion Content').parentElement;
60
+ expect(contentDiv).toHaveStyle('grid-template-columns: 1fr');
87
61
  });
88
62
 
89
- it(`should not set expanded class when 'isExpanded' is true`, () => {
90
- const wrapper = mount(
91
- <AccordionItem header={<b>Item 1</b>} isExpanded={false}>
92
- <div></div>
63
+ it('applies custom className to root element', () => {
64
+ render(
65
+ <AccordionItem header={header} className="custom-class">
66
+ {content}
93
67
  </AccordionItem>,
94
68
  );
95
-
96
- const expanded = wrapper.find('.expanded');
97
-
98
- expect(expanded).toHaveLength(0);
99
- });
100
-
101
- it('creates a class based off of the className prop', () => {
102
- const mockClassName = 'test-class';
103
- const wrapper = shallow(
104
- <AccordionItem header={<b>Item 1</b>} className={mockClassName} />,
69
+ expect(screen.getByTestId('accordion-item').className).toContain(
70
+ 'custom-class',
105
71
  );
106
-
107
- const item = wrapper.find('.test-class');
108
-
109
- expect(item.hasClass(mockClassName)).toBe(true);
110
72
  });
111
73
  });
@@ -16,12 +16,22 @@ jest.mock('../../FormElements', () => ({
16
16
  )),
17
17
  }));
18
18
 
19
+ jest.mock('../../FieldSelection', () => ({
20
+ FieldSelection: jest.fn(({ children }) => (
21
+ <div data-testid="FieldSelection">{children}</div>
22
+ )),
23
+ }));
24
+
19
25
  jest.mock('formik', () => ({
20
26
  Field: jest.fn(({ name, label, as: Component }) => (
21
27
  <div data-testid={`Field-${name}`}>
22
28
  <Component name={name} label={label} />
23
29
  </div>
24
30
  )),
31
+ useFormikContext: jest.fn(() => ({
32
+ setFieldValue: jest.fn(),
33
+ setFieldTouched: jest.fn(),
34
+ })),
25
35
  }));
26
36
 
27
37
  describe('BulkEditFormFieldsConfigConverter', () => {
@@ -35,9 +45,7 @@ describe('BulkEditFormFieldsConfigConverter', () => {
35
45
  },
36
46
  };
37
47
 
38
- const { getByTestId } = render(
39
- <>{BulkEditFormFieldsConfigConverter(config)}</>,
40
- );
48
+ const { getByTestId } = render(BulkEditFormFieldsConfigConverter(config));
41
49
 
42
50
  expect(getByTestId('Field-title')).toBeInTheDocument();
43
51
  expect(getByTestId('SingleLineTextField')).toHaveTextContent('title-Title');
@@ -53,9 +61,7 @@ describe('BulkEditFormFieldsConfigConverter', () => {
53
61
  },
54
62
  };
55
63
 
56
- const { getByTestId } = render(
57
- <>{BulkEditFormFieldsConfigConverter(config)}</>,
58
- );
64
+ const { getByTestId } = render(BulkEditFormFieldsConfigConverter(config));
59
65
 
60
66
  expect(getByTestId('Field-isArchived')).toBeInTheDocument();
61
67
  expect(getByTestId('CheckboxField')).toHaveTextContent(
@@ -77,9 +83,7 @@ describe('BulkEditFormFieldsConfigConverter', () => {
77
83
  },
78
84
  };
79
85
 
80
- const { getByTestId } = render(
81
- <>{BulkEditFormFieldsConfigConverter(config)}</>,
82
- );
86
+ const { getByTestId } = render(BulkEditFormFieldsConfigConverter(config));
83
87
 
84
88
  expect(getByTestId('Field-tags')).toBeInTheDocument();
85
89
  expect(getByTestId('CustomTagsField')).toHaveTextContent('tags-Tags');
@@ -111,9 +115,7 @@ describe('BulkEditFormFieldsConfigConverter', () => {
111
115
  },
112
116
  };
113
117
 
114
- const { getByTestId } = render(
115
- <>{BulkEditFormFieldsConfigConverter(config)}</>,
116
- );
118
+ const { getByTestId } = render(BulkEditFormFieldsConfigConverter(config));
117
119
 
118
120
  expect(getByTestId('Field-title')).toBeInTheDocument();
119
121
  expect(getByTestId('SingleLineTextField')).toHaveTextContent('title-Title');
@@ -138,14 +140,15 @@ describe('BulkEditFormFieldsConfigConverter', () => {
138
140
  },
139
141
  };
140
142
 
141
- const { container } = render(
142
- <>{BulkEditFormFieldsConfigConverter(config)}</>,
143
+ const { container, getByTestId } = render(
144
+ BulkEditFormFieldsConfigConverter(config),
143
145
  );
144
146
 
145
147
  expect(consoleWarnSpy).toHaveBeenCalledWith(
146
148
  'No component found for field type: UnsupportedType',
147
149
  );
148
- expect(container.firstChild).toBeNull();
150
+ expect(getByTestId('FieldSelection')).toBeInTheDocument();
151
+ expect(container.firstChild).toBeEmptyDOMElement();
149
152
 
150
153
  consoleWarnSpy.mockRestore();
151
154
  });
@@ -153,10 +156,11 @@ describe('BulkEditFormFieldsConfigConverter', () => {
153
156
  it('handles empty configuration gracefully', () => {
154
157
  const config: BulkEditFieldConfigMap = {};
155
158
 
156
- const { container } = render(
157
- <>{BulkEditFormFieldsConfigConverter(config)}</>,
159
+ const { container, getByTestId } = render(
160
+ BulkEditFormFieldsConfigConverter(config),
158
161
  );
159
162
 
160
- expect(container.firstChild).toBeNull();
163
+ expect(getByTestId('FieldSelection')).toBeInTheDocument();
164
+ expect(container.firstChild).toBeEmptyDOMElement();
161
165
  });
162
166
  });