Skip to content
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

add slot key #10

Merged
merged 5 commits into from
Sep 28, 2017
Merged

add slot key #10

merged 5 commits into from
Sep 28, 2017

Conversation

yibuyisheng
Copy link
Contributor

The resolveSlots method in VUE has a if condition: https://github.com/vuejs/vue/blob/684cd7d21aa7cb9a40fb4a8542c4e08fb3801a86/src/core/instance/render-helpers/resolve-slots.js#L24

So we should add slot key for slot vnodes.

Copy link
Owner

@jackmellis jackmellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, could you add a unit test or 2 conveying the use case of this?

@yibuyisheng
Copy link
Contributor Author

@jackmellis I made a demo here: https://jsfiddle.net/2by06fvt/1/ .

The problem is using the template slot.

In VUE's resolveSlots method, it checks template tag and use it's children as the slot: https://github.com/vuejs/vue/blob/684cd7d21aa7cb9a40fb4a8542c4e08fb3801a86/src/core/instance/render-helpers/resolve-slots.js#L29 .

@jackmellis
Copy link
Owner

Yes I think I understand what problem this is solving (many thanks btw). But I would like to have these solutions fully unit tested so there is an audit of all of the handled scenarios within the codebase.

@yibuyisheng
Copy link
Contributor Author

OK, I'll find a time to add some unit tests.

@jackmellis
Copy link
Owner

Thanks dude

…he two adjacent text nodes with different slot prop merged by `normalizeArrayChildren` method in VUE.
@yibuyisheng
Copy link
Contributor Author

@jackmellis I found that the vuenit uses vue.rumtime.common.js, so in the test runtime, it dose not have a template compiler.

But I do not find out why the previous Components in test codes do not cause exceptions.

@jackmellis
Copy link
Owner

Because Vuenit also uses vue-template-compiler to compile the templates before mounting them

@yibuyisheng
Copy link
Contributor Author

But my tests still get these errors:

image

@jackmellis
Copy link
Owner

Ah I think I get it.

@jackmellis
Copy link
Owner

Could you add

mount(Component)

to line 11 of the test file.

It's a little bit of a hack but it should work.

@yibuyisheng
Copy link
Contributor Author

yibuyisheng commented Sep 27, 2017

Could you add

mount(Component)
to line 11 of the test file.

It's a little bit of a hack but it should work.

It works.

@jackmellis jackmellis merged commit 40419c1 into jackmellis:develop Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants