Skip to content

Commit

Permalink
perf: remove all references of isValid attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Dec 18, 2024
1 parent 50f2f3d commit ab0c7a0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion components/input/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
7 changes: 0 additions & 7 deletions components/input/src/base-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -78,8 +77,6 @@ export default class BaseInput extends LitElement {
constructor() {
super();

this.isValid = false;

this.icon = false;
this.disabled = false;
this.required = false;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions components/input/test/auro-input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/form-validation/src/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit ab0c7a0

Please sign in to comment.