Skip to content

Commit

Permalink
fix: adjust the way used to set data-test-id for Scroller
Browse files Browse the repository at this point in the history
  • Loading branch information
ts1994tw committed Apr 18, 2024
1 parent 2e3fafe commit 11fdc52
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Virtuoso.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export function buildScroller({ usePublisher, useEmitter, useEmitterValue }: Hoo
{
ref: scrollerRef as React.MutableRefObject<HTMLDivElement | null>,
style: { ...scrollerStyle, ...style },
'data-test-id': 'virtuoso-scroller',
'data-testid': 'virtuoso-scroller',
'data-virtuoso-scroller': true,
tabIndex: 0,
...props,
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export type GridItemProps = Pick<React.ComponentProps<'div'>, 'style' | 'childre
* Passed to the Components.Scroller custom component
*/
export type ScrollerProps = Pick<React.ComponentProps<'div'>, 'style' | 'children' | 'tabIndex'> & {
'data-test-id'?: string
'data-testid'?: string
'data-virtuoso-scroller'?: boolean
} & React.RefAttributes<HTMLDivElement>

Expand Down
6 changes: 3 additions & 3 deletions test/__snapshots__/VirtuosoMockContext.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`VirtuosoMockContext > Grid > correctly renders items 1`] = `
<div>
<div
data-test-id="virtuoso-scroller"
data-testid="virtuoso-scroller"
data-virtuoso-scroller="true"
style="height: 100%; outline: none; overflow-y: auto; position: relative;"
tabindex="0"
Expand Down Expand Up @@ -117,7 +117,7 @@ exports[`VirtuosoMockContext > Grid > correctly renders items with useWindowScro
exports[`VirtuosoMockContext > List > correctly renders items 1`] = `
<div>
<div
data-test-id="virtuoso-scroller"
data-testid="virtuoso-scroller"
data-virtuoso-scroller="true"
style="height: 100%; outline: none; overflow-y: auto; position: relative;"
tabindex="0"
Expand Down Expand Up @@ -207,7 +207,7 @@ exports[`VirtuosoMockContext > List > correctly renders items with useWindowScro
exports[`VirtuosoMockContext > Table > correctly renders items 1`] = `
<div>
<div
data-test-id="virtuoso-scroller"
data-testid="virtuoso-scroller"
data-virtuoso-scroller="true"
style="height: 100%; outline: none; overflow-y: auto; position: relative;"
tabindex="0"
Expand Down

0 comments on commit 11fdc52

Please sign in to comment.