fixed tests
This commit is contained in:
parent
b0c403c652
commit
df4a2491fd
2 changed files with 34 additions and 7 deletions
|
|
@ -15,7 +15,7 @@ describe("address-questions.vue", () => {
|
|||
});
|
||||
|
||||
describe("initial state", () => {
|
||||
test("Should render addressQuestions sub-components (textbox-questions and dropdown-questions)", async () => {
|
||||
test("Should hide addressQuestions sub-components (textbox-questions and dropdown-questions)", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
|
|
@ -24,17 +24,16 @@ describe("address-questions.vue", () => {
|
|||
const city = wrapper.findComponent({ ref: "city" });
|
||||
const state = wrapper.findComponent({ ref: "state" });
|
||||
const zipCode = wrapper.findComponent({ ref: "zipCode" });
|
||||
const streetAddress2 = wrapper.findComponent({ ref: "streetAddress2"});
|
||||
|
||||
// Assert
|
||||
expect(streetAddress.exists()).toBe(true);
|
||||
expect(city.exists()).toBe(true);
|
||||
expect(state.exists()).toBe(true);
|
||||
expect(zipCode.exists()).toBe(true);
|
||||
expect(city.exists()).toBe(false);
|
||||
expect(state.exists()).toBe(false);
|
||||
expect(zipCode.exists()).toBe(false);
|
||||
expect(streetAddress2.exists()).toBe(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("happy paths", () => {
|
||||
test("full street address is passed in => address fields are displayed", async () => {
|
||||
// Arrange/Act
|
||||
const { wrapper } = setupMocks({
|
||||
|
|
@ -45,6 +44,7 @@ describe("address-questions.vue", () => {
|
|||
state: "OH",
|
||||
zipCode: "12312",
|
||||
},
|
||||
includeStreetAddress2: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -54,14 +54,40 @@ describe("address-questions.vue", () => {
|
|||
const cityField = wrapper.findComponent({ ref: "city" });
|
||||
const stateField = wrapper.findComponent({ ref: "state" });
|
||||
const zipField = wrapper.findComponent({ ref: "zipCode" });
|
||||
const streetAddress2 = wrapper.findComponent({ ref: "streetAddress2"});
|
||||
|
||||
expect(cityField.exists()).toBeTruthy();
|
||||
expect(cityField.isVisible()).toBeTruthy();
|
||||
expect(stateField.exists()).toBeTruthy();
|
||||
expect(cityField.isVisible()).toBeTruthy();
|
||||
expect(zipField.exists()).toBeTruthy();
|
||||
expect(cityField.isVisible()).toBeTruthy();
|
||||
expect(streetAddress2.isVisible()).toBeTruthy();
|
||||
});
|
||||
|
||||
test("address2 is hidden if includeStreetAddress2 is false", async () => {
|
||||
// Arrange/Act
|
||||
const { wrapper } = setupMocks({
|
||||
props: {
|
||||
modelValue: {
|
||||
streetAddress: "12345 Test Road",
|
||||
city: "Tests",
|
||||
state: "OH",
|
||||
zipCode: "12312",
|
||||
},
|
||||
includeStreetAddress2: false,
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
const streetAddress2 = wrapper.findComponent({ ref: "streetAddress2"});
|
||||
expect(streetAddress2.exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("happy paths", () => {
|
||||
test("street address is entered, user chooses good result from autocomplete results => other fields are filled in", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<div class="row mt-2 mb-4" v-if="includeStreetAddress2">
|
||||
<div class="col">
|
||||
<textboxQuestion
|
||||
ref="streetAddress2"
|
||||
cmsWidgetName="StreetAddress2QuestionWidget"
|
||||
v-model="addressModel.streetAddress2"
|
||||
aria-haspopup=""
|
||||
|
|
|
|||
Loading…
Reference in a new issue