Skip to content

Commit ae24cff

Browse files
committed
refactor(associated): invalid property no longer reflects to attribute
1 parent b38bdcf commit ae24cff

File tree

5 files changed

+13
-49
lines changed

5 files changed

+13
-49
lines changed

src/components/checkbox/checkbox.spec.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,6 @@ describe('Checkbox', () => {
125125
expect(input).dom.to.equal(`<input value="${value}"/>`, DIFF_OPTIONS);
126126
});
127127

128-
it('should set the checkbox invalid property correctly', async () => {
129-
element.invalid = true;
130-
await elementUpdated(element);
131-
132-
expect(element).dom.to.equal(
133-
`<igc-checkbox invalid label-position="after">${label}</igc-checkbox>`
134-
);
135-
136-
element.invalid = false;
137-
await elementUpdated(element);
138-
139-
expect(element).dom.to.equal(
140-
`<igc-checkbox label-position="after">${label}</igc-checkbox>`
141-
);
142-
});
143-
144128
it('should correctly report validity status', () => {
145129
element.required = true;
146130
expect(element.reportValidity()).to.be.false;

src/components/checkbox/switch.spec.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,6 @@ describe('Switch', () => {
8787
expect(input).dom.to.equal(`<input value="${value}"/>`, DIFF_OPTIONS);
8888
});
8989

90-
it('should set the switch invalid property correctly', async () => {
91-
element.invalid = true;
92-
await elementUpdated(element);
93-
94-
expect(element).dom.to.equal(
95-
`<igc-switch invalid label-position="after">${label}</igc-switch>`
96-
);
97-
98-
element.invalid = false;
99-
await elementUpdated(element);
100-
101-
expect(element).dom.to.equal(
102-
`<igc-switch label-position="after">${label}</igc-switch>`
103-
);
104-
});
105-
10690
it('should correctly report validity status', () => {
10791
element.required = true;
10892
expect(element.reportValidity()).to.be.false;

src/components/common/mixins/forms/associated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function BaseFormAssociated<T extends Constructor<LitElement>>(base: T) {
9696
* @attr
9797
* @default false
9898
*/
99-
@property({ type: Boolean, reflect: true })
99+
@property({ type: Boolean })
100100
public set invalid(value: boolean) {
101101
this._isExternalInvalid = value;
102102
this._setInvalidStyles();

src/components/radio/radio.spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,6 @@ describe('Radio Component', () => {
7676
);
7777
});
7878

79-
it('sets invalid properly', async () => {
80-
radio.invalid = true;
81-
await elementUpdated(radio);
82-
expect(radio).dom.to.equal(
83-
`<igc-radio invalid label-position="after">${label}</igc-radio>`
84-
);
85-
86-
radio.invalid = false;
87-
await elementUpdated(radio);
88-
expect(radio).dom.to.equal(
89-
`<igc-radio label-position="after">${label}</igc-radio>`
90-
);
91-
});
92-
9379
it('sets the name property successfully', async () => {
9480
const name = 'fruit';
9581

stories/input.stories.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ export const Validation: Story = {
278278
<form @submit=${formSubmitHandler}>
279279
<fieldset>
280280
<igc-input
281+
name="min-length-value"
281282
label="Validate without validation slots and helper text"
282283
minlength="3"
283284
>
@@ -286,14 +287,21 @@ export const Validation: Story = {
286287
</fieldset>
287288
288289
<fieldset>
289-
<igc-input label="Username" required>
290+
<igc-input name="username" label="Username" required autocomplete="off">
290291
<p slot="helper-text">The username you will use in the platform</p>
291292
<p slot="value-missing">The username is required!</p>
292293
</igc-input>
293294
</fieldset>
294295
295296
<fieldset>
296-
<igc-input id="customError" label="Email" type="email" required>
297+
<igc-input
298+
name="email"
299+
id="customError"
300+
label="Email"
301+
type="email"
302+
required
303+
autocomplete="off"
304+
>
297305
<p slot="helper-text">
298306
A valid email for restoring credentials
299307
<strong>(not show in your profile)!</strong>
@@ -305,6 +313,8 @@ export const Validation: Story = {
305313
306314
<fieldset>
307315
<igc-input
316+
name="password"
317+
autocomplete="off"
308318
label="Password"
309319
type="password"
310320
required

0 commit comments

Comments
 (0)