WIP add unit test.
This commit is contained in:
parent
4028fdae7e
commit
ec07dc4730
2 changed files with 47 additions and 18 deletions
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -56,24 +56,24 @@ export default {
|
||||||
buttonMain
|
buttonMain
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
paddingHeight: 0
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
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
|
setTimeout(function(){ // Give it a moment to set the date
|
||||||
document.getElementById('years').innerHTML += new Date().getFullYear();
|
document.getElementById('years').innerHTML += new Date().getFullYear();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue