-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into poc/reusing-tests
- Loading branch information
Showing
73 changed files
with
2,280 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/content-management/table_list_view_table/src/table_list_view.test.helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { TestBed } from '@kbn/test-jest-helpers'; | ||
import { act } from 'react-dom/test-utils'; | ||
|
||
export const getActions = ({ find, form, component }: TestBed) => { | ||
/** Open the sort select drop down menu */ | ||
const openSortSelect = () => { | ||
find('tableSortSelectBtn').at(0).simulate('click'); | ||
}; | ||
|
||
// --- Search Box --- | ||
|
||
/** Set the search box value */ | ||
const updateSearchText = async (value: string) => { | ||
await act(async () => { | ||
find('tableListSearchBox').simulate('keyup', { | ||
key: 'Enter', | ||
target: { value }, | ||
}); | ||
}); | ||
component.update(); | ||
}; | ||
|
||
/** Get the Search box value */ | ||
const getSearchBoxValue = () => find('tableListSearchBox').props().defaultValue; | ||
|
||
// --- Row Actions --- | ||
const selectRow = (rowId: string) => { | ||
act(() => { | ||
form.selectCheckBox(`checkboxSelectRow-${rowId}`); | ||
}); | ||
component.update(); | ||
}; | ||
|
||
const clickDeleteSelectedItemsButton = () => { | ||
act(() => { | ||
find('deleteSelectedItems').simulate('click'); | ||
}); | ||
component.update(); | ||
}; | ||
|
||
const clickConfirmModalButton = async () => { | ||
await act(async () => { | ||
find('confirmModalConfirmButton').simulate('click'); | ||
}); | ||
component.update(); | ||
}; | ||
|
||
return { | ||
openSortSelect, | ||
updateSearchText, | ||
getSearchBoxValue, | ||
selectRow, | ||
clickDeleteSelectedItemsButton, | ||
clickConfirmModalButton, | ||
}; | ||
}; |
Oops, something went wrong.