storj/web/satellite/tests/unit/common/Checkbox.spec.ts
Egon Elbre b4e9d7eefe linting satellite code (#1331)
* ignore coverage folder

* add ident constraint to tslint.json

* npm run lint

* add missing empty line

* fix hasInputError lint
2019-02-20 15:33:56 +02:00

44 lines
1.0 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/Checkbox.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');
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();
});
});