Skip to content

Commit

Permalink
Add some more tests for bulk selection
Browse files Browse the repository at this point in the history
  • Loading branch information
wolmir committed Jul 6, 2022
1 parent 0605411 commit 40c4f56
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions webview/src/experiments/components/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,35 @@ describe('App', () => {
expect(itemLabels).toContain('Star Experiments')
})

it('should allow batch selection from the bottom up too', () => {
render(<App />)

fireEvent(
window,
new MessageEvent('message', {
data: {
data: {
...tableDataFixture,
hasRunningExperiment: false
},
type: MessageToWebviewType.SET_DATA
}
})
)

const firstRowCheckbox = within(getRow('4fb124a')).getByRole('checkbox')
const tailRow = within(getRow('42b8736')).getByRole('checkbox')
fireEvent.click(tailRow)
fireEvent.click(firstRowCheckbox, { shiftKey: true })

const selectedRows = () => screen.getAllByRole('row', { selected: true })
expect(selectedRows()).toHaveLength(4)

const anotherRow = within(getRow('2173124')).getByRole('checkbox')
fireEvent.click(anotherRow, { shiftKey: true })
expect(selectedRows()).toHaveLength(5)
})

it('should not include collapsed experiments in the bulk selection', () => {
render(<App />)

Expand Down

0 comments on commit 40c4f56

Please sign in to comment.