Skip to content

Commit 782e150

Browse files
committed
fix tests
1 parent 687d781 commit 782e150

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

packages/react-aria-components/test/Table.test.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,7 @@ describe('Table', () => {
18741874
expect(loaderRow).toHaveTextContent('spinner');
18751875

18761876
let sentinel = tree.getByTestId('loadMoreSentinel');
1877-
expect(sentinel.parentElement).toHaveAttribute('inert');
1877+
expect(sentinel.parentElement.parentElement).toHaveAttribute('inert');
18781878
});
18791879

18801880
it('should render the sentinel but not the loading indicator when not loading', async () => {
@@ -1922,7 +1922,9 @@ describe('Table', () => {
19221922
expect(onLoadMore).toHaveBeenCalledTimes(0);
19231923
let sentinel = tree.getByTestId('loadMoreSentinel');
19241924
expect(observe).toHaveBeenLastCalledWith(sentinel);
1925-
expect(sentinel.nodeName).toBe('TD');
1925+
expect(sentinel.nodeName).toBe('DIV');
1926+
expect(sentinel.parentElement.nodeName).toBe('TD');
1927+
expect(sentinel.parentElement.parentElement.nodeName).toBe('TR');
19261928

19271929
expect(onLoadMore).toHaveBeenCalledTimes(0);
19281930
act(() => {observer.instance.triggerCallback([{isIntersecting: true}]);});
@@ -2075,7 +2077,7 @@ describe('Table', () => {
20752077
expect(loaderParentStyles.height).toBe('30px');
20762078

20772079
let sentinel = within(loaderRow.parentElement).getByTestId('loadMoreSentinel');
2078-
expect(sentinel.parentElement).toHaveAttribute('inert');
2080+
expect(sentinel.parentElement.parentElement).toHaveAttribute('inert');
20792081
});
20802082

20812083
it('should not reserve room for the loader if isLoading is false', () => {
@@ -2086,10 +2088,10 @@ describe('Table', () => {
20862088
expect(within(tableTester.table).queryByText('spinner')).toBeFalsy();
20872089

20882090
let sentinel = within(tableTester.table).getByTestId('loadMoreSentinel');
2089-
let sentinelParentStyles = sentinel.parentElement.parentElement.style;
2090-
expect(sentinelParentStyles.top).toBe('1250px');
2091-
expect(sentinelParentStyles.height).toBe('0px');
2092-
expect(sentinel.parentElement).toHaveAttribute('inert');
2091+
let sentinelVirtWrapperStyles = sentinel.closest('[role="presentation"]').style;
2092+
expect(sentinelVirtWrapperStyles.top).toBe('1250px');
2093+
expect(sentinelVirtWrapperStyles.height).toBe('0px');
2094+
expect(sentinel.parentElement.parentElement).toHaveAttribute('inert');
20932095

20942096
tree.rerender(<VirtualizedTableLoad items={[]} />);
20952097
rows = tableTester.rows;
@@ -2098,9 +2100,9 @@ describe('Table', () => {
20982100
expect(emptyStateRow).toHaveTextContent('No results');
20992101
expect(within(tableTester.table).queryByText('spinner')).toBeFalsy();
21002102
sentinel = within(tableTester.table).getByTestId('loadMoreSentinel', {hidden: true});
2101-
sentinelParentStyles = sentinel.parentElement.parentElement.style;
2102-
expect(sentinelParentStyles.top).toBe('0px');
2103-
expect(sentinelParentStyles.height).toBe('0px');
2103+
sentinelVirtWrapperStyles = sentinel.closest('[role="presentation"]').style;
2104+
expect(sentinelVirtWrapperStyles.top).toBe('0px');
2105+
expect(sentinelVirtWrapperStyles.height).toBe('0px');
21042106

21052107
tree.rerender(<VirtualizedTableLoad items={[]} loadingState="loading" />);
21062108
rows = tableTester.rows;
@@ -2109,9 +2111,9 @@ describe('Table', () => {
21092111
expect(emptyStateRow).toHaveTextContent('loading');
21102112

21112113
sentinel = within(tableTester.table).getByTestId('loadMoreSentinel', {hidden: true});
2112-
sentinelParentStyles = sentinel.parentElement.parentElement.style;
2113-
expect(sentinelParentStyles.top).toBe('0px');
2114-
expect(sentinelParentStyles.height).toBe('0px');
2114+
sentinelVirtWrapperStyles = sentinel.closest('[role="presentation"]').style;
2115+
expect(sentinelVirtWrapperStyles.top).toBe('0px');
2116+
expect(sentinelVirtWrapperStyles.height).toBe('0px');
21152117
});
21162118

21172119
it('should have the correct row indicies after loading more items', async () => {

0 commit comments

Comments
 (0)