Performance: Testing user interactions
MEDIUM IMPACT
Testing user interactions affects the responsiveness and smoothness of UI updates after user input.
import { mount } from '@vue/test-utils'; const wrapper = mount(MyComponent); await wrapper.find('button').trigger('click'); await wrapper.find('input').setValue('test');
import { mount } from '@vue/test-utils'; const wrapper = mount(MyComponent); wrapper.find('button').trigger('click'); await wrapper.vm.$nextTick(); wrapper.find('input').setValue('test'); await wrapper.vm.$nextTick();
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple nextTick calls after each interaction | Multiple small DOM updates | Multiple reflows triggered | Higher paint cost due to repeated layout | [X] Bad |
| Await interactions directly without extra nextTick | Batched DOM updates | Single or minimal reflows | Lower paint cost with efficient updates | [OK] Good |