60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
import { mount } from "@vue/test-utils";
|
|
import funnelFooter from "./funnel-footer";
|
|
|
|
describe("funnel-footer.vue", () => {
|
|
|
|
it("Should return footer-link class", async () => {
|
|
// Act
|
|
|
|
const r = {
|
|
test:"testing",
|
|
clientHeight: 10,
|
|
offsetHeight: 24,
|
|
};
|
|
|
|
global.document.querySelector = jest.fn().mockImplementation(()=> {
|
|
return r;
|
|
});
|
|
|
|
const wrapper = mount(funnelFooter, {
|
|
});
|
|
|
|
// Assert
|
|
const link = wrapper.find("a");
|
|
console.log(wrapper.html());
|
|
|
|
// Expect
|
|
expect(link.attributes('class')).toContain("footer");
|
|
|
|
});
|
|
|
|
it("Should return link text", async () => {
|
|
// Act
|
|
const wrapper = mount(funnelFooter, {
|
|
propsData: {
|
|
text: "Terms of use",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const link = wrapper.find("a");
|
|
|
|
expect(link.text()).toEqual("Terms of use");
|
|
});
|
|
|
|
it("Should return class btn-primary", async () => {
|
|
// Act
|
|
const wrapper = mount(funnelFooter, {
|
|
propsData: {
|
|
isPrimary: true,
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("button");
|
|
|
|
// Expect
|
|
expect(input.attributes("class")).toContain("btn-primary");
|
|
});
|
|
|
|
});
|