jxnblk / rmdi

React Material Design Icons – built with Pixo, Styled Components, and Styled System
https://jxnblk.com/rmdi
MIT License
129 stars 11 forks source link

FIX: crashes when importing icon #9

Open theinterned opened 6 years ago

theinterned commented 6 years ago

Problem

The export for the Icon component was incorrect in index.js as it was not returning the default export.

resolves #8

What I did

  1. Updated the test to import components from the ./index.js thus testing the public API. And Reproducing the issue.
  2. Updated the ./index.js to export the default export from the Icon component.
  3. Updated the test to pass a name prop when rendering the Icon component.

Other changes in this branch

I had to do a few things to get the tests to run:

  1. Added node_modules to .gitignore (weird it wasn't already there 🤔)
  2. Updated Jest to 23.5 to resolve an issue in jsdom@11.12.0 - see https://github.com/jsdom/jsdom/issues/2304
  3. Added a package lock file.

To test

I have updated the tests to test the public API, so you can just run npm test to see the (passing) state.

If you'd like to see the failure repro without the fix, you can git checkout 1e62a0e and you will get:

✕ Icon renders (7ms)

  ● Icon renders

    Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
jxnblk commented 6 years ago

Thanks, will need to look, but I think this will need to be fixed in the pixo library here: https://github.com/c8r/pixo/blob/master/lib/index.js#L157