material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[material-ui][PaginationItem] Deprecate components prop

Open sai6855 opened this issue 1 year ago • 8 comments

part of https://github.com/mui/material-ui/issues/41279

sai6855 avatar Apr 05 '24 04:04 sai6855

Netlify deploy preview

Pagination: parsed: +2.74% , gzip: +2.57% PaginationItem: parsed: +2.86% , gzip: +2.65% packages/material-ui/material-ui.production.min.js: parsed: +0.08% , gzip: +0.12% @material-ui/core: parsed: +0.07% , gzip: +0.07% @material-ui/lab: parsed: +0.13% , gzip: +0.12%

Bundle size report

Details of bundle changes (Toolpad) Details of bundle changes

Generated by :no_entry_sign: dangerJS against 606f8c323857e1d40e6e03045e74e7ba1c9bffe2

mui-bot avatar Apr 05 '24 04:04 mui-bot

Below tests are not removed , because describeConformance test suite is not customizable enough to handle PaginationItem.

https://github.com/mui/material-ui/blob/73c88b6c3f71287a4a1f0b1b5d7d37ab268dca49/packages/mui-material/src/PaginationItem/PaginationItem.test.js#L29-L31

I see 2 inconsistencies in PaginationItem compare to other components.

  1. properties in components prop are always started in capital letter in other components but in PaginationItem it starts with small letter
  2. if slot is passed through components prop or slots prop it is guranteed to get rendered but in PaginationItem it's not guranteed that passed slot will be displayed as type prop should be equal to passed slot.

Due to these inconsistencies following tests are not passed ( there are many more, i didn't listed all) on removing slotsProp, slotPropsProp, slotPropsCallback from skip array

https://github.com/mui/material-ui/blob/73c88b6c3f71287a4a1f0b1b5d7d37ab268dca49/packages/test-utils/src/describeConformance.tsx#L365 https://github.com/mui/material-ui/blob/73c88b6c3f71287a4a1f0b1b5d7d37ab268dca49/packages/test-utils/src/describeConformance.tsx#L408

sai6855 avatar Apr 08 '24 05:04 sai6855

Hey @sai6855, thanks for working on this!

Regarding the tests, would removing testLegacyComponentsProp: true (here) fix this issue so we can stop skipping the slots tests?

DiegoAndai avatar Apr 12 '24 21:04 DiegoAndai

fix this issue so we can stop skipping the slots tests?

No, it didn't helped. even on removing testLegacyComponentsProp: true tests are failing.

sai6855 avatar Apr 15 '24 04:04 sai6855

Even on removing testLegacyComponentsProp: true tests are failing.

I see. Some tests can be fixed by removing testLegacyComponentsProp: true, but others are failing because the rendering of slots is conditional to the type: https://github.com/mui/material-ui/pull/41777/files#diff-014e80cab0c8e6df4ca350c7fd91d2d7b490250af715108435ed9113e1886216R413-R418

So slots are not always rendered, as describeConformance expects. @siriwatknp do you know of any other case of slots being rendered conditionally? If it's common enough we could cover it in describeConformance, otherwise, we can cover the slots testing in PaginationItem tests.

DiegoAndai avatar Apr 16 '24 14:04 DiegoAndai

otherwise, we can cover the slots testing in PaginationItem tests.

@DiegoAndai shall i go ahead with this approach?

sai6855 avatar Apr 23 '24 06:04 sai6855

@DiegoAndai shall i go ahead with this approach?

Yes, let's do it. It makes sense to me to cover this custom case separately.

Let's add a comment pointing out that the slots tests are covered outside of describeConformance because of this.

DiegoAndai avatar Apr 24 '24 19:04 DiegoAndai

@DiegoAndai added tests to test conditional slots

sai6855 avatar Apr 26 '24 08:04 sai6855