Update unit test.
This commit is contained in:
parent
18ead1be27
commit
a3fd891d16
5 changed files with 29 additions and 52 deletions
|
|
@ -9,10 +9,7 @@ describe("funnel-footer.vue", () => {
|
||||||
const r = {
|
const r = {
|
||||||
test:"testing",
|
test:"testing",
|
||||||
clientHeight: 10,
|
clientHeight: 10,
|
||||||
classList: {
|
offsetHeight: 24,
|
||||||
add: jest.fn(() => ''),
|
|
||||||
remove: jest.fn()
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
global.document.getElementById = jest.fn().mockImplementation(()=> {
|
global.document.getElementById = jest.fn().mockImplementation(()=> {
|
||||||
|
|
@ -27,10 +24,7 @@ describe("funnel-footer.vue", () => {
|
||||||
console.log(wrapper.html());
|
console.log(wrapper.html());
|
||||||
|
|
||||||
// Expect
|
// Expect
|
||||||
expect(link.attributes('class')).toContain("footer-link");
|
expect(link.attributes('class')).toContain("footer");
|
||||||
expect(global.document.getElementById).toBeCalled();
|
|
||||||
expect(r.classList.add).toBeCalledWith("justify-content-end");
|
|
||||||
expect(r.classList.remove).toBeCalledWith("justify-content-start");
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -63,32 +57,4 @@ describe("funnel-footer.vue", () => {
|
||||||
expect(input.attributes("class")).toContain("btn-primary");
|
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");
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="container-fluid fixed-bottom g-4 bg-light py-4" id="infoBox">
|
<div class="container-fluid fixed-bottom g-4 bg-light py-4" id="infoBox">
|
||||||
<div class="row d-flex flex-row-reverse align-items-center">
|
<div class="row d-flex flex-row-reverse align-items-center">
|
||||||
<div class="col-auto d-flex justify-content-end" id="stacked">
|
<div class="col-12 button-col d-flex justify-content-end" id="stacked">
|
||||||
<buttonMain isPrimary :buttonText="buttonText" loaderColor="white" sizeInRem="1" @click-event="buttonClick"/>
|
<buttonMain isPrimary :buttonText="buttonText" loaderColor="white" sizeInRem="1" @click-event="buttonClick"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col py-1">
|
<div class="col-12 link-col py-1">
|
||||||
<textLink linkType="navigation" :text="backLink" @click-event="linkClick"/>
|
<textLink linkType="navigation" :text="backLink" @click-event="linkClick"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -63,15 +63,6 @@ export default {
|
||||||
checkHeight() {
|
checkHeight() {
|
||||||
const parentHeight = document.getElementById('infoBox').clientHeight;
|
const parentHeight = document.getElementById('infoBox').clientHeight;
|
||||||
const wrapper2 = document.getElementById('stacked');
|
const wrapper2 = document.getElementById('stacked');
|
||||||
console.log(parentHeight);
|
|
||||||
|
|
||||||
if (parentHeight > 80) {
|
|
||||||
wrapper2.classList.add("justify-content-start","w-100");
|
|
||||||
wrapper2.classList.remove("justify-content-end","w-auto");
|
|
||||||
} else {
|
|
||||||
wrapper2.classList.add("justify-content-end");
|
|
||||||
wrapper2.classList.remove("justify-content-start");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
initializeComponent(cmsContent) {
|
initializeComponent(cmsContent) {
|
||||||
this.backLink = cmsContent.BackButtonText;
|
this.backLink = cmsContent.BackButtonText;
|
||||||
|
|
@ -91,9 +82,19 @@ export default {
|
||||||
.footer {
|
.footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
button {
|
.button-col,
|
||||||
min-width: 135px;
|
.link-col,
|
||||||
|
.btn-primary {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@media only screen and (min-width: 340px) {
|
||||||
|
.button-col,
|
||||||
|
.link-col {
|
||||||
|
width: 50% !important;
|
||||||
|
}
|
||||||
|
.btn-primary {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Components
|
// Components
|
||||||
import vehicleDamage from "@/layouts/vehicle-damage/vehicle-damage.vue";
|
import vehicleDamage from "@/layouts/vehicle-damage/vehicle-damage.vue";
|
||||||
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
||||||
|
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
||||||
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
||||||
|
|
@ -221,6 +222,10 @@ function setupMocks({
|
||||||
|
|
||||||
damageLocationQuestion.methods = {
|
damageLocationQuestion.methods = {
|
||||||
initializeComponent: jest.fn(),
|
initializeComponent: jest.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
|
funnelFooter.methods = {
|
||||||
|
initializeComponent: jest.fn(),
|
||||||
}
|
}
|
||||||
|
|
||||||
const mountOptions = getMountOptions(mountOptionsMockData);
|
const mountOptions = getMountOptions(mountOptionsMockData);
|
||||||
|
|
@ -252,5 +257,11 @@ function setupMocks({
|
||||||
damageLocationQuestionWrapper.vm.initializeComponent =
|
damageLocationQuestionWrapper.vm.initializeComponent =
|
||||||
damageLocationQuestion.methods.initializeComponent;
|
damageLocationQuestion.methods.initializeComponent;
|
||||||
|
|
||||||
|
const funnelFooterWrapper = wrapper.findComponent({
|
||||||
|
name: "funnelFooter",
|
||||||
|
});
|
||||||
|
|
||||||
|
funnelFooterWrapper.vm.initializeComponent = funnelFooter.methods.initializeComponent;
|
||||||
|
|
||||||
return { wrapper, apiPromise };
|
return { wrapper, apiPromise };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ body {
|
||||||
|
|
||||||
.container-fluid {
|
.container-fluid {
|
||||||
max-width: 576px; //Remove once desktop app is complete
|
max-width: 576px; //Remove once desktop app is complete
|
||||||
// min-width: 360px;
|
|
||||||
&.container-shadow {
|
&.container-shadow {
|
||||||
box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.15); //Use instead of Bootstrap's helper
|
box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.15); //Use instead of Bootstrap's helper
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<button :disabled="isDisabled" :aria-disabled="isDisabled" class="btn d-flex align-items-center py-3 px-4" :class="[isPrimary ? 'btn-primary' : 'btn-secondary',isFloat ? 'float-end' : '']" @click="clicked()">
|
<button :disabled="isDisabled" :aria-disabled="isDisabled" class="btn d-flex align-items-center py-3 px-2" :class="[isPrimary ? 'btn-primary' : 'btn-secondary',isFloat ? 'float-end' : '']" @click="clicked()">
|
||||||
<span class="m-0">{{ this.buttonText }}</span>
|
<span class="m-0">{{ this.buttonText }}</span>
|
||||||
<loader
|
<loader
|
||||||
class="ms-2"
|
class="ms-2"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue