components icon indicating copy to clipboard operation
components copied to clipboard

bug(MatListItem): Broken list item sanity check

Open dimamarksman opened this issue 3 years ago • 2 comments

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I believe there is a typo in the sanityCheckListItemContent method that leads to the incorrect behavior. Where const numLines = item._titles!.length; should be const numLines = item._lines!.length; instead. Otherwise, line 334 doesn't make any sense.

https://github.com/angular/components/blob/6057512de333046517c5f64a2ce6cf0a889447e9/src/material/list/list-base.ts#L327-L336

Reproduction

StackBlitz link: Steps to reproduce: 1. 2.

Expected Behavior

Based on the code intention we shouldn't be able to have MatListItem with MatListItemLine and without MatListItemTitle

Actual Behavior

It's possible to have MatListItemLine only without MatListItemTitle

Environment

  • Angular: any
  • CDK/Material: any
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

dimamarksman avatar Nov 08 '23 12:11 dimamarksman

Duplicate of https://github.com/angular/components/issues/27582.

crisbeto avatar Nov 09 '23 07:11 crisbeto

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.