diff --git a/packages/uui-table/lib/uui-table-row.test.ts b/packages/uui-table/lib/uui-table-row.test.ts index 55382f915..a160e0417 100644 --- a/packages/uui-table/lib/uui-table-row.test.ts +++ b/packages/uui-table/lib/uui-table-row.test.ts @@ -8,6 +8,7 @@ import { import '.'; import { UUITableRowElement } from './uui-table-row.element'; +import { UUITestMouse } from '../../../test/index'; describe('UuiTableRow', () => { let element: UUITableRowElement; @@ -60,4 +61,49 @@ describe('UuiTableRow', () => { }); }); }); + + // TODO: add tests with different kinds of elements in the cells + describe('selectable', () => { + const mouse = new UUITestMouse(); + + beforeEach(async () => { + element.selectable = true; + }); + + it('can be selected when selectable', async () => { + await elementUpdated(element); + await mouse.leftClick(element); + expect(element.selected).to.be.true; + }); + + it('can not be selected when not selectable', async () => { + element.selectable = false; + await elementUpdated(element); + await mouse.leftClick(element); + expect(element.selected).to.be.false; + }); + }); + + // TODO: add tests with different kinds of elements in the cells + describe('selectable & selectOnly', () => { + const mouse = new UUITestMouse(); + + beforeEach(async () => { + element.selectable = true; + element.selectOnly = true; + }); + + it('can be selected when selectable', async () => { + await elementUpdated(element); + await mouse.leftClick(element); + expect(element.selected).to.be.true; + }); + + it('can not be selected when not selectable', async () => { + element.selectable = false; + await elementUpdated(element); + await mouse.leftClick(element); + expect(element.selected).to.be.false; + }); + }); });