Skip to content

Commit

Permalink
fix: adjust the way used to set data-test-id for List
Browse files Browse the repository at this point in the history
  • Loading branch information
ts1994tw committed Apr 18, 2024
1 parent fd7c283 commit 2e3fafe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Virtuoso.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const Items = /*#__PURE__*/ React.memo(function VirtuosoItems({ showTopList = fa
...contextPropIfNotDomElement(ListComponent, context),
ref: callbackRef,
style: containerStyle,
'data-test-id': showTopList ? 'virtuoso-top-item-list' : 'virtuoso-item-list',
'data-testid': showTopList ? 'virtuoso-top-item-list' : 'virtuoso-item-list',
},
(showTopList ? listState.topItems : listState.items).map((item) => {
const index = item.originalIndex!
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type TableBodyProps = Pick<React.ComponentProps<'tbody'>, 'style' | 'chil
* Passed to the Components.List custom component
*/
export type ListProps = Pick<React.ComponentProps<'div'>, 'style' | 'children'> & {
'data-test-id': string
'data-testid': string
} & React.RefAttributes<HTMLDivElement>

/**
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/VirtuosoMockContext.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ exports[`VirtuosoMockContext > List > correctly renders items 1`] = `
style="width: 100%; height: 100%; position: absolute; top: 0px;"
>
<div
data-test-id="virtuoso-item-list"
data-testid="virtuoso-item-list"
style="box-sizing: border-box; padding-top: 0px; padding-bottom: 500px; margin-top: 0px;"
>
<div
Expand Down Expand Up @@ -171,7 +171,7 @@ exports[`VirtuosoMockContext > List > correctly renders items with useWindowScro
style="width: 100%; height: 100%; position: absolute; top: 0px;"
>
<div
data-test-id="virtuoso-item-list"
data-testid="virtuoso-item-list"
style="box-sizing: border-box; padding-top: 0px; padding-bottom: 500px; margin-top: 0px;"
>
<div
Expand Down

0 comments on commit 2e3fafe

Please sign in to comment.