Skip to content

Commit

Permalink
fix(tests): enhance backspace handling in mask delete tests and updat…
Browse files Browse the repository at this point in the history
…e hiddenInput default value
  • Loading branch information
BGBRWR committed Nov 11, 2024
1 parent 4320bcd commit 2c52290
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion projects/ngx-mask-lib/src/test/delete.cy-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ describe('Directive: Mask (Delete)', () => {
.should('have.prop', 'selectionStart', 14)
.should('have.value', '+7 (123) 456-7___')
.type('{backspace}')
.type('{backspace}')
.should('have.prop', 'selectionStart', 12)
.should('have.value', '+7 (123) 456-____')
.type('{backspace}')
Expand All @@ -234,6 +235,7 @@ describe('Directive: Mask (Delete)', () => {
.should('have.prop', 'selectionStart', 10)
.should('have.value', '+7 (123) 4__-____')
.type('{backspace}')
.type('{backspace}')
.should('have.prop', 'selectionStart', 7)
.should('have.value', '+7 (123) ___-____')
.type('{backspace}')
Expand Down Expand Up @@ -264,12 +266,14 @@ describe('Directive: Mask (Delete)', () => {
.should('have.prop', 'selectionStart', 15)
.should('have.value', '+32 12 345 67 8_')
.type('{backspace}')
.type('{backspace}')
.should('have.prop', 'selectionStart', 13)
.should('have.value', '+32 12 345 67 __')
.type('{backspace}')
.should('have.prop', 'selectionStart', 12)
.should('have.value', '+32 12 345 6_ __')
.type('{backspace}')
.type('{backspace}')
.should('have.prop', 'selectionStart', 10)
.should('have.value', '+32 12 345 __ __')
.type('{backspace}')
Expand All @@ -279,6 +283,7 @@ describe('Directive: Mask (Delete)', () => {
.should('have.prop', 'selectionStart', 8)
.should('have.value', '+32 12 3__ __ __')
.type('{backspace}')
.type('{backspace}')
.should('have.prop', 'selectionStart', 6)
.should('have.value', '+32 12 ___ __ __')
.type('{backspace}')
Expand Down Expand Up @@ -352,7 +357,7 @@ describe('Directive: Mask (Delete)', () => {
cy.get('#masked')
.type('1234')
.should('have.value', '12:34')
.type('{backspace}'.repeat(4))
.type('{backspace}'.repeat(5))
.should('have.value', '__:__');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class CypressTestMaskComponent {
protected _config = inject<NgxMaskConfig>(NGX_MASK_CONFIG);
@Input() public mask = '';

@Input() public hiddenInput = null;
@Input() public hiddenInput = false;

@Input() public allowNegativeNumbers = false;

Expand Down

0 comments on commit 2c52290

Please sign in to comment.