Merged from CSR-1012

This commit is contained in:
Leah Schumann 2023-01-24 16:03:49 -05:00 committed by Matt Caimi
parent 9b69090670
commit a69fe69320
2 changed files with 22 additions and 17 deletions

View file

@ -58,7 +58,7 @@ describe("address-questions.vue", () => {
expect(state.exists()).toBe(true); expect(state.exists()).toBe(true);
expect(zipCode.exists()).toBe(true); expect(zipCode.exists()).toBe(true);
}); });
test("Should render apartmentNumberOrBusinessName textbox-question when captureApartmentNumberOrBusinessName = true", async () => { test("Should render apartmentNumberOrBusinessName textbox-question when captureApartmentNumberOrBusinessName = true", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
@ -68,19 +68,21 @@ describe("address-questions.vue", () => {
apartmentNumberOrBusinessName: "", apartmentNumberOrBusinessName: "",
city: "", city: "",
state: "", state: "",
zipCode: "", zipCode: "",
}, },
captureApartmentNumberOrBusinessName: true captureApartmentNumberOrBusinessName: true,
}, },
}); });
await wrapper.setData({ await wrapper.setData({
showAddressFields: true showAddressFields: true,
}); });
// Act // Act
const streetAddress = wrapper.findComponent({ ref: "autocomplete" }); const streetAddress = wrapper.findComponent({ ref: "autocomplete" });
const apartmentNumberOrBusinessName = wrapper.findComponent({ ref: "apartmentNumberOrBusinessName" }); const apartmentNumberOrBusinessName = wrapper.findComponent({
ref: "apartmentNumberOrBusinessName",
});
const city = wrapper.findComponent({ ref: "city" }); const city = wrapper.findComponent({ ref: "city" });
const state = wrapper.findComponent({ ref: "state" }); const state = wrapper.findComponent({ ref: "state" });
const zipCode = wrapper.findComponent({ ref: "zipCode" }); const zipCode = wrapper.findComponent({ ref: "zipCode" });
@ -92,9 +94,8 @@ describe("address-questions.vue", () => {
expect(city.exists()).toBe(true); expect(city.exists()).toBe(true);
expect(state.exists()).toBe(true); expect(state.exists()).toBe(true);
expect(zipCode.exists()).toBe(true); expect(zipCode.exists()).toBe(true);
});
});
test("Should *not* render apartmentNumberOrBusinessName textbox-question when captureApartmentNumberOrBusinessName = false", async () => { test("Should *not* render apartmentNumberOrBusinessName textbox-question when captureApartmentNumberOrBusinessName = false", async () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
@ -104,19 +105,21 @@ describe("address-questions.vue", () => {
apartmentNumberOrBusinessName: "", apartmentNumberOrBusinessName: "",
city: "", city: "",
state: "", state: "",
zipCode: "", zipCode: "",
}, },
captureApartmentNumberOrBusinessName: false captureApartmentNumberOrBusinessName: false,
}, },
}); });
await wrapper.setData({ await wrapper.setData({
showAddressFields: true showAddressFields: true,
}); });
// Act // Act
const streetAddress = wrapper.findComponent({ ref: "autocomplete" }); const streetAddress = wrapper.findComponent({ ref: "autocomplete" });
const apartmentNumberOrBusinessName = wrapper.findComponent({ ref: "apartmentNumberOrBusinessName" }); const apartmentNumberOrBusinessName = wrapper.findComponent({
ref: "apartmentNumberOrBusinessName",
});
const city = wrapper.findComponent({ ref: "city" }); const city = wrapper.findComponent({ ref: "city" });
const state = wrapper.findComponent({ ref: "state" }); const state = wrapper.findComponent({ ref: "state" });
const zipCode = wrapper.findComponent({ ref: "zipCode" }); const zipCode = wrapper.findComponent({ ref: "zipCode" });
@ -128,8 +131,7 @@ describe("address-questions.vue", () => {
expect(city.exists()).toBe(true); expect(city.exists()).toBe(true);
expect(state.exists()).toBe(true); expect(state.exists()).toBe(true);
expect(zipCode.exists()).toBe(true); expect(zipCode.exists()).toBe(true);
});
});
test("Should set this.showAddressFields to true when the model is prepopulated", async () => { test("Should set this.showAddressFields to true when the model is prepopulated", async () => {
// Arrange // Arrange

View file

@ -17,7 +17,10 @@
</div> </div>
</div> </div>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<div class="row mb-4" v-show="showAddressFields && showApartmentNumberOrBusinessNameField" aria-live="polite"> <div
class="row mb-4"
v-show="showAddressFields && showApartmentNumberOrBusinessNameField"
aria-live="polite">
<div class="col"> <div class="col">
<textboxQuestion <textboxQuestion
cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget" cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget"
@ -110,9 +113,9 @@ export default {
apartmentNumberOrBusinessName: "", apartmentNumberOrBusinessName: "",
city: "", city: "",
state: "", state: "",
zipCode: "", zipCode: "",
}), }),
}, },
validationRules: String, validationRules: String,
captureApartmentNumberOrBusinessName: false, captureApartmentNumberOrBusinessName: false,
}, },
@ -198,7 +201,7 @@ export default {
get: function () { get: function () {
return this.captureApartmentNumberOrBusinessName; return this.captureApartmentNumberOrBusinessName;
}, },
} },
}, },
methods: { methods: {
setupAddressLookup() { setupAddressLookup() {