diff --git a/src/common-components/funnel-footer/funnel-footer.spec.js b/src/common-components/funnel-footer/funnel-footer.spec.js index 3d0843e10..ef2049eb5 100644 --- a/src/common-components/funnel-footer/funnel-footer.spec.js +++ b/src/common-components/funnel-footer/funnel-footer.spec.js @@ -1 +1,30 @@ -test.todo("some test to be written in the future"); +import { mount } from "@vue/test-utils"; +import funnelFooter from "./funnel-footer"; + +describe("funnel-footer.vue", () => { + + it("Should return footer-link class", async () => { + // Act + try { + global.document.getElementById = jest.fn().mockImplementation(()=> { + return {} + }); + + const wrapper = mount(funnelFooter, { + propsData: { + footer: true + }, + }); + + // Assert + const link = wrapper.find("a"); + + // Expect + expect(link.attributes('class')).toContain("footer-link"); + expect(global.document.getElementById).toBeCalled(); + } catch(error) { + console.log(error); + } + + }); +}); diff --git a/src/common-components/funnel-footer/funnel-footer.vue b/src/common-components/funnel-footer/funnel-footer.vue index 05976863a..90c380b08 100644 --- a/src/common-components/funnel-footer/funnel-footer.vue +++ b/src/common-components/funnel-footer/funnel-footer.vue @@ -56,24 +56,24 @@ export default { buttonMain }, data() { - return { - paddingHeight: 0 - } - }, - mounted() { - this.paddingHeight = document.getElementById("infoBox").offsetHeight - this.$nextTick(() => { - window.addEventListener('resize', this.onResize); - }) - }, - beforeUnmount() { - window.removeEventListener('resize', this.onResize); - }, - methods: { - onResize() { - this.paddingHeight = document.getElementById("infoBox").offsetHeight - } + return { + paddingHeight: 0 } + }, + mounted() { + this.paddingHeight = document.getElementById("infoBox").offsetHeight; + this.$nextTick(() => { + window.addEventListener('resize', this.onResize); + }) + }, + beforeUnmount() { + window.removeEventListener('resize', this.onResize); + }, + methods: { + onResize() { + this.paddingHeight = document.getElementById("infoBox").offsetHeight; + } + } }; setTimeout(function(){ // Give it a moment to set the date document.getElementById('years').innerHTML += new Date().getFullYear();