68 lines
No EOL
1.5 KiB
JavaScript
68 lines
No EOL
1.5 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, {
|
|
mixins: [mockMixin]
|
|
});
|
|
|
|
// 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, {
|
|
mixins: [mockMixin]
|
|
});
|
|
wrapper.vm.buttonClick();
|
|
// Assert
|
|
expect(wrapper.emitted()["ForwardClicked"][0]).toHaveBeenCalled;
|
|
});
|
|
|
|
it("Should emit BackClicked on link click", async () => {
|
|
// Act
|
|
const wrapper = mount(funnelFooter, {
|
|
mixins: [mockMixin]
|
|
});
|
|
wrapper.vm.linkClick();
|
|
// Assert
|
|
expect(wrapper.emitted()["BackClicked"][0]).toHaveBeenCalled;
|
|
});
|
|
|
|
it("Should change button text when update button text is called", async () => {
|
|
// Act
|
|
const wrapper = mount(funnelFooter, {
|
|
mixins: [mockMixin]
|
|
});
|
|
wrapper.vm.updateButtonText('newText');
|
|
|
|
// Assert
|
|
expect(wrapper.componentVM.customButtontext).toBe('newText');
|
|
});
|
|
|
|
});
|
|
|
|
const mockMixin = {
|
|
methods: {
|
|
getCmsContent: jest.fn(),
|
|
getFooterInfoBoxHeight: jest.fn(()=>80)
|
|
}
|
|
} |