-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling setData raises 'Cannot read property '$options' of undefined' #653
Comments
Thanks for the bug report. This is a problem with how we have implemented synchronous updating. There's a PR open to fix this by adding an async option to Vue—vuejs/vue#8240. For the moment, the workaround is to set the test('use Vue.nextTick', (done) => {
const wrapper = mount(TestComponent, { sync: false })
wrapper.trigger('click')
Vue.nextTick(() => {
expect(wrapper.text()).toBe('updated')
done()
})
}) |
Thank you providing the update on this and suggesting workaround. 👍 |
I was facing this issue and when i realized a fix was provided, I updated from 1.0.0-beta.16 to 1.0.0-beta.18 and all my tests are breaking. I have a feeling a lot changed especially with the way stubbing is done. Can you please help clarify. Thanks |
There is a bug where stubs and mocks aren't applied correctly to extended components, including the class component. The fix will be released soon. The issue here is still unresolved. |
I have a very similar case, I don't know, if it should be a separate issue: When upgrading from If I use it like this:
then I get
then the error message changes to the one above. Both worked under Any ideas? |
Sorry about this. Can you post a minimal reproduction? |
Steps to reproduce package.json
Component with ElementUI dropdown and table
Test
Test Results
Any idea about this? |
Can you try setting test('use Vue.nextTick', (done) => {
const wrapper = mount(TestComponent, { sync: false })
wrapper.trigger('click')
Vue.nextTick(() => {
expect(wrapper.text()).toBe('updated')
done()
})
}) |
I changed the test as below (sync is set to false and Vue.nextTick is used) But the test results is still the same.
Test Results
|
Can you create a full minimal reproduction that I can run (either on code sandbox or GitHub). Please use the least amount of code possible to reproduce the issue. Then open a new issue with the reproduction. |
@chandrucr maybe you should change |
@BartekZienkiewicz @eddyerburgh I will create a new issue for this. #770 |
submitted new issue (#795) |
The reproduction issue is fixed with the latest version of element-ui—https://codesandbox.io/s/3rvrqrv2vq |
Version
1.0.0-beta.16
Reproduction link
https://codesandbox.io/s/6lm4248qjr
Steps to reproduce
In reproduction link,
1.0.0-beta.12
version is selected on which test is passing. Upgrading to any version after1.0.0-beta.12
causes test to fail with errorCannot read property '$options' of undefined
whensetData
is invoked.What is expected?
Test should pass on later/latest versions as well.
What is actually happening?
Test is failing on
vue-test-utils
latest versions(after1.0.0-beta.12
)Since this worked fine on version
1.0.0-beta.12
, i assume this bug could be side effect of PR #438 merged in version1.0.0-beta.13
, as all ElementUI components used in the sample reproduction link are not functional components, so it should work ok on latest version as well. Links to component's used in this sample are below for reference:https://github.com/ElemeFE/element/blob/v2.3.8/packages/form/src/form.vue
https://github.com/ElemeFE/element/blob/v2.3.8/packages/form/src/form-item.vue
https://github.com/ElemeFE/element/blob/v2.3.8/packages/input/src/input.vue
The text was updated successfully, but these errors were encountered: