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 scoped slots option #507

Merged
merged 22 commits into from
Apr 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/en/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ You can pass text to `slots`.
There is a limitation to this.

This does not support PhantomJS.
Please use [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer).
You can use [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer) as an alternative.

### `scopedSlots`

Expand All @@ -82,7 +82,7 @@ There are three limitations.
* You can not use `<template>` tag as the root element in the `scopedSlots` option.

* This does not support PhantomJS.
Please use [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer).
You can use [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer) as an alternative.

Example:

Expand Down
2 changes: 1 addition & 1 deletion packages/create-instance/create-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function createInstance (

if (options.scopedSlots) {
if (window.navigator.userAgent.match(/PhantomJS/i)) {
throwError('the scopedSlots option does not support strings in PhantomJS. Please use Puppeteer, or pass a component.')
throwError('the scopedSlots option does not support in PhantomJS. Please use Puppeteer, or pass a component.')
Copy link
Member

Choose a reason for hiding this comment

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

the scopedSlots option does not support in PhantomJS. Please use Puppeteer, or pass a component.
to

the scopedSlots option does not support PhantomJS. Please use Puppeteer, or pass a component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it.

}
const vueVersion = Number(`${Vue.version.split('.')[0]}.${Vue.version.split('.')[1]}`)
if (vueVersion >= 2.5) {
Expand Down
4 changes: 2 additions & 2 deletions test/specs/mounting-options/scopedSlots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
)

itDoNotRunIf(vueVersion < 2.5,
'throws exception when it is seted to template tag at top', () => {
'throws exception when it is seted to a template tag at top', () => {
const fn = () => {
mountingMethod(ComponentWithScopedSlots, {
scopedSlots: {
Expand Down Expand Up @@ -74,7 +74,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
}
})
}
const message = '[vue-test-utils]: the scopedSlots option does not support strings in PhantomJS. Please use Puppeteer, or pass a component.'
const message = '[vue-test-utils]: the scopedSlots option does not support in PhantomJS. Please use Puppeteer, or pass a component.'
expect(fn).to.throw().with.property('message', message)
}
)
Expand Down