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

Commit ebf76bc

Browse files
authored
feat: add tests for ActionBar component (#216)
1 parent 1f4a470 commit ebf76bc

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-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 ActionBar from "../ActionBar.vue";
3+
4+
describe("ActionBar", () => {
5+
it("renders correctly", () => {
6+
const wrapper = mount(ActionBar, {
7+
propsData: {
8+
title: "Page Title",
9+
description: "Action bar descrtiption",
10+
},
11+
slots: {
12+
back: 'Back',
13+
default: 'Actions'
14+
}
15+
});
16+
expect(wrapper.element).toMatchSnapshot();
17+
});
18+
19+
it("renders without description", () => {
20+
const wrapper = mount(ActionBar, {
21+
propsData: {
22+
title: "Page Title",
23+
},
24+
slots: {
25+
back: 'Back',
26+
default: 'Actions'
27+
}
28+
});
29+
expect(wrapper.element).toMatchSnapshot();
30+
expect(wrapper.find(".fd-action-bar__description").exists()).toBe(false);
31+
});
32+
})
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`ActionBar renders correctly 1`] = `
4+
<div
5+
class="fd-action-bar"
6+
>
7+
<div
8+
class="fd-action-bar__back"
9+
>
10+
Back
11+
</div>
12+
13+
<div
14+
class="fd-action-bar__header"
15+
>
16+
<h1
17+
class="fd-action-bar__title"
18+
>
19+
Page Title
20+
</h1>
21+
22+
<p
23+
class="fd-action-bar__description"
24+
>
25+
26+
Action bar descrtiption
27+
28+
</p>
29+
</div>
30+
31+
<div
32+
class="fd-action-bar__actions"
33+
>
34+
Actions
35+
</div>
36+
</div>
37+
`;
38+
39+
exports[`ActionBar renders without description 1`] = `
40+
<div
41+
class="fd-action-bar"
42+
>
43+
<div
44+
class="fd-action-bar__back"
45+
>
46+
Back
47+
</div>
48+
49+
<div
50+
class="fd-action-bar__header"
51+
>
52+
<h1
53+
class="fd-action-bar__title"
54+
>
55+
Page Title
56+
</h1>
57+
58+
<!---->
59+
</div>
60+
61+
<div
62+
class="fd-action-bar__actions"
63+
>
64+
Actions
65+
</div>
66+
</div>
67+
`;

0 commit comments

Comments
 (0)