storj/web/satellite/tests/unit/ignore/common/VCheckbox.spec.ts
NickolaiYurchenko bb170a9d57 web/satellite: VCheckbox, VButton migrated to use composition api
related tests moved to ignored folder or fixed and will be changed after;

Change-Id: Idb4b1a93ac176b98184c746222b5cd1e30dad595
2022-12-15 18:10:08 +00:00

42 lines
1.2 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { mount, shallowMount } from '@vue/test-utils';
import Checkbox from '@/components/common/VCheckbox.vue';
describe('Checkbox.vue', () => {
it('renders correctly', () => {
const wrapper = shallowMount(Checkbox);
expect(wrapper).toMatchSnapshot();
});
it('emit setData on change correctly', () => {
const wrapper = mount(Checkbox);
wrapper.find('input').trigger('change');
wrapper.find('input').trigger('change');
const emittedSetData = wrapper.emitted('setData');
if (emittedSetData) expect(emittedSetData.length).toEqual(2);
});
it('emits with data correctly', () => {
const wrapper = mount(Checkbox);
wrapper.vm.$emit('setData', true);
const emittedSetData = wrapper.emitted('setData');
if (emittedSetData) expect(emittedSetData[0][0]).toEqual(true);
});
it('renders correctly with error', () => {
const wrapper = shallowMount(Checkbox, {
propsData: { isCheckboxError: true },
});
expect(wrapper).toMatchSnapshot();
});
});