-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat-sheet-add-aria-attrs
- Loading branch information
Showing
58 changed files
with
845 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
|
||
import _ from 'react-virtualized-auto-sizer'; | ||
|
||
import {setupIntersectionObserverMock} from '../../../../test-utils/setupIntersectionObserverMock'; | ||
import {cleanup, render, screen} from '../../../../test-utils/utils'; | ||
import {List} from '../List'; | ||
import type {ListProps} from '../types'; | ||
|
||
function setup(props: Partial<ListProps<string>> = {}) { | ||
const baseProps: ListProps<string> = { | ||
items: ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'], | ||
itemsHeight: 150, | ||
itemHeight: 28, | ||
filterable: false, | ||
}; | ||
|
||
return render( | ||
<div> | ||
<List<string> {...baseProps} {...props} /> | ||
</div>, | ||
); | ||
} | ||
|
||
const mockOnLoadMorFn = jest.fn(); | ||
|
||
beforeAll(() => { | ||
setupIntersectionObserverMock(); | ||
}); | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
describe('base List', () => { | ||
it('should render loading indicator', () => { | ||
setup({virtualized: false, onLoadMore: mockOnLoadMorFn, loading: true}); | ||
|
||
const loader = screen.getByTestId('list-loader'); | ||
expect(loader).toBeInTheDocument(); | ||
}); | ||
it('should call onLoadMore callback when loading indicator is visible', () => { | ||
setup({virtualized: false, onLoadMore: mockOnLoadMorFn, loading: true}); | ||
|
||
const loader = screen.getByTestId('list-loader'); | ||
|
||
expect(loader).toBeVisible(); | ||
expect(mockOnLoadMorFn).toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
describe('virtualized List', () => { | ||
it('should render loading indicator', () => { | ||
setup({virtualized: true, onLoadMore: mockOnLoadMorFn, loading: true}); | ||
|
||
const loader = screen.getByTestId('list-loader'); | ||
expect(loader).toBeInTheDocument(); | ||
}); | ||
|
||
it('should call onLoadMore callback when loading indicator is visible', () => { | ||
setup({virtualized: true, onLoadMore: mockOnLoadMorFn, loading: true}); | ||
|
||
const loader = screen.getByTestId('list-loader'); | ||
expect(loader).toBeVisible(); | ||
expect(mockOnLoadMorFn).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.