-
Notifications
You must be signed in to change notification settings - Fork 1
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 Stubs evaluate internal templates #13
Comments
Okay so I assume you're testing a component that looks something like: <template>
<div>
<headerBox/>
</div>
</template>
<script>
import headerBox from '...';
export default {
components : {headerBox}
}; and in your test you want to replace headerBox. If that is the case and you're getting a warning relating to a component that should be stubbed, it's probably not stubbing correctly. If I've got the wrong idea and you're actually testing headerBox itself, then no it won't stub the component under test, only its children, if you see what I mean. Any chance you could link to an example of the issue? |
I'm sorry I'm not able to provide a link to the issue but your assumption is correct. So I think you know what I'm talking about. I don't care what headerBox is doing or how it's rendered. console.error node_modules\vue\dist\vue.runtime.common.js:556 Here is more context, but like I said, you nailed it.
|
Interesting that it's actually the I will try to replicate this.. |
I see the stubbed headerbox:
|
No you don't, but the part of your template causing the error is technically part of this component, not headerBox I'm making an assumption here but I would imagine that Vue's render function will evaluate the inner html of your component even if it isn't used in the final render (because the stubbed component doesn't have any Do we want to strip distributed content out of components? I would say no because you could easily create a stubbed component with slots as part of your tests. So what we're really talking about here is what we should be doing with filters (and probably directives). Should they also be stubbable? (I'm not sure how easy that would be). Your workaround seems reasonable to me, or you could add a The |
I think the best solution here is to be able to stub/mock filters as this is what's causing the warning message. Check out this issue which will be part of 0.3.0 |
I've configured vuenit to stub out all components using
stubComponents: true,
and
I get the following error when running the test:
Failed to resolve filter: timeDisplay
The work-around is to use the install method to get around this:
The text was updated successfully, but these errors were encountered: