10000 The last version 1.0.5 use wrapper.vm change the data, but the wrapper element text was old text · Issue #1677 · vuejs/vue-test-utils · GitHub
[go: up one dir, main page]

Skip to content
The last version 1.0.5 use wrapper.vm change the data, but the wrapper element text was old text #1677
Closed
@npm-ued

Description

@npm-ued

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0