Working unit tests
This commit is contained in:
parent
86d7760d77
commit
4def7c421e
3 changed files with 86 additions and 6 deletions
|
|
@ -190,6 +190,8 @@ describe("service-location.vue", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
const mobileFeePart = {
|
const mobileFeePart = {
|
||||||
partNumber: "MOBILE FEE",
|
partNumber: "MOBILE FEE",
|
||||||
description: "MOBILE FEE",
|
description: "MOBILE FEE",
|
||||||
|
|
@ -584,6 +586,8 @@ describe("service-location.vue", () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
|
|
@ -611,6 +615,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -637,6 +643,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -663,6 +671,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -689,6 +699,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -716,6 +728,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -743,6 +757,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -770,6 +786,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -797,6 +815,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -824,6 +844,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -851,6 +873,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -878,6 +902,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -905,6 +931,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -932,6 +960,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -959,6 +989,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -989,6 +1021,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1015,6 +1049,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1041,6 +1077,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1068,6 +1106,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1095,6 +1135,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1122,6 +1164,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1151,6 +1195,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1178,6 +1224,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1205,6 +1253,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1232,6 +1282,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1259,6 +1311,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1286,6 +1340,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1313,6 +1369,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -1342,6 +1400,8 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await serviceLocation.beforeRouteEnter.call(
|
await serviceLocation.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@
|
||||||
:aria-label="buttonLabel"
|
:aria-label="buttonLabel"
|
||||||
class="button-content list-button-content d-flex flex-column justify-content-center py-3 px-4">
|
class="button-content list-button-content d-flex flex-column justify-content-center py-3 px-4">
|
||||||
<div class="row-one">
|
<div class="row-one">
|
||||||
<span class="m-0 button-label-copy" :class="textPosition">{{ buttonLabel }}</span>
|
<span class="m-0 button-label-copy" :class="textPosition">{{
|
||||||
|
buttonLabel
|
||||||
|
}}</span>
|
||||||
<span class="m-0 button-label-sub-copy" :class="textPosition">{{
|
<span class="m-0 button-label-sub-copy" :class="textPosition">{{
|
||||||
buttonLabelSubCopy
|
buttonLabelSubCopy
|
||||||
}}</span>
|
}}</span>
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@
|
||||||
groupName="ChooseShop"
|
groupName="ChooseShop"
|
||||||
textPosition="text-start"
|
textPosition="text-start"
|
||||||
v-model="selectedValue"
|
v-model="selectedValue"
|
||||||
isRequired />
|
isRequired
|
||||||
<textLink
|
validationRules="option-required"/>
|
||||||
|
<textLink v-if="displaySeeMoreLocationsLink"
|
||||||
ref="showMoreShopsLink"
|
ref="showMoreShopsLink"
|
||||||
class="show-more-shops-link"
|
class="show-more-shops-link"
|
||||||
id="showMoreShopsId"
|
id="showMoreShopsId"
|
||||||
|
|
@ -27,7 +28,7 @@
|
||||||
:text="showMoreShopsLinkText"
|
:text="showMoreShopsLinkText"
|
||||||
href="#!"
|
href="#!"
|
||||||
@click-event="getNextShopsFromList"
|
@click-event="getNextShopsFromList"
|
||||||
aria-label="Show more shops" />
|
:aria-label="showMoreShopsLinkText" />
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -59,6 +60,7 @@ export default {
|
||||||
availability: "high",
|
availability: "high",
|
||||||
answers: [],
|
answers: [],
|
||||||
shopIndex: 0,
|
shopIndex: 0,
|
||||||
|
displaySeeMoreLocationsLink: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -107,6 +109,9 @@ export default {
|
||||||
const result = await this.dispatchStoreAction(storeActions.GET_PROVIDER_LOCATIONS, {
|
const result = await this.dispatchStoreAction(storeActions.GET_PROVIDER_LOCATIONS, {
|
||||||
serviceZipCode: this.serviceZipCode,
|
serviceZipCode: this.serviceZipCode,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.resetShopList();
|
||||||
|
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
shopIterator(array, n) {
|
shopIterator(array, n) {
|
||||||
|
|
@ -114,7 +119,7 @@ export default {
|
||||||
return () => {
|
return () => {
|
||||||
var end = this.shopIndex + n;
|
var end = this.shopIndex + n;
|
||||||
var part = array.slice(this.shopIndex, end);
|
var part = array.slice(this.shopIndex, end);
|
||||||
this.shopIndex = end < l ? end : this.shopIndex.length - 1;
|
this.shopIndex = end < l ? end : this.shops.length;
|
||||||
return part;
|
return part;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -145,6 +150,18 @@ export default {
|
||||||
const container = document.getElementsByClassName("page-container-grouped-styles")[0];
|
const container = document.getElementsByClassName("page-container-grouped-styles")[0];
|
||||||
|
|
||||||
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
|
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
|
||||||
|
|
||||||
|
if (this.shopIndex == this.shops.length) {
|
||||||
|
this.displaySeeMoreLocationsLink = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resetShopList() {
|
||||||
|
this.answers = [];
|
||||||
|
this.shopIndex = 0;
|
||||||
|
this.getNextShopsFromList();
|
||||||
|
|
||||||
|
this.displaySeeMoreLocationsLink = true;
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -160,8 +177,9 @@ export default {
|
||||||
const container = document.getElementsByClassName(
|
const container = document.getElementsByClassName(
|
||||||
"page-container-grouped-styles"
|
"page-container-grouped-styles"
|
||||||
)[0];
|
)[0];
|
||||||
console.log(container.scrollHeight + 200);
|
|
||||||
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
|
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
|
||||||
|
|
||||||
|
this.resetShopList();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue