From ab0c7a08fc661ae707aca459aad429e82a95beda Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Tue, 17 Dec 2024 12:55:00 -0800 Subject: [PATCH] perf: remove all references of isValid attribute --- components/input/docs/api.md | 1 - components/input/src/base-input.js | 7 ------- components/input/test/auro-input.test.js | 3 +-- packages/form-validation/src/validation.js | 5 ----- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/components/input/docs/api.md b/components/input/docs/api.md index 4802ab70..bc676b99 100644 --- a/components/input/docs/api.md +++ b/components/input/docs/api.md @@ -24,7 +24,6 @@ Generate unique names for dependency components. | `helpText` | `helpText` | `String` | | Deprecated, see `slot`. | | `icon` | `icon` | `Boolean` | false | If set, will render an icon inside the input to the left of the value. Support is limited to auro-input instances with credit card format. | | `id` | `id` | `String` | | Sets the unique ID of the element. | -| `isValid` | `isValid` | `String` | false | (DEPRECATED - Please use validity) Can be accessed to determine if the input validity. Returns true when validity has not yet been checked or validity = 'valid', all other cases return false. Not intended to be set by the consumer. | | `label` | `label` | `String` | "Input label is undefined" | Deprecated, see `slot`. | | `lang` | `lang` | `String` | | defines the language of an element. | | `max` | `max` | `String` | "undefined" | The maximum value allowed. This only applies for inputs with a type of `number` and all date formats. | diff --git a/components/input/src/base-input.js b/components/input/src/base-input.js index 8d87cdbe..a91e9cf9 100644 --- a/components/input/src/base-input.js +++ b/components/input/src/base-input.js @@ -33,7 +33,6 @@ import AuroFormValidation from '@auro-formkit/form-validation'; * @attr {String} helpText - Deprecated, see `slot`. * @attr {Boolean} icon - If set, will render an icon inside the input to the left of the value. Support is limited to auro-input instances with credit card format. * @attr {String} id - Sets the unique ID of the element. - * @attr {String} isValid - (DEPRECATED - Please use validity) Can be accessed to determine if the input validity. Returns true when validity has not yet been checked or validity = 'valid', all other cases return false. Not intended to be set by the consumer. * @attr {String} label - Deprecated, see `slot`. * @attr {String} lang - defines the language of an element. * @attr {String} max - The maximum value allowed. This only applies for inputs with a type of `number` and all date formats. @@ -78,8 +77,6 @@ export default class BaseInput extends LitElement { constructor() { super(); - this.isValid = false; - this.icon = false; this.disabled = false; this.required = false; @@ -200,10 +197,6 @@ export default class BaseInput extends LitElement { reflect: true }, errorMessage: { type: String }, - isValid: { - type: String, - reflect: true - }, validity: { type: String, reflect: true diff --git a/components/input/test/auro-input.test.js b/components/input/test/auro-input.test.js index e0991fe4..f9803392 100644 --- a/components/input/test/auro-input.test.js +++ b/components/input/test/auro-input.test.js @@ -49,7 +49,6 @@ describe('auro-input', () => { await elementUpdated(el); - expect(el.isValid).to.not.be.true; expect(text).to.contain(`that is not a valid entry`); input.focus(); @@ -58,7 +57,7 @@ describe('auro-input', () => { await elementUpdated(el); - expect(el.isValid).to.be.true; + expect(el.getAttribute('validity')).to.equal('valid'); }); it('clears the value when clicked', async () => { diff --git a/packages/form-validation/src/validation.js b/packages/form-validation/src/validation.js index 76cd9367..4f75f281 100644 --- a/packages/form-validation/src/validation.js +++ b/packages/form-validation/src/validation.js @@ -152,7 +152,6 @@ export default class AuroFormValidation { } else if (elem.value === undefined) { // Reset the validity state if input is programmatically reset elem.validity = undefined; - elem.isValid = false; } if (this.auroInputElements && this.auroInputElements.length > 0) { @@ -169,14 +168,10 @@ export default class AuroFormValidation { if (validationShouldRun || elem.hasAttribute('error')) { if (elem.validity && elem.validity !== 'valid') { - elem.isValid = false; - // Use the validity message override if it is declared if (elem.ValidityMessageOverride) { elem.setCustomValidity = elem.ValidityMessageOverride; } - } else { - elem.isValid = true; } this.getErrorMessage(elem);