Skip to content

Commit d16ceb7

Browse files
committed
fix(config): Do not use config.renderStubDefaultSlot
* docs mention config.global.renderStubDefaultSlot * get rid of double definition
1 parent 77bfbe2 commit d16ceb7

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

docs/guide/advanced/stubs-shallow-mount.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,11 @@ For this use case, you can use `config.renderStubDefaultSlot`, which will render
275275
import { config, mount } from '@vue/test-utils'
276276

277277
beforeAll(() => {
278-
config.renderStubDefaultSlot = true
278+
config.global.renderStubDefaultSlot = true
279279
})
280280

281281
afterAll(() => {
282-
config.renderStubDefaultSlot = false
282+
config.global.renderStubDefaultSlot = false
283283
})
284284

285285
test('shallow with stubs', () => {
@@ -316,4 +316,4 @@ So regardless of which mounting method you choose, we suggest keeping these guid
316316

317317
- use `global.stubs` to replace a component with a dummy one to simplify your tests
318318
- use `shallow: true` (or `shallowMount`) to stub out all child components
319-
- use `config.renderStubDefaultSlot` to render the default `<slot>` for a stubbed component
319+
- use `global.renderStubDefaultSlot` to render the default `<slot>` for a stubbed component

docs/migration/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ You can enable the old behavior like this:
206206
```js
207207
import { config } from '@vue/test-utils'
208208

209-
config.renderStubDefaultSlot = true
209+
config.global.renderStubDefaultSlot = true
210210
```
211211
212212
### `destroy` is now `unmount` to match Vue 3

src/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export interface GlobalConfigOptions {
1212
DOMWrapper: Pluggable<DOMWrapper<Node>>
1313
createStubs?: CustomCreateStub
1414
}
15-
renderStubDefaultSlot: boolean
1615
}
1716

1817
interface Plugin<Instance, O> {
@@ -80,6 +79,5 @@ export const config: GlobalConfigOptions = {
8079
plugins: {
8180
VueWrapper: new Pluggable(),
8281
DOMWrapper: new Pluggable()
83-
},
84-
renderStubDefaultSlot: false
82+
}
8583
}

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export function mergeGlobalProperties(
4040

4141
const renderStubDefaultSlot =
4242
mountGlobal.renderStubDefaultSlot ??
43-
config?.renderStubDefaultSlot ??
44-
configGlobal?.renderStubDefaultSlot
43+
configGlobal?.renderStubDefaultSlot ??
44+
false
4545

4646
return {
4747
mixins: [...(configGlobal.mixins || []), ...(mountGlobal.mixins || [])],

tests/mountingOptions/global.stubs.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,11 @@ describe('mounting options: stubs', () => {
731731
}
732732

733733
afterEach(() => {
734-
config.renderStubDefaultSlot = false
734+
config.global.renderStubDefaultSlot = false
735735
})
736736

737737
it('renders only the default stub slot only behind flag', () => {
738-
config.renderStubDefaultSlot = true
738+
config.global.renderStubDefaultSlot = true
739739

740740
const wrapper = mount(Component, {
741741
global: {
@@ -750,7 +750,7 @@ describe('mounting options: stubs', () => {
750750
})
751751

752752
it('renders none of the slots on a stub', () => {
753-
config.renderStubDefaultSlot = false
753+
config.global.renderStubDefaultSlot = false
754754
const wrapper = mount(Component, {
755755
global: {
756756
stubs: ['ComponentWithSlots']
@@ -764,7 +764,7 @@ describe('mounting options: stubs', () => {
764764
})
765765

766766
it('renders the default slot of deeply nested stubs when renderStubDefaultSlot=true', () => {
767-
config.renderStubDefaultSlot = true
767+
config.global.renderStubDefaultSlot = true
768768

769769
const SimpleSlot = {
770770
name: 'SimpleSlot',

0 commit comments

Comments
 (0)