You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
Hi,
Do you know how to test @InjectReactive() on vue-test-utils? If you know anything about it, pls leave a comment.
Here is my child component:
@ComponentexportdefaultclassCarrierFiltersextendsMixins(PreferencesMixin){
@InjectReactive()readonlyserviceLevels!: CarrierFilterType[];// more code here...
Here is my test file:
describe('Settings > Preferences > Content > CarrierFilters.vue',()=>{beforeAll(()=>{PreferencesService.getUserPreferences=()=>{return{ ...mockPreferencesData};};});beforeEach(()=>{options={
localVue,
i18n,
store,
router,vuetify: newVuetify(),provide: {// I am not sure how to provide the inject reactive data here...?__reactiveInject__: 'serviceLevels',serviceLevels: ()=>[...supportedServiceLevels],},};initWrapper=shallowMount(CarrierFilters,options);});// more code here...
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
在文件
vue-property-decorator/src/helpers/provideInject.ts
中的函数 inheritInjected,inject 的默认值不应该是() => ({})
吗?这是一个低级错误,所以我以为作者可能是故意这么设计的,但想不出原因。
这个问题引发了我项目的一个BUG,父组件被刷新时,新的父子组件将会断开联系,InjectReactive 引用的是旧的父组件实例的值。
设计一个 demo 重现 BUG, 代码如下
修改 default 的值为
()=>({})
时,我的BUG将会消失。只是想不能作者的意图何在,望解惑。The text was updated successfully, but these errors were encountered: