From 2c52290b192e8b1de36377d115c3f06f7c0a9ea2 Mon Sep 17 00:00:00 2001 From: Austin Walker Date: Mon, 11 Nov 2024 14:30:46 -0700 Subject: [PATCH] fix(tests): enhance backspace handling in mask delete tests and update hiddenInput default value --- projects/ngx-mask-lib/src/test/delete.cy-spec.ts | 7 ++++++- .../src/test/utils/cypress-test-component.component.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/ngx-mask-lib/src/test/delete.cy-spec.ts b/projects/ngx-mask-lib/src/test/delete.cy-spec.ts index 2b3a12b1..0da63c8b 100644 --- a/projects/ngx-mask-lib/src/test/delete.cy-spec.ts +++ b/projects/ngx-mask-lib/src/test/delete.cy-spec.ts @@ -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}') @@ -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}') @@ -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}') @@ -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}') @@ -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', '__:__'); }); diff --git a/projects/ngx-mask-lib/src/test/utils/cypress-test-component.component.ts b/projects/ngx-mask-lib/src/test/utils/cypress-test-component.component.ts index 70cb470a..b23114ae 100644 --- a/projects/ngx-mask-lib/src/test/utils/cypress-test-component.component.ts +++ b/projects/ngx-mask-lib/src/test/utils/cypress-test-component.component.ts @@ -38,7 +38,7 @@ export class CypressTestMaskComponent { protected _config = inject(NGX_MASK_CONFIG); @Input() public mask = ''; - @Input() public hiddenInput = null; + @Input() public hiddenInput = false; @Input() public allowNegativeNumbers = false;