-
-
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
Ignoring attachTo
and hydrateIn
options set in enzyme.configure
#1836
Comments
Hmm - are you saying that I see what you mean about the (as for testing whether the parent has "my-class", i'm not confident that react leaves such attributes intact. what if you create a different kind of element, like |
That's correct.
The defaulting only happens among options passed directly into the
What's the best way to provide one beyond the description I provided? I would use codesandbox or something similar for a UI issue, but I'm not sure how to best write and share a sample test suite.
React doesn't touch this part of the DOM because it's above the root of the rendering. We need it for testing CSS and it worked with enzyme 3.3.0 and still works when passing the |
Thanks, that clears it up. I’ll see what i can do. |
- [new] `mount`: `.state()`/`.setState()`: allow calling on children (#1802) - [new] `configuration`: add `reset` - [fix] `makeOptions`: ensure that config-level `attachTo`/`hydrateIn` are inherited into wrapper options (#1836) - [fix] `shallow`/`Utils`: call into adapter’s `isCustomComponentElement` if present (#1832) - [fix] `shallow`/`mount`: throw an explicit error when state is null/undefined - [fix] freeze ROOT_NODES for child wrappers (#1811) - [fix] `shallow`: `.parents`: ensure that one `.find` call does not affect another (#1781) - [fix] `mount`: update after `simulateError` (#1812) - [refactor] `mount`/`shallow`: `getElement`: use `this.single` - [deps] update `babel-preset-airbnb`, `chai`, `eslint`, `mocha`, `enzyme-adapter-utils`, `react-is`, `airbnb-js-shims`
Describe the bug
attachTo
andhydrateIn
options set inenzyme.configure
are ignored.To Reproduce
In a mocha test suite, add the following code in a
before
section:Then in a test, mount any node without options and test whether its parent in the DOM has the class
my-class
. It doesn't.Expected behavior
If
attachTo
is set inconfigure
and not set in the options when callingmount
the option fromconfigure
should be used.Additional context
The issue originated in #1707 and is due to how
mountTargets
gets merged with the configuration. Even if a mount target isundefined
it still overrides the configuration.I can submit a PR to fix this at some point, but I'm not sure when I'll get around to it. I'm happy for someone else to pick it up earlier if they want to.
The text was updated successfully, but these errors were encountered: