CSR-266 add unit tests.
This commit is contained in:
parent
b234dfa4ca
commit
616db70e3e
1 changed files with 68 additions and 1 deletions
|
|
@ -1 +1,68 @@
|
||||||
test.todo("some test to be written in the future");
|
import { shallowMount } from "@vue/test-utils";
|
||||||
|
import textLink from "./text-link";
|
||||||
|
import { nextTick } from "vue";
|
||||||
|
|
||||||
|
describe("text-link.vue", () => {
|
||||||
|
|
||||||
|
it("Should return text-link type is navigation if prop navigation is true", async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(textLink, {
|
||||||
|
propsData: {
|
||||||
|
navigation: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const paragraph = wrapper.find("a");
|
||||||
|
|
||||||
|
// Expect
|
||||||
|
expect(paragraph.attributes('class')).toContain("navigation-link");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should return text-link type is footer if prop footer is true", async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(textLink, {
|
||||||
|
propsData: {
|
||||||
|
footer: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const paragraph = wrapper.find("a");
|
||||||
|
|
||||||
|
// Expect
|
||||||
|
expect(paragraph.attributes('class')).toContain("footer-link");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should return text-link type is textSmall if prop textSmall is true", async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(textLink, {
|
||||||
|
propsData: {
|
||||||
|
textSmall: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const paragraph = wrapper.find("a");
|
||||||
|
|
||||||
|
// Expect
|
||||||
|
expect(paragraph.attributes('class')).toContain("small");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should return text for href", async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(textLink, {
|
||||||
|
propsData: {
|
||||||
|
text: "This is link text"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const paragraph = wrapper.find("a");
|
||||||
|
|
||||||
|
// Expect
|
||||||
|
expect(paragraph.text()).toEqual("This is link text");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue