Skip to content

Commit

Permalink
fix(input): test with input number type letter
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Esteves <[email protected]>
  • Loading branch information
aesteves60 committed Jan 30, 2025
1 parent ebaf0b7 commit 2b1ebcd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class OdsDatepicker implements OdsFormElement {
}

private onInput(event: InputEvent): void {
this.showClearable = !(event.target as HTMLInputElement).value;
this.showClearable = !!(event.target as HTMLInputElement).value;
}

render(): FunctionalComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('ods-datepicker rendering', () => {
});

it('should render clearable button when type wrong format', async() => {
await setup('<ods-datepicker is-clearable ></ods-datepicker>');
await setup('<ods-datepicker is-clearable></ods-datepicker>');

await el.type('clearable');
await page.waitForChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,6 @@ export class OdsInput implements OdsFormElement {
this.shouldUpdateIsInvalidState = false;
}

// console.log('this.internals.validity', this.internals.validity)
// if (!this.internals.validity?.valid && !this.internals.validity?.valueMissing) {
// this.showClearable = true;
// } else {
// this.showClearable = false;
// }

this.odsChange.emit({
name: this.name,
previousValue: typeof this.value === 'number' && isNumeric(previousValue) ? Number(previousValue) : previousValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ describe('ods-input rendering', () => {
expect(buttonClearable).toBeNull();

// Test E2E launched with chrome. Chrome don't allow to type on input type number
// await page.keyboard.press('q');
// await page.waitForChanges();
// await new Promise(resolve => setTimeout(resolve, 20000));
// buttonClearable = await page.find('ods-input >>> ods-button[icon="xmark"]');
// expect(buttonClearable).not.toBeNull();
await page.keyboard.press('e');
await page.waitForChanges();

buttonClearable = await page.find('ods-input >>> ods-button[icon="xmark"]');
expect(buttonClearable).not.toBeNull();
});
});

Expand Down

0 comments on commit 2b1ebcd

Please sign in to comment.