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

feat: add support for JSX and strings without a slot-scope attribute #871

Merged
merged 8 commits into from
Jul 29, 2018

Conversation

eddyerburgh
Copy link
Member

@eddyerburgh eddyerburgh commented Jul 29, 2018

  • remove window dependency from scoped slots
  • allow template tags as root node

cc @38elements

Closes #657

@38elements
Copy link
Contributor

38elements commented Jul 29, 2018

I think it is necessary to change document.
https://github.com/vuejs/vue-test-utils/blob/e840892fb5dc2a6f68304f21e5603648c3b1a744/docs/api/options.md#scopedslots

`the scopedSlots option does not support PhantomJS. ` +
`Please use Puppeteer, or pass a component.`
)
}
if (vueVersion < 2.5) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If template tag in scopedSlots mounting options works normally,
I think this limitation is not necessary.
I added this limitation since template tag in scopedSlots mounting options did not work.

https://vuejs.org/v2/guide/components-slots.html#Scoped-Slots

In 2.5.0+, slot-scope is no longer limited to the element, but can instead be used on any element or component in the slot.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes you can add to either a tag or any other tag

Copy link
Contributor

@38elements 38elements Jul 29, 2018

Choose a reason for hiding this comment

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

I see.
Since vueVersion < 2.5 limitation is not necessary, validateEnvironment() is not necessary.
vueVersion < 2.5 limitation is not necessary, vueVersion < 2.1 limitation is necessary.

New in 2.1.0+

)
}
}
const scopedSlotRe = /<[^>]+ slot-scope=\"(.+)\"/
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, I think slotScopeRe is better.

@eddyerburgh eddyerburgh changed the title refactor: remove window dependency from scoped slots feat: add support for JSX and strings without a slot-scope attribute Jul 29, 2018
if (vueVersion < 2.5) {
throwError(`the scopedSlots option is only supported in ` + `vue@2.5+.`)
if (vueVersion < 2.1) {
throwError(`the scopedSlots option is only supported in ` + `vue@2.1+.`)
Copy link
Contributor

Choose a reason for hiding this comment

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

the scopedSlots option is only supported in + [email protected]+.

the scopedSlots option is only supported in [email protected]+.

scopedSlots[name] = function (props) {
if (isDestructuring) {
return render.call({ ...helpers, ...props })
for (const s in scopedSlotsOption) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think slotName is better then s.

@eddyerburgh eddyerburgh merged commit 13bcaeb into vuejs:dev Jul 29, 2018
@eddyerburgh eddyerburgh deleted the remove-window-dependency branch July 29, 2018 18:02
kuitos pushed a commit to kuitos/vue-test-utils that referenced this pull request Aug 2, 2018
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