Skip to content

Commit b3aefb0

Browse files
committed
test(material-renderers): fix failing tests
1 parent b911064 commit b3aefb0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

packages/material-renderers/test/renderers/MaterialListWithDetailRenderer.test.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import MaterialListWithDetailRenderer, {
3838
import Enzyme, { mount, ReactWrapper } from 'enzyme';
3939
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
4040
import { JsonFormsStateProvider } from '@jsonforms/react';
41-
import { ListItem, Typography } from '@mui/material';
41+
import { ListItemButton, Typography } from '@mui/material';
4242
import { initCore, testTranslator } from './util';
4343
import { checkTooltip, checkTooltipTranslation } from './tooltipChecker';
4444

@@ -179,8 +179,8 @@ describe('Material list with detail renderer', () => {
179179
</JsonFormsStateProvider>
180180
);
181181

182-
const lis = wrapper.find('li');
183-
expect(lis).toHaveLength(2);
182+
const listItemButtons = wrapper.find('div[role="button"]');
183+
expect(listItemButtons).toHaveLength(2);
184184
});
185185
it('should render empty entries', () => {
186186
const core = initCore(schema, uischema, []);
@@ -364,8 +364,8 @@ describe('Material list with detail renderer', () => {
364364

365365
wrapper.update();
366366

367-
const lis = wrapper.find('li');
368-
expect(lis).toHaveLength(3);
367+
const listItemButtons = wrapper.find('div[role="button"]');
368+
expect(listItemButtons).toHaveLength(3);
369369
});
370370

371371
it('remove data from the array', () => {
@@ -378,14 +378,14 @@ describe('Material list with detail renderer', () => {
378378
</JsonFormsStateProvider>
379379
);
380380

381-
expect(wrapper.find(ListItem)).toHaveLength(2);
381+
expect(wrapper.find(ListItemButton)).toHaveLength(2);
382382

383383
const removeButton = wrapper.find('button').at(1);
384384
removeButton.simulate('click');
385385
wrapper.update();
386386

387-
const lis = wrapper.find(ListItem);
388-
expect(lis).toHaveLength(1);
387+
const listItemButtons = wrapper.find(ListItemButton);
388+
expect(listItemButtons).toHaveLength(1);
389389
});
390390

391391
it('should render first simple property', () => {
@@ -398,12 +398,12 @@ describe('Material list with detail renderer', () => {
398398
</JsonFormsStateProvider>
399399
);
400400

401-
expect(wrapper.find(ListItem)).toHaveLength(2);
401+
expect(wrapper.find(ListItemButton)).toHaveLength(2);
402402

403-
expect(wrapper.find(ListItem).find(Typography).at(0).text()).toBe(
403+
expect(wrapper.find(ListItemButton).find(Typography).at(0).text()).toBe(
404404
'El Barto was here'
405405
);
406-
expect(wrapper.find(ListItem).find(Typography).at(1).text()).toBe('Yolo');
406+
expect(wrapper.find(ListItemButton).find(Typography).at(1).text()).toBe('Yolo');
407407
});
408408

409409
it('should render first simple enum property as translated child label', () => {
@@ -419,15 +419,15 @@ describe('Material list with detail renderer', () => {
419419
</JsonFormsStateProvider>
420420
);
421421

422-
expect(wrapper.find(ListItem)).toHaveLength(3);
422+
expect(wrapper.find(ListItemButton)).toHaveLength(3);
423423

424-
expect(wrapper.find(ListItem).find(Typography).at(0).text()).toBe(
424+
expect(wrapper.find(ListItemButton).find(Typography).at(0).text()).toBe(
425425
'MSG_TYPE_1'
426426
);
427-
expect(wrapper.find(ListItem).find(Typography).at(1).text()).toBe(
427+
expect(wrapper.find(ListItemButton).find(Typography).at(1).text()).toBe(
428428
'MSG_TYPE_2'
429429
);
430-
expect(wrapper.find(ListItem).find(Typography).at(2).text()).toBe('');
430+
expect(wrapper.find(ListItemButton).find(Typography).at(2).text()).toBe('');
431431
});
432432

433433
it('should have no data message when no translator set', () => {

0 commit comments

Comments
 (0)