Skip to content

Conversation

@helfi92
Copy link
Contributor

@helfi92 helfi92 commented Jun 2, 2018

Closes #11672.

@helfi92
Copy link
Contributor Author

helfi92 commented Jun 2, 2018

Writing tests like the following fails:

assert.strictEqual(
  wrapper
    .childAt(0)
    .children()
    .equals(0),
  true,
  'should have 0 as primary text',
);

Any idea why?

const hasPrimary = primaryProp || primaryProp === 0;
let primary = hasPrimary ? primaryProp : children;

if (hasPrimary && !disableTypography) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since hasPrimary is only true for primaryProp, this presumably won't work for children

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@oliviertassinari oliviertassinari changed the title Display 0's with ListItemText [ListItemText] Fix primary={0} display Jun 2, 2018
@oliviertassinari oliviertassinari added type: bug It doesn't behave as expected. scope: list Changes related to the list labels Jun 2, 2018
@helfi92
Copy link
Contributor Author

helfi92 commented Jun 2, 2018

I'm still confused why #11686 (comment) fails. Otherwise, the recent commit looks good to me!

Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mbrookes mbrookes merged commit 4927668 into mui:master Jun 2, 2018
acroyear pushed a commit to acroyear/material-ui that referenced this pull request Jul 14, 2018
* Display 0's with ListItemText

* 🌹
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: list Changes related to the list type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants