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
Test: withComponent(...).attrs is not a function #851
Test: withComponent(...).attrs is not a function #851
Conversation
Generated by 🚫 dangerJS |
That definitely sounds like something that should work! Maybe this is related to #780? |
withComponent is a method on styled components and attrs is one on the factory, so this indeed won't work as is :( I'll take a look and see what's required to make this happen |
Yeah const Child = Parent.withComponent('a').extend.attrs({
...
})`
...
` or const Child = Parent.extend.attrs({
...
})`
...
`.withComponent('a') |
Should it be possible to add `attrs` after overriding `withComponent`? I found a test for `withComponent` followed by `extend`, but none for `attrs`, so I added one: ```js const Parent = styled.button` color: red; ` const Child = Parent.withComponent('a').attrs({ href: '/test' })`` ``` Currently this throws `TypeError: Parent.withComponent(...).attrs is not a function`.
c91fc4d
to
3d455b6
Compare
Thanks for the tip, @geelen! It sounds like this is the intended behavior, so I've inserted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't have enough tests, thanks @btmills!
🚨 This pull request contains a failing test and should not be merged.Edit: Test is no longer failing!Should it be possible to add
attrs
after overridingwithComponent
? I found a test forwithComponent
followed byextend
, but none forattrs
, so I added one:Currently this throws
TypeError: Parent.withComponent(...).attrs is not a function
.I haven't looked into the implementation to see what might be causing this, but if it's an actual bug, I'd be willing to spend some time on a fix given a couple hints about where to start looking!