Skip to content
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

The last version 1.0.5 use wrapper.vm change the data, but the wrapper element text was old text #1677

Closed
npm-ued opened this issue Sep 2, 2020 · 1 comment

Comments

@npm-ued
Copy link

npm-ued commented Sep 2, 2020

Subject of the issue

The last version 1.0.5 use wrapper.vm change the data, but the wrapper element text was old text

Steps to reproduce

the test.vue
`

{{ count }} Increment
{{testValue ? 'a': 'b'}}
<script> export default { data () { return { count: 0, testValue: true }; },

methods: {
increment () {
this.count++;
}
}
};
</script>`

the test unit
`import { shallowMount } from '@vue/test-utils';
import Test from '@/components/test';

describe('Test Components', () => {
let wrapper;
// 每个it开始之前执行
beforeEach(() => {
// 初始化wrapper
wrapper = shallowMount(Test);
});
// 每个it结束时执行
afterEach(() => {
// 销毁wrapper
wrapper.destroy();
});

it('show and hide', () => {
const text = wrapper.find('.testText');
expect(text.text()).toBe('a');
wrapper.vm.testValue = false;
expect(text.text()).toBe('b');
});
});`

Expected behaviour

use @vue/test-utils 1.0.5

Actual behaviour

the unit test is failed

Possible Solution

use 1.0.0-beta.29 is passed

@npm-ued
Copy link
Author

npm-ued commented Sep 2, 2020

use setData() method solve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant