Skip to content

Commit 70e8651

Browse files
author
Jamie Stumme
committed
Update for PR comments
1 parent cf843c9 commit 70e8651

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"test:types": "tsc -p packages/test-utils/types && tsc -p packages/server-test-utils/types"
3232
},
3333
"dependencies": {
34-
"@vue/composition-api": "^0.3.2",
3534
"babel-core": "^6.26.0",
3635
"babel-eslint": "^8.2.2",
3736
"babel-loader": "^7.1.3",
@@ -89,5 +88,8 @@
8988
"vuex": "^3.0.1",
9089
"webpack": "^3.0.1",
9190
"webpack-node-externals": "^1.6.0"
91+
},
92+
"devDependencies": {
93+
"@vue/composition-api": "^0.3.2"
9294
}
9395
}

Diff for: test/resources/components/component-with-inject-composition.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
</template>
44

55
<script>
6-
import { createComponent, inject } from '@vue/composition-api'
6+
import { createComponent, inject, ref } from '@vue/composition-api'
77
88
export default createComponent({
99
name: 'component-with-inject-composition',
1010
setup: () => {
1111
const fromMount = inject('fromMount')
12-
const setInBeforeCreate = 'created'
12+
const setInSetup = ref('created')
1313
1414
return {
1515
fromMount,
16-
setInBeforeCreate
16+
setInSetup
1717
}
1818
}
1919
})

Diff for: test/specs/mounting-options/provide.spec.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ describeWithShallowAndMount('options.provide', mountingMethod => {
6161
}
6262
)
6363

64+
itDoNotRunIf(
65+
!injectSupported || mountingMethod.name === 'renderToString',
66+
'supports setup in composition api component',
67+
() => {
68+
if (!injectSupported) return
69+
70+
const localVue = createLocalVue()
71+
localVue.use(VueCompositionApi)
72+
const wrapper = mountingMethod(CompositionComponentWithInject, {
73+
provide: { fromMount: '_' },
74+
localVue
75+
})
76+
77+
expect(wrapper.vm.setInSetup).to.equal('created')
78+
}
79+
)
80+
6481
itSkipIf(
6582
mountingMethod.name === 'renderToString',
6683
'injects the provide from the config',
@@ -105,7 +122,7 @@ describeWithShallowAndMount('options.provide', mountingMethod => {
105122
)
106123

107124
it('config with function throws', () => {
108-
config.provide = () => {}
125+
config.provide = () => { }
109126

110127
expect(() => {
111128
mountingMethod(ComponentWithInject, {

0 commit comments

Comments
 (0)