Add datalist test selectors

This commit is contained in:
Marliana Lara
2021-06-23 14:15:08 -04:00
committed by Shane McDonald
parent 1ba51c0357
commit 1e750cfed9

View File

@@ -61,6 +61,7 @@ function DraggableSelectedList({ selected, onRemove, onRowDrag }) {
<> <>
<DataList <DataList
aria-label={t`Draggable list to reorder and remove selected items.`} aria-label={t`Draggable list to reorder and remove selected items.`}
data-cy="draggable-list"
itemOrder={orderedList} itemOrder={orderedList}
onDragCancel={onDragCancel} onDragCancel={onDragCancel}
onDragFinish={onDragFinish} onDragFinish={onDragFinish}
@@ -81,13 +82,14 @@ function DraggableSelectedList({ selected, onRemove, onRowDrag }) {
Press enter to confirm the drag, or any other key to Press enter to confirm the drag, or any other key to
cancel the drag operation.`} cancel the drag operation.`}
aria-pressed="false" aria-pressed="false"
data-cy={`reorder-${label}`}
/> />
</DataListControl> </DataListControl>
<DataListItemCells <DataListItemCells
dataListCells={[ dataListCells={[
<DataListCell key={label}> <DataListCell key={label}>
<span id={rowPosition}> <span id={rowPosition}>
{rowPosition}. {label} {`${rowPosition}. ${label}`}
</span> </span>
</DataListCell>, </DataListCell>,
]} ]}
@@ -97,7 +99,7 @@ function DraggableSelectedList({ selected, onRemove, onRowDrag }) {
onClick={() => removeItem(label)} onClick={() => removeItem(label)}
variant="plain" variant="plain"
aria-label={t`Remove`} aria-label={t`Remove`}
ouiaId="draggable-list-remove" ouiaId={`draggable-list-remove-${label}`}
> >
<TimesIcon /> <TimesIcon />
</Button> </Button>