fix(compat): handle and warn config.optionMergeStrategies

This commit is contained in:
Evan You
2021-05-08 16:47:38 -04:00
parent ed6c5fe903
commit 94e69fd389
5 changed files with 48 additions and 9 deletions

View File

@@ -321,6 +321,7 @@ Features that start with `COMPILER_` are compiler-specific: if you are using the
| GLOBAL_OBSERVABLE | ● | `Vue.observable` removed (use `reactive`) | [link](https://v3.vuejs.org/api/basic-reactivity.html) |
| CONFIG_KEY_CODES | ● | config.keyCodes rmeoved | [link](https://v3.vuejs.org/guide/migration/keycode-modifiers.html) |
| CONFIG_WHITESPACE | ● | In Vue 3 whitespace defaults to `"condense"` | |
| CONFIG_OPTION_MERGE_STRATS | ● | Vue 3 no longer exposes internal option merge strats | |
| INSTANCE_SET | ● | `vm.$set` removed (no longer needed) | |
| INSTANCE_DELETE | ● | `vm.$delete` removed (no longer needed) | |
| INSTANCE_EVENT_EMITTER | ● | `vm.$on`, `vm.$off`, `vm.$once` removed | [link](https://v3.vuejs.org/guide/migration/events-api.html) |

View File

@@ -1,5 +1,8 @@
import Vue from '@vue/compat'
import { toggleDeprecationWarning } from '../../runtime-core/src/compat/compatConfig'
import {
DeprecationTypes,
toggleDeprecationWarning
} from '../../runtime-core/src/compat/compatConfig'
import { createApp } from '../src/esm-index'
import { triggerEvent } from './utils'
@@ -74,3 +77,9 @@ test('singleton config should affect apps created with createApp()', () => {
}).mount(el)
expect(el.innerHTML).toBe(`<v-foo></v-foo><foo></foo>`)
})
test('config.optionMergeStrategies', () => {
toggleDeprecationWarning(true)
expect(typeof Vue.config.optionMergeStrategies.created).toBe('function')
expect(DeprecationTypes.CONFIG_OPTION_MERGE_STRATS).toHaveBeenWarned()
})