Skip to content

Commit ba457d8

Browse files
committed
working with props
1 parent 96864ff commit ba457d8

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/unit/example.spec.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
import { mount } from "@vue/test-utils";
22

33
const App = {
4+
props: {
5+
count: {
6+
type: Number,
7+
},
8+
},
49
template: `
5-
<div>Hello</div>
10+
<div v-if="count % 2 === 0">
11+
Count: {{ count }}. Count is even.
12+
</div>
13+
14+
<div v-if="count % 2 !== 0">
15+
Count: {{ count }}. Count is odd.
16+
</div>
617
`,
718
};
819

920
test("App", () => {
10-
const wrapper = mount(App);
11-
expect(wrapper.html()).toBe("<div>Hello</div>");
21+
const wrapper = mount(App, {
22+
props: {
23+
count: 1,
24+
},
25+
});
26+
expect(wrapper.html()).toContain("Count: 1");
1227
});

0 commit comments

Comments
 (0)