Skip to content

Commit

Permalink
add inputmode test
Browse files Browse the repository at this point in the history
  • Loading branch information
pkovzz committed Jul 23, 2024
1 parent c423500 commit 82159b9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions projects/ngx-otp-input/src/lib/ngx-otp-input.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ describe('NgxOtpInputComponent with default options', () => {
).toBeTrue();
});
});

it('should have numeric inputmode by default', () => {
const inputElements = fixture.nativeElement.querySelectorAll('input');
inputElements.forEach((inputElement: HTMLInputElement) => {
expect(inputElement.getAttribute('inputmode')).toEqual('numeric');
});
});
});

describe('NgxOtpInputComponent with custom options', () => {
Expand All @@ -107,6 +114,7 @@ describe('NgxOtpInputComponent with custom options', () => {
hideInputValues: true,
showBlinkingCursor: true,
ariaLabels: ['First', 'Second', 'Third', 'Fourth', 'Fifth'],
inputMode: 'text',
};

let component: NgxOtpInputComponent;
Expand Down Expand Up @@ -156,6 +164,13 @@ describe('NgxOtpInputComponent with custom options', () => {
});
});

it('should have text inputmode', () => {
const inputElements = document.querySelectorAll('input');
inputElements.forEach((inputElement: HTMLInputElement) => {
expect(inputElement.getAttribute('inputmode')).toEqual('text');
});
});

// TODO: Fix the test case
// it('should have the css class ngx-blinking-cursor if the showBlinkingCursor option is true', () => {
// const inputElements = document.querySelectorAll('input');
Expand Down

0 comments on commit 82159b9

Please sign in to comment.