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, { }); wrapper.vm.initializeComponent(cmsContent); // Assert const link = wrapper.find("a"); // Expect expect(link.attributes('class')).toContain("footer"); }); it("Should emit ForwardClicked on button click", async () => { // Act const wrapper = mount(funnelFooter, { }); wrapper.vm.buttonClick(); // Assert expect(wrapper.emitted()["ForwardClicked"][0]).toHaveBeenCalled; }); it("Should emit BackClicked on link click", async () => { // Act const wrapper = mount(funnelFooter, { }); wrapper.vm.linkClick(); // Assert expect(wrapper.emitted()["BackClicked"][0]).toHaveBeenCalled; }); }); //Mock CMS content const cmsContent = { backLink: "text", buttonText: "text", };