diff --git a/dist/autofill-debug.js b/dist/autofill-debug.js index 319e884c0..e11f5775e 100644 --- a/dist/autofill-debug.js +++ b/dist/autofill-debug.js @@ -10403,10 +10403,16 @@ class Form { } initFormListeners() { // This ensures we fire the handler again if the form is changed - this.addListener(this.form, 'input', () => { + this.addListener(this.form, 'input', e => { if (!this.isAutofilling) { this.submitHandlerExecuted = false; - this.resetShouldPromptToStoreData(); + /** @type {import('./matching.js').SupportedTypes} **/ + const inputType = e.target.getAttribute(ATTR_INPUT_TYPE); + if (inputType && inputType !== 'unknown') { + this.resetShouldPromptToStoreData(); + } else { + this.shouldPromptToStoreData = false; + } } }); diff --git a/dist/autofill.js b/dist/autofill.js index 0f86ce0b8..637fe6989 100644 --- a/dist/autofill.js +++ b/dist/autofill.js @@ -6040,10 +6040,16 @@ class Form { } initFormListeners() { // This ensures we fire the handler again if the form is changed - this.addListener(this.form, 'input', () => { + this.addListener(this.form, 'input', e => { if (!this.isAutofilling) { this.submitHandlerExecuted = false; - this.resetShouldPromptToStoreData(); + /** @type {import('./matching.js').SupportedTypes} **/ + const inputType = e.target.getAttribute(ATTR_INPUT_TYPE); + if (inputType && inputType !== 'unknown') { + this.resetShouldPromptToStoreData(); + } else { + this.shouldPromptToStoreData = false; + } } }); diff --git a/integration-test/helpers/pages/addressPage.js b/integration-test/helpers/pages/addressPage.js new file mode 100644 index 000000000..305fd0b39 --- /dev/null +++ b/integration-test/helpers/pages/addressPage.js @@ -0,0 +1,47 @@ +import { expect } from '@playwright/test'; +import { mockedCalls } from '../harness.js'; + +/** + * A wrapper around interactions for `integration-test/pages/address-form.html` + * + * @param {import("@playwright/test").Page} page + */ +export function addressPage(page) { + class AddressPage { + /** + * @return {Promise} + */ + async navigate() { + await page.goto('integration-test/pages/address-form.html'); + } + + /** + * Fill in all address form fields + */ + async fillAddressForm(data) { + await page.fill('#firstName', data.firstName); + await page.fill('#lastName', data.lastName); + await page.fill('#address1', data.addressStreet); + await page.fill('#address2', data.addressStreet2); + await page.fill('#city', data.addressCity); + await page.fill('#state', data.addressProvince); + await page.fill('#postalCode', data.addressPostalCode); + await page.fill('#country', data.addressCountryCode); + await page.fill('#phone', data.phone); + await page.fill('#notes', data.notes); + } + + async submitFormViaTextbox() { + const textbox = await page.$('#notes'); + await textbox?.focus(); + await page.keyboard.down('Enter'); + } + + async shouldNotPromptToSave() { + const mockCalls = await mockedCalls(page, { names: ['storeFormData'], minCount: 0 }); + expect(mockCalls.length).toBe(0); + } + } + + return new AddressPage(); +} diff --git a/integration-test/pages/address-form.html b/integration-test/pages/address-form.html new file mode 100644 index 000000000..b665692d8 --- /dev/null +++ b/integration-test/pages/address-form.html @@ -0,0 +1,79 @@ + + + + + + Address Form Test + + + +
+
+

Test address form, with an arbitrary text field

+

This form is used to test the address form, with an arbitrary text field

+ + +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ + +
+
+ + + \ No newline at end of file diff --git a/integration-test/pages/index.html b/integration-test/pages/index.html index 033a02bcb..ea1d72269 100644 --- a/integration-test/pages/index.html +++ b/integration-test/pages/index.html @@ -9,6 +9,7 @@