rename label prop to placeholder and remove obsolete test case

Signed-off-by: Mathias Bronner <mathiasb@spotify.com>
This commit is contained in:
Mathias Bronner
2022-10-06 14:23:16 +02:00
parent 88d55868e5
commit aa2676dcbe
2 changed files with 9 additions and 19 deletions
@@ -67,7 +67,7 @@ describe('<GroupListPicker />', () => {
const { queryByText } = render(
<ApiProvider apis={apis}>
<GroupListPicker
label="Search"
placeholder="Search"
groupTypes={['org', 'department']}
defaultGroup="test"
/>
@@ -77,25 +77,11 @@ describe('<GroupListPicker />', () => {
expect(queryByText('test')).toBeInTheDocument();
});
it('open group list picker', () => {
const { getByTestId, getAllByText } = render(
<ApiProvider apis={apis}>
<GroupListPicker
label="Search unique"
groupTypes={['org', 'department']}
/>
</ApiProvider>,
);
fireEvent.click(getByTestId('group-list-picker-button'));
expect(getAllByText('Search unique').length).toBeGreaterThan(0);
});
it('can choose a group', async () => {
const { getByText, queryByText, getByTestId } = render(
<ApiProvider apis={apis}>
<GroupListPicker
label="Search unique"
placeholder="Search"
groupTypes={['org', 'department']}
/>
</ApiProvider>,
@@ -51,7 +51,7 @@ const useStyles = makeStyles({
* @public
*/
export type GroupListPickerProps = {
label: string;
placeholder: string;
groupTypes: Array<string>;
defaultGroup?: string;
};
@@ -61,7 +61,7 @@ export const GroupListPicker = (props: GroupListPickerProps) => {
const classes = useStyles();
const catalogApi = useApi(catalogApiRef);
const { label, groupTypes, defaultGroup = '' } = props;
const { placeholder, groupTypes, defaultGroup = '' } = props;
const [anchorEl, setAnchorEl] = React.useState(null);
const [inputValue, setInputValue] = React.useState('');
const [group, setGroup] = React.useState(defaultGroup);
@@ -121,7 +121,11 @@ export const GroupListPicker = (props: GroupListPickerProps) => {
}}
style={{ width: '200px' }}
renderInput={params => (
<TextField {...params} placeholder={label} variant="outlined" />
<TextField
{...params}
placeholder={placeholder}
variant="outlined"
/>
)}
/>
</Popover>