Skip to content

test: skip renderToString tests #581

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

Merged
merged 1 commit into from
May 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions test/specs/mounting-options/provide.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import ComponentWithInject from '~resources/components/component-with-inject.vue
import { injectSupported } from '~resources/utils'
import {
describeWithMountingMethods,
itDoNotRunIf
itDoNotRunIf,
itSkipIf
} from '~resources/utils'

describeWithMountingMethods('options.provide', (mountingMethod) => {
Expand Down Expand Up @@ -57,16 +58,20 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
expect(wrapper.vm.setInBeforeCreate).to.equal('created')
})

itDoNotRunIf(!injectSupported(), 'injects the provide from the config', () => {
config.provide['fromMount'] = 'globalConfig'
itSkipIf(mountingMethod.name === 'renderToString',
'injects the provide from the config', () => {
if (!injectSupported()) {
return
}
config.provide['fromMount'] = 'globalConfig'

const wrapper = mountingMethod(ComponentWithInject)
const HTML = mountingMethod.name === 'renderToString'
? wrapper
: wrapper.html()
const wrapper = mountingMethod(ComponentWithInject)
const HTML = mountingMethod.name === 'renderToString'
? wrapper
: wrapper.html()

expect(HTML).to.contain('globalConfig')
})
expect(HTML).to.contain('globalConfig')
})

itDoNotRunIf(!injectSupported(), 'prioritize mounting options over config', () => {
config.provide['fromMount'] = 'globalConfig'
Expand All @@ -81,13 +86,14 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
expect(HTML).to.contain('_')
})

itDoNotRunIf(!injectSupported(), 'config with function throws', () => {
config.provide = () => {}
itSkipIf(mountingMethod.name === 'renderToString',
'config with function throws', () => {
config.provide = () => {}

expect(() => {
mountingMethod(ComponentWithInject, {
provide: { fromMount: '_' }
})
}).to.throw()
})
expect(() => {
mountingMethod(ComponentWithInject, {
provide: { fromMount: '_' }
})
}).to.throw()
})
})