Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mrksbnc committed Nov 18, 2023
1 parent cd5903a commit 2233e71
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/Badge/__stories__/BoBadge.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const Example: Story = {
},
};

export const Types: Story = {
export const Filled: Story = {
args: {},
render: () => ({
components: { BoBadge },
Expand All @@ -127,6 +127,23 @@ export const Types: Story = {
}),
};

export const Outline: Story = {
args: {},
render: () => ({
components: { BoBadge },
template: `
<div style="display: flex; flex-direction: row; align-items: center; gap: 10px;">
<BoBadge variant="default" size="sm" label="Label" type="outline"/>
<BoBadge variant="info" size="sm" label="Label" type="outline"/>
<BoBadge variant="tertiary" size="sm" label="Label" type="outline"/>
<BoBadge variant="success" size="sm" label="Label" type="outline"/>
<BoBadge variant="danger" size="sm" label="Label" type="outline"/>
<BoBadge variant="warning" size="sm" label="Label" type="outline"/>
</div>
`,
}),
};

export const Sizes: Story = {
args: {},
render: () => ({
Expand Down
58 changes: 58 additions & 0 deletions src/components/Badge/__tests__/BoBadge.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
BadgeSize,
BadgeType,
BadgeVariant,
BoBadge,
} from '@/components/Badge';
import { mount } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';

describe('BoIcon', () => {
it('renders properly', () => {
const wrapper = mount(BoBadge, {
props: {
label: 'test',
},
});
expect(wrapper.html()).toMatchSnapshot();
});

it("renders with 'test' label", () => {
const wrapper = mount(BoBadge, {
props: {
label: 'test',
},
});
expect(wrapper.text()).toBe('test');
});

it('renders with correct size', () => {
const wrapper = mount(BoBadge, {
props: {
label: 'test',
size: BadgeSize.XS,
},
});
expect(wrapper.classes()).toContain('xs');
});

it('renders with correct variant', () => {
const wrapper = mount(BoBadge, {
props: {
label: 'test',
variant: BadgeVariant.Info,
},
});
expect(wrapper.classes()).toContain('info');
});

it('renders with correct type', () => {
const wrapper = mount(BoBadge, {
props: {
label: 'test',
type: BadgeType.Filled,
},
});
expect(wrapper.classes()).toContain('filled');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`BoIcon > renders properly 1`] = `
"<div data-v-13a6fd5b=\\"\\" class=\\"bo-badge default pill filled sm\\">
<!--v-if-->
<!--v-if--><span data-v-13a6fd5b=\\"\\" class=\\"label\\">test</span>
<!--v-if-->
</div>"
`;

0 comments on commit 2233e71

Please sign in to comment.