-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
mockDOMSource can't mock events for isolated nested components #279
Comments
I should mention, I've not had any ideas on how to solve this yet :) it may simply force isolation to be implemented in or copied to |
That's a tricky one. I have no idea how we could get past this, but what I know for sure is that the implementation should "force" us to be explicit about the fact that we mock events and observables for a nested component, otherwise reading the tests might make no sense to the reader ("why is he mocking a click on selector x? It doesn't event exists.") |
Seems like mockDOMSource needs to take isolation into account. Thanks for pointing this out. |
Lifting this from priority 3 to 4. |
Based on classNames, not on Snabbdom isolate module. Fixes issue cyclejs/cyclejs#279.
Done in Cycle DOM v10.1.0 |
There isn't a way to differentiate events mocked with
mockDOMSource
, where nested components are listening to events on the same namespace and relying on isolation to differentiate them.For example, something like: https://jsfiddle.net/25a74k0k/.
The only way I can think to achieve this, is to pass in a custom class to the child (made unique by the parent), add it to the elements being listened to, and then use that custom class when selecting them. However, this is complicating the way a child must be initialised and basically duplicating what we are getting from
isolate
on the realDOMSource
.Also, in cases where
:root
is the only selector used, the child would have to wrap the root element in another element to be able to select the custom class, which bloats the mark up.The text was updated successfully, but these errors were encountered: