From 4ef2efd9e6b79d9469e2d8e9794b5c8b7eb9d0e7 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 22 May 2024 10:17:19 -0400 Subject: [PATCH] Unit tests and Prettified --- .../address-questions/address-questions.spec.js | 10 +++++----- .../address-questions/address-questions.vue | 7 +++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/fmg-components/address-questions/address-questions.spec.js b/src/fmg-components/address-questions/address-questions.spec.js index d073c6bfc..f84f33377 100644 --- a/src/fmg-components/address-questions/address-questions.spec.js +++ b/src/fmg-components/address-questions/address-questions.spec.js @@ -204,23 +204,23 @@ describe("address-questions.vue", () => { test("address field is typed into => disable autofill", async () => { // Arrange - let keydownEventCallbackFunction; + let inputEventCallbackFunction; autocompleteElement.addEventListener = jest .fn() .mockImplementation((eventName, callbackFunction) => { - if (eventName == "keydown") { - keydownEventCallbackFunction = callbackFunction; + if (eventName == "input") { + inputEventCallbackFunction = callbackFunction; } }); const { wrapper } = setupMocks({}); await wrapper.vm.$nextTick(); const e = { - code: "Enter", + inputType: "insertText", }; // Act - keydownEventCallbackFunction(e); + inputEventCallbackFunction(e); await wrapper.vm.$nextTick(); // Assert diff --git a/src/fmg-components/address-questions/address-questions.vue b/src/fmg-components/address-questions/address-questions.vue index 348bf849a..f4b6804df 100644 --- a/src/fmg-components/address-questions/address-questions.vue +++ b/src/fmg-components/address-questions/address-questions.vue @@ -286,14 +286,13 @@ export default { // } // }); - this.addressField1.addEventListener("input", (e) => { - console.log(e) - + console.log(e); + switch (e.inputType) { case "insertText": case "insertFromPaste": - case "deleteContentBackward": + case "deleteContentBackward": // If the user enters text by typing, or pasting text, or deleting text already entered, disable autofill this.disableAutoFill(); break;