Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Commit 65359e6

Browse files
CodesOfRaChristianKienle
authored andcommitted
fix: add tests for Counter component
1 parent 4557836 commit 65359e6

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {mount} from "@vue/test-utils";
2+
import {Counter} from "../";
3+
4+
describe("Counter", () => {
5+
const infoCounter = mount(Counter, {
6+
propsData: {
7+
type: "info",
8+
value: 44,
9+
ariaLabel: "Counter"
10+
}
11+
});
12+
const notCounter = mount(Counter, {
13+
propsData: {
14+
type: "notification"
15+
}
16+
});
17+
it("renders correctly", () => {
18+
expect(infoCounter.element).toMatchSnapshot();
19+
expect(notCounter.element).toMatchSnapshot();
20+
});
21+
it("renders type correctly", () => {
22+
expect(infoCounter.classes("fd-counter")).toBe(true);
23+
expect(notCounter.classes("fd-counter--notification")).toBe(true);
24+
});
25+
it("renders value correctly", () => {
26+
expect(infoCounter.props().value).toBe(44);
27+
expect(notCounter.props().value).toBe(0);
28+
});
29+
it("renders ariaLabel correctly", () => {
30+
expect(infoCounter.props().ariaLabel).toBe("Counter");
31+
});
32+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Counter renders correctly 1`] = `
4+
<span
5+
arialabel="Counter"
6+
class="fd-counter"
7+
>
8+
44
9+
</span>
10+
`;
11+
12+
exports[`Counter renders correctly 2`] = `
13+
<span
14+
class="fd-counter fd-counter--notification"
15+
>
16+
0
17+
</span>
18+
`;

0 commit comments

Comments
 (0)