diff --git a/src/common-components/funnel-footer/funnel-footer.spec.js b/src/common-components/funnel-footer/funnel-footer.spec.js index f1a885dfd..791cd0961 100644 --- a/src/common-components/funnel-footer/funnel-footer.spec.js +++ b/src/common-components/funnel-footer/funnel-footer.spec.js @@ -5,9 +5,17 @@ describe("funnel-footer.vue", () => { it("Should return footer-link class", async () => { // Act - try { + + const r = { + test:"testing", + clientHeight: 10, + classList: { + add: jest.fn(() => ''), + remove: jest.fn() + }, + }; global.document.getElementById = jest.fn().mockImplementation(()=> { - return {} + return r; }); const wrapper = mount(funnelFooter, { @@ -22,9 +30,8 @@ describe("funnel-footer.vue", () => { // Expect expect(link.attributes('class')).toContain("footer-link"); expect(global.document.getElementById).toBeCalled(); - } catch(error) { - console.log(error); - } + expect(r.classList.add).toBeCalledWith("justify-content-end"); + expect(r.classList.remove).toBeCalledWith("justify-content-start"); }); @@ -57,4 +64,32 @@ describe("funnel-footer.vue", () => { expect(input.attributes("class")).toContain("btn-primary"); }); + it("Should return class justify-content-end if paddingHeight < 80px", async () => { + + global.document.getElementById = jest.fn().mockImplementation(()=> { + return { + test:"testing", + clientHeight: 10, + classList: { + add: jest.fn(), + remove: jest.fn() + } + } + }); + + // Act + const wrapper = mount(funnelFooter, { + propsData: { + footer: true + }, + }); + const infoBox = document.getElementById('infoBox'); + // Assert + const stacked = wrapper.find("#stacked"); + wrapper.vm.paddingHeight = 100; + + // Expect + expect(stacked.attributes('class')).toContain("justify-content-end"); + }); + }); diff --git a/src/common-components/funnel-footer/funnel-footer.vue b/src/common-components/funnel-footer/funnel-footer.vue index 05c184b5c..485259088 100644 --- a/src/common-components/funnel-footer/funnel-footer.vue +++ b/src/common-components/funnel-footer/funnel-footer.vue @@ -26,15 +26,16 @@