-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Table): fix rowHeight is invalid when virtualized
- Loading branch information
Showing
8 changed files
with
55 additions
and
23 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
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 |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
&-row { | ||
overflow: hidden; | ||
position: absolute; | ||
height: 36px; | ||
width: 100%; | ||
top: 0; | ||
transition: none; | ||
|
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,38 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Table from '../src/Table'; | ||
import Column from '../src/Column'; | ||
import Cell from '../src/Cell'; | ||
import HeaderCell from '../src/HeaderCell'; | ||
|
||
describe('VirtualizedTable', () => { | ||
it('Should be virtualized, and check `maximum update depth exceeded`', () => { | ||
expect(() => { | ||
render( | ||
<Table virtualized data={[{ id: 1 }]}> | ||
<Column> | ||
<HeaderCell>ID</HeaderCell> | ||
<Cell dataKey="id" /> | ||
</Column> | ||
</Table> | ||
); | ||
}).to.not.throw(); | ||
}); | ||
|
||
// issue: https://github.com/rsuite/rsuite/issues/3226 | ||
it('Should render correct row height when virtualized', () => { | ||
render( | ||
<Table virtualized data={[{ id: 1 }]} rowHeight={50} headerHeight={60}> | ||
<Column> | ||
<HeaderCell>ID</HeaderCell> | ||
<Cell dataKey="id" /> | ||
</Column> | ||
</Table> | ||
); | ||
|
||
expect(screen.getAllByRole('row')[0]).to.have.style('height', '60px'); | ||
expect(screen.getAllByRole('row')[1]).to.have.style('height', '50px'); | ||
expect(screen.getByRole('columnheader')).to.have.style('height', '60px'); | ||
expect(screen.getByRole('gridcell')).to.have.style('height', '50px'); | ||
}); | ||
}); |