Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ListItemText] Fix primary={0} display #11686

Merged
merged 2 commits into from
Jun 2, 2018
Merged

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 bug 🐛 Something doesn't work component: list This is the name of the generic UI component, not the React module! 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
bug 🐛 Something doesn't work component: list This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants