Skip to content

Commit af94764

Browse files
da-snapigeligel
authored andcommitted
test: Add spec for VTag that router is called (gothinkster#230)
This is linked to gothinkster#195
1 parent b64146c commit af94764

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/unit/components/VTag.spec.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { mount, createLocalVue } from "@vue/test-utils";
2+
3+
import router from "../../../src/router/index";
4+
import VTag from "../../../src/components/VTag";
5+
6+
const localVue = createLocalVue();
7+
const createWrapper = () => {
8+
return mount(VTag, {
9+
localVue,
10+
router,
11+
propsData: {
12+
name: "Foo"
13+
}
14+
});
15+
};
16+
17+
describe("VTag", () => {
18+
it("should update the route on click", async () => {
19+
const wrapper = createWrapper();
20+
const routerBefore = wrapper.vm.$route.path;
21+
wrapper.find("a").trigger("click");
22+
await localVue.nextTick();
23+
expect(wrapper.vm.$route.path).not.toBe(routerBefore);
24+
});
25+
});

0 commit comments

Comments
 (0)