Skip to content

Commit 6b52b74

Browse files
docs(component-testing): fix global component guide for vue 2 and 3 (#5111)
* docs(vue): fix global component guide * docs: correct importing for vue 2 cypress --------- Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
1 parent ef329b1 commit 6b52b74

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

docs/guides/component-testing/vue/examples.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -861,12 +861,11 @@ import Button from '../../src/components/Button.vue'
861861

862862
Cypress.Commands.add('mount', (component, options = {}) => {
863863
// Setup options object
864-
options.extensions = options.extensions || {}
865-
options.extensions.plugins = options.extensions.plugins || []
866-
options.extensions.components = options.extensions.components || {}
864+
options.global = options.global || {}
865+
options.global.components = options.global.components || {}
867866

868867
// Register global components
869-
options.extensions.components['Button'] = Button
868+
options.global.components['Button'] = Button
870869

871870
return mount(component, options)
872871
})
@@ -876,16 +875,16 @@ Cypress.Commands.add('mount', (component, options = {}) => {
876875
<TabItem value="Vue 2">
877876

878877
```js
879-
import { mount } from 'cypress/vue'
878+
import { mount } from 'cypress/vue2'
880879
import Button from '../../src/components/Button.vue'
881880

882881
Cypress.Commands.add('mount', (component, options = {}) => {
883882
// Setup options object
884-
options.global = options.global || {}
885-
options.global.components = options.global.components || {}
883+
options.extensions = options.extensions || {}
884+
options.extensions.components = options.extensions.components || {}
886885

887886
// Register global components
888-
options.global.components['Button'] = Button
887+
options.extensions.components['Button'] = Button
889888

890889
return mount(component, options)
891890
})

0 commit comments

Comments
 (0)