-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Component unit test this.render() call doesn't support passing in content #182
Comments
👍 |
This issue seems to be down the wrong track. The template passed to Demo: http://jsbin.com/muteqe/edit?html,js,output Closing this for now, as I believe that the demo above shows this works properly. I am happy to reopen if I am incorrect (please tweak the JSBin to demonstrate the issue). |
I would like to use integration test by I can not figure out how can I test async side effect within it. This is why I decided to use unit test for that test. I'll try even little bit more, but I spend whole day on it already. If I have some idea how can I simplify whole problem and simulate it in JSBin I will post link later. Actual component is way too complex. |
What kind of async? It should be possible to do, if you can describe what kind of thing you are doing in your component maybe I can help with a way forward. As it stands, |
This tweak to the JSBin demonstrates the issue: I've got integration tests too, but I wanted to have unit tests that check out the internal API of my component to make sure they work correctly. My component needs to process content passed through to it to set up its state. |
When using a component unit test, you cannot supply arguments to |
For example. How can I fix this integration test if there is no |
I'm currently writing a component that on
didInsertElement
looks at it's content and updates some internal state. The template for the component has a{{yield}}
for this content.When I came to write a unit test for this behaviour in the vein of an integration test I wrote a call to
this.render
passing in some markup, expecting it to be rendered in the component's{{yield}}
. My test then checked the internal state of the component to see if things had worked correctly, but sadly the test failed. My processing call had been made, but it found no content to work with.The reason for this appears to be that
this.render
in unit tests works differently from their integration test counterparts, and content passed in gets ignored and thrown away.I have worked around this by explicitly setting
component.element.innerHTML
and then calling my processing routine, however this feels like a bodge. It's not providing a proper test for how the component is intended to be used.Can we have
this.render
work more consistently please?The text was updated successfully, but these errors were encountered: