Files
n8n-enterprise-unlocked/packages/design-system/src/components/N8nButton/__tests__/Button.spec.ts
Csaba Tuncsik ec2c55211c refactor(design-system): merge n8n square button into n8n button (#4075)
* feat(design-system): button as square shape

* refactor(editor-ui): drop n8n-square-button in favor of n8n-button

* refactor(design-system): remove obsolete n8n-square-button

* fix(design-system): icon only square button icon position

* fix(design-system): icon only square button icon position

* chore(design-system): update button test snapshot

* fix(design-system): overriding default square button styles

* fix(editor-ui): using tertiary button variant in survey without local style overrides

* refactor(design-system): simplifying and partially merging icon-button and button

* fix(design-system): remove unused prop from icon-button

* fix(design-system): square button should have the old dimensions

* fix(design-system): square button update test snapshots
2022-09-15 11:41:12 +02:00

77 lines
1.5 KiB
TypeScript

import {render} from '@testing-library/vue';
import N8nButton from "../Button.vue";
import ElButton from "../overrides/ElButton.vue";
const slots = {
default: 'Button',
};
const stubs = ['n8n-spinner', 'n8n-icon'];
describe('components', () => {
describe('N8nButton', () => {
it('should render correctly', () => {
const wrapper = render(N8nButton, {
slots,
stubs,
});
expect(wrapper.html()).toMatchSnapshot();
});
describe('props', () => {
describe('loading', () => {
it('should render loading spinner', () => {
const wrapper = render(N8nButton, {
props: {
loading: true,
},
slots,
stubs,
});
expect(wrapper.html()).toMatchSnapshot();
});
});
describe('icon', () => {
it('should render icon button', () => {
const wrapper = render(N8nButton, {
props: {
icon: 'plus-circle',
},
slots,
stubs,
});
expect(wrapper.html()).toMatchSnapshot();
});
});
describe('square', () => {
it('should render square button', () => {
const wrapper = render(N8nButton, {
props: {
square: true,
label: '48',
},
stubs,
});
expect(wrapper.html()).toMatchSnapshot();
});
});
});
describe('overrides', () => {
it('should render correctly', () => {
const wrapper = render(ElButton, {
props: {
icon: 'plus-circle',
type: 'secondary',
},
slots,
stubs,
});
expect(wrapper.html()).toMatchSnapshot();
});
});
});
});