storj/web/satellite/tests/unit/common/VButton.spec.ts
Vitalii c5bca894fd web/satellite: fix linter
Added imports linting, trailing commas, trailing semicolons, single quotes and spaces between curly braces.

Change-Id: I5de5d3eea48753dfe2737983b230bafaffe898c8
2022-09-09 11:02:04 +00:00

89 lines
2.3 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { mount, shallowMount } from '@vue/test-utils';
import Button from '@/components/common/VButton.vue';
describe('Button.vue', () => {
it('renders correctly', () => {
const wrapper = shallowMount(Button, {
propsData: {
onPress: () => { return; },
},
});
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with isWhite prop', () => {
const wrapper = shallowMount(Button, {
propsData: {
isWhite: true,
onPress: () => { return; },
},
});
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with isDisabled prop', () => {
const wrapper = shallowMount(Button, {
propsData: {
isDisabled: true,
onPress: () => { return; },
},
});
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with size and label props', () => {
const label = 'testLabel';
const width = '30px';
const height = '20px';
const wrapper = shallowMount(Button, {
propsData: {
label,
width,
height,
onPress: () => { return; },
},
});
const el = wrapper.element as HTMLElement;
expect(el.style.width).toMatch(width);
expect(el.style.height).toMatch(height);
expect(wrapper.text()).toMatch(label);
});
it('renders correctly with default props', () => {
const wrapper = shallowMount(Button, {
propsData: {
onPress: () => { return; },
},
});
const el = wrapper.element as HTMLElement;
expect(el.style.width).toMatch('inherit');
expect(el.style.height).toMatch('inherit');
expect(wrapper.text()).toMatch('Default');
});
it('trigger onPress correctly', () => {
const onPressSpy = jest.fn();
const wrapper = mount(Button, {
propsData: {
onPress: onPressSpy,
isDisabled: false,
},
});
wrapper.find('div.container').trigger('click');
expect(onPressSpy).toHaveBeenCalledTimes(1);
});
});