diff --git a/projects/ng-aquila/src/table/table-row.component.spec.ts b/projects/ng-aquila/src/table/table-row.component.spec.ts index 4fbd6dfec..cd4f9da60 100644 --- a/projects/ng-aquila/src/table/table-row.component.spec.ts +++ b/projects/ng-aquila/src/table/table-row.component.spec.ts @@ -121,7 +121,7 @@ describe(NxTableRowComponent.name, () => { }); }); - ['a', 'button', 'input', 'label'].forEach((type) => { + ['a', 'button', 'input', 'label', 'textarea'].forEach((type) => { describe(`when clicking a "${type}" in the row`, () => { beforeEach(() => { tableRowElement.nativeElement.querySelector(type).click(); @@ -135,6 +135,37 @@ describe(NxTableRowComponent.name, () => { }); }); + ['input', 'textarea'].forEach((type) => { + describe(`when typing inside "${type}"`, () => { + [true, false].forEach(selectable => { + describe(`for selectable being ${selectable}`, () => { + beforeEach(() => { + (testInstance as SelectableTableRowComponent).selectable = selectable; + fixture.detectChanges(); + const element = tableRowElement.nativeElement.querySelector(type); + element.dispatchEvent(new KeyboardEvent('keydown', {cancelable: true, bubbles: true, key: 'Space'})); + fixture.detectChanges(); + }); + + it('should not block space inputs', () => { + const element = tableRowElement.nativeElement.querySelector(type); + const event = new KeyboardEvent('keydown', {cancelable: true, bubbles: true, key: 'Space', keyCode: 32}); + element.dispatchEvent(event); + fixture.detectChanges(); + + expect(event.defaultPrevented).toBe(false); + + }); + + it ('is not selected', () => { + expect(tableRowInstance.selected).toBeFalsy(); + expect(hasClass(tableRowElement, 'is-selected')).toBeFalsy(); + }); + }); + }); + }); + }); + describe('when selecting a row by pressing space', () => { beforeEach(() => { tableRowElement.nativeElement.dispatchEvent(new KeyboardEvent('keydown', {bubbles: true, key: 'Space'})); @@ -195,6 +226,9 @@ class BasicTableRowComponent extends TableRowTest { }