Skip to content

Component template requires a root element, rather than just text #707

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

Closed
wagerfield opened this issue Jun 12, 2018 · 3 comments
Closed
Labels

Comments

@wagerfield
Copy link

Version

1.0.0-beta.18

Reproduction link

https://codesandbox.io/s/o1r1qw3qq

Steps to reproduce

  1. Take a look at src/TestComponent.spec.js
  2. Look at the Console tab and observe the error:
[Vue warn]: Error compiling template:

Hello

- Component template requires a root element, rather than just text.
  1. Look at Tests tab and observe that both the "mount with default slot" and "shallowMount with default slot" are failing when using the default slot to pass some text to the TestComponent

What is expected?

All tests should pass. The two tests "with default slot" should match the expected html <button>Hello</button>

What is actually happening?

The 2 failing tests are rendering the html <button><div></div></button>


If you roll back to @vue/[email protected] the tests pass, so this is clearly a bug with the latest beta release.

@cdbkr
Copy link
Contributor

cdbkr commented Jun 12, 2018

to me, this is similar to #693 . CompileToFunctions seems not handling text only. Since a string is not generating a valid AST and throwing errors, then maybe it makes sense to reconsider the approach and rely on the compile function only (where it makes sense).

@38elements
Copy link
Contributor

I think putting text to slots mounting option is not supported after 1.0.0-beta.17.

@eddyerburgh
Copy link
Member

There was a breaking change where we no longer resolve values in slots (like this.someVal).

This is a bug that we should fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants