-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add name
method
#335
Add name
method
#335
Conversation
I'll let @lelandrichardson comment on the shallow weirdness you mentioned. Could you please add |
Tests added for Comments on the docs? I had no idea how to express it, so I just cobbled something together. Is there a better wording I could use? |
@@ -2244,4 +2244,72 @@ describe('shallow', () => { | |||
}); | |||
}); | |||
|
|||
describe('.name()', () => { |
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.
The wrapper components here are what I'm talking about
I added the |
It would probably be best to include them, to prevent future regressions. |
Aight, added. |
@ljharb ping 😄 |
@SimenB i've left it for @lelandrichardson to take a final look at - although now it needs a fresh rebase ;-) |
Ah, didn't notice. Will rebase! EDIT: Rebased |
@SimenB I'm good with this addition. Looks good. Regarding the behavior you're mentioning above, this is expected. when you run Sorry this took me so long, but you think you can rebase this now? Just merged a big PR and would like things to be sequential. Thanks. |
Rebased. If I understand you correctly, that means the docs here are wrong, right? |
doh. Merged something else in and now there are conflicts :( @SimenB yes, those docs look very misleading! I'll go in and fix. Thanks for pointing it out. |
Rebased against latest master |
Great, thanks! Any plans on a new release soon? A lot of nice features has been added since 2.2 😄 EDIT: It has been released. Woop! |
The example here is also wrong per #335 (comment): https://github.com/airbnb/enzyme/blob/master/docs/api/ShallowWrapper/props.md#example Which means that #384 is not a bug. |
I think I'm doing something weird here, for the
shallow
one. To be able to get the name, I have to wrap the component I want in another component. Not a problem formount
. But this is howtype
works as well, so I don't know if I'm doing something, or if it's by design.The weird thing is the docs for
type
saysWhich is false, at least for a component like
It works correctly using
mount
, though.So I don't know if it's a bug, or if the docs for
shallow
is wrong.But there is a test for it that checks the current behavior.
shallow
is null: https://github.com/airbnb/enzyme/blob/1b9d317c57ba03414ae43109fa36bf4abf6e3445/test/ShallowWrapper-spec.js#L2213mount
is not: https://github.com/airbnb/enzyme/blob/1b9d317c57ba03414ae43109fa36bf4abf6e3445/test/ReactWrapper-spec.js#L1881If it is correct, maybe the docs need to be updated?