Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
methods: {
validate: validateSpy
}
})
wrapper.find('input').element.value = 'test'
wrapper.find('input').trigger('input')
expect(wrapper.vm.currentValue).toBe('test')
expect(validateSpy).toHaveBeenCalled()
// reset the spy states
validateSpy.mockClear()
// do not validate on input
wrapper = shallowMount(Input, {
propsData: {
validateMode: {
onInput: false
}
},
methods: {
validate: validateSpy
}
})
wrapper.find('input').element.value = 'test'
wrapper.find('input').trigger('input')
expect(validateSpy).not.toHaveBeenCalled()
})
test('create', () => {
const wrapper = shallowMount(Badge, {
propsData: {},
})
expect(wrapper.classes()).toContain('weui-badge')
expect(wrapper.html()).toMatchSnapshot()
})
it("can determine if an object is pre-selected", () => {
const Select = shallowMount(VueSelect, {
propsData: {
reduce: option => option.id,
value: "foo",
options: [
{
id: "foo",
label: "This is Foo"
}
]
}
});
expect(
Select.vm.isOptionSelected({
id: "foo",
label: "This is Foo"
it('throws an error if sum of the section values exceed total', () => {
const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {});
const [total, sections] = [50, [{ value: 25 }, { value: 26 }]];
let errorThrown = false;
try {
shallowMount(Donut, { propsData: { total, sections } });
}
catch (error) {
errorThrown = true;
expect(error.message).toContain('should not exceed');
}
finally {
expect(errorThrown).toBe(true);
spy.mockRestore();
}
});
});
it('is a Vue component', () => {
const wrapper = shallowMount(Modal)
expect(wrapper.isVueInstance()).toBe(true)
})
loading: false,
error: undefined
},
parameters: {
loading: false,
error: undefined
}
}
}
const args = {
mocks: {
$store,
$apollo
}
}
wrapper = shallowMount(PageProposals, args)
})
it('has correct default props data', () => {
const wrapper = shallowMount(PlantTags, options)
expect(wrapper.props().tags).toEqual([])
})
const createComponent = (propsData) => {
wrapper = shallowMount(App, { propsData });
};
const createComponent = (props) => {
wrapper = shallowMount(formComponent, {
propsData: {
...defaultProps,
...props,
},
});
};
beforeEach(() => {
wrapper = shallowMount(DashboardPanel, {
propsData: {
clipboardText: exampleText,
settingsPath: dashboardProps.settingsPath,
graphData: {
y_label: 'metric',
...graphData,
},
},
store,
});
return wrapper.vm.$nextTick();
});