@@ -29,6 +29,35 @@ test('load event', async () => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
test('error loaded, click error-text and reload', async () => {
|
||||
const wrapper = mount(List, {
|
||||
propsData: {
|
||||
errorText: 'Request failed. Click to reload...',
|
||||
error: true
|
||||
}
|
||||
});
|
||||
|
||||
mockOffsetParent(wrapper.vm.$el);
|
||||
|
||||
await later();
|
||||
|
||||
expect(wrapper.emitted('load')).toBeFalsy();
|
||||
expect(wrapper.emitted('input')).toBeFalsy();
|
||||
|
||||
// 模拟点击error-text的行为
|
||||
wrapper.setProps({
|
||||
error: false
|
||||
});
|
||||
wrapper.vm.$emit('input', true);
|
||||
wrapper.vm.$emit('load');
|
||||
|
||||
expect(wrapper.vm.$props.error).toBeFalsy();
|
||||
expect(wrapper.emitted('load')).toBeTruthy();
|
||||
expect(wrapper.emitted('input')).toBeTruthy();
|
||||
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
test('finished', async () => {
|
||||
const wrapper = mount(List, {
|
||||
propsData: {
|
||||
|
||||
Reference in New Issue
Block a user