test: await trigger

This commit is contained in:
chenjiahan
2020-12-29 20:33:41 +08:00
parent b3feaf01c9
commit 650f6cdacd
3 changed files with 9 additions and 11 deletions
+3 -5
View File
@@ -22,15 +22,13 @@ test('should emit "update:modelValue" event when checkbox is clicked', async ()
const items = wrapper.findAll('.van-checkbox');
items[0].trigger('click');
await items[0].trigger('click');
expect(wrapper.vm.value).toEqual(['a']);
await nextTick();
items[1].trigger('click');
await items[1].trigger('click');
expect(wrapper.vm.value).toEqual(['a', 'b']);
await nextTick();
items[0].trigger('click');
await items[0].trigger('click');
expect(wrapper.vm.value).toEqual(['b']);
});