|
1 |
| -import { describeWithShallowAndMount, itDoNotRunIf } from '~resources/utils' |
| 1 | +import { |
| 2 | + describeWithShallowAndMount, |
| 3 | + itDoNotRunIf, |
| 4 | + itSkipIf, |
| 5 | + vueVersion |
| 6 | +} from '~resources/utils' |
2 | 7 | import { config, TransitionStub, TransitionGroupStub, createLocalVue } from '~vue/test-utils'
|
| 8 | +import Vue from 'vue' |
3 | 9 |
|
4 | 10 | describeWithShallowAndMount('config', (mountingMethod) => {
|
5 | 11 | let configStubsSave
|
| 12 | + let consoleError |
| 13 | + let configLogSave |
| 14 | + |
6 | 15 | beforeEach(() => {
|
7 | 16 | TransitionGroupStub.name = 'another-temp-name'
|
8 | 17 | TransitionStub.name = 'a-temp-name'
|
9 | 18 | configStubsSave = config.stubs
|
| 19 | + configLogSave = config.logModifiedComponents |
| 20 | + consoleError = sinon.stub(console, 'error') |
10 | 21 | })
|
11 | 22 |
|
12 | 23 | afterEach(() => {
|
13 | 24 | TransitionGroupStub.name = 'transition-group'
|
14 | 25 | TransitionStub.name = 'transition'
|
15 | 26 | config.stubs = configStubsSave
|
| 27 | + config.logModifiedComponents = configLogSave |
| 28 | + consoleError.restore() |
16 | 29 | })
|
17 | 30 |
|
18 |
| - itDoNotRunIf(mountingMethod.name === 'shallow', |
| 31 | + itDoNotRunIf(mountingMethod.name === 'shallowMount', |
19 | 32 | 'stubs transition and transition-group by default', () => {
|
20 | 33 | const testComponent = {
|
21 | 34 | template: `
|
@@ -121,4 +134,21 @@ describeWithShallowAndMount('config', (mountingMethod) => {
|
121 | 134 | expect(wrapper.contains(TransitionGroupStub)).to.equal(false)
|
122 | 135 | expect(wrapper.contains(TransitionStub)).to.equal(false)
|
123 | 136 | })
|
| 137 | + |
| 138 | + itSkipIf( |
| 139 | + vueVersion < 2.3, |
| 140 | + 'does not log when component is extended if logModifiedComponents is false', () => { |
| 141 | + const ChildComponent = Vue.extend({ |
| 142 | + template: '<span />' |
| 143 | + }) |
| 144 | + const TestComponent = { |
| 145 | + template: '<child-component />', |
| 146 | + components: { |
| 147 | + ChildComponent |
| 148 | + } |
| 149 | + } |
| 150 | + config.logModifiedComponents = false |
| 151 | + mountingMethod(TestComponent) |
| 152 | + expect(consoleError.called).to.equal(false) |
| 153 | + }) |
124 | 154 | })
|
0 commit comments