|
8 | 8 |
|
9 | 9 | import '.'; |
10 | 10 | import { UUITableRowElement } from './uui-table-row.element'; |
| 11 | +import { UUITestMouse } from '../../../test/index'; |
11 | 12 |
|
12 | 13 | describe('UuiTableRow', () => { |
13 | 14 | let element: UUITableRowElement; |
@@ -60,4 +61,49 @@ describe('UuiTableRow', () => { |
60 | 61 | }); |
61 | 62 | }); |
62 | 63 | }); |
| 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 | + }); |
63 | 109 | }); |
0 commit comments