storj/web/satellite/tests/unit/common/VCheckbox.spec.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import Checkbox from '@/components/common/VCheckbox.vue';
2019-09-09 11:33:39 +01:00
import { mount, shallowMount } from '@vue/test-utils';
2019-09-09 11:33:39 +01:00
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');
expect(wrapper.emitted('setData').length).toEqual(2);
});
it('emits with data correctly', () => {
const wrapper = mount(Checkbox);
wrapper.vm.$emit('setData', true);
expect(wrapper.emitted('setData')[0][0]).toEqual(true);
});
it('renders correctly with error', () => {
const wrapper = shallowMount(Checkbox, {
propsData: {isCheckboxError: true},
});
expect(wrapper).toMatchSnapshot();
});
});