Skip to content

Commit 6b986df

Browse files
committed
add very basic selectable tests for table row
1 parent 44b4049 commit 6b986df

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

packages/uui-table/lib/uui-table-row.test.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88

99
import '.';
1010
import { UUITableRowElement } from './uui-table-row.element';
11+
import { UUITestMouse } from '../../../test/index';
1112

1213
describe('UuiTableRow', () => {
1314
let element: UUITableRowElement;
@@ -60,4 +61,49 @@ describe('UuiTableRow', () => {
6061
});
6162
});
6263
});
64+
65+
// TODO: add tests with different kinds of elements in the cells
66+
describe('selectable', () => {
67+
const mouse = new UUITestMouse();
68+
69+
beforeEach(async () => {
70+
element.selectable = true;
71+
});
72+
73+
it('can be selected when selectable', async () => {
74+
await elementUpdated(element);
75+
await mouse.leftClick(element);
76+
expect(element.selected).to.be.true;
77+
});
78+
79+
it('can not be selected when not selectable', async () => {
80+
element.selectable = false;
81+
await elementUpdated(element);
82+
await mouse.leftClick(element);
83+
expect(element.selected).to.be.false;
84+
});
85+
});
86+
87+
// TODO: add tests with different kinds of elements in the cells
88+
describe('selectable & selectOnly', () => {
89+
const mouse = new UUITestMouse();
90+
91+
beforeEach(async () => {
92+
element.selectable = true;
93+
element.selectOnly = true;
94+
});
95+
96+
it('can be selected when selectable', async () => {
97+
await elementUpdated(element);
98+
await mouse.leftClick(element);
99+
expect(element.selected).to.be.true;
100+
});
101+
102+
it('can not be selected when not selectable', async () => {
103+
element.selectable = false;
104+
await elementUpdated(element);
105+
await mouse.leftClick(element);
106+
expect(element.selected).to.be.false;
107+
});
108+
});
63109
});

0 commit comments

Comments
 (0)