-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: render maxLines text correctly after render twice
- Loading branch information
huiyu.zjt
committed
Feb 1, 2025
1 parent
330bbf2
commit f51ba4c
Showing
2 changed files
with
60 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @description spec for issue #3087 | ||
* https://github.com/antvis/S2/issues/3087 | ||
*/ | ||
import { TableSheet } from '../../src'; | ||
import { getContainer } from '../util/helpers'; | ||
|
||
const data = Array(100).fill({ | ||
province: 'aaaa'.repeat(100), | ||
city: 'aa', | ||
}); | ||
|
||
describe('Table MaxLines Tests', () => { | ||
test('should render maxLines text correctly after render twice', async () => { | ||
const tableSheet = new TableSheet( | ||
getContainer(), | ||
{ | ||
fields: { | ||
columns: ['province', 'city'], | ||
}, | ||
meta: [ | ||
{ | ||
field: 'province', | ||
name: '省份', | ||
}, | ||
{ | ||
field: 'city', | ||
name: '城市', | ||
}, | ||
], | ||
data, | ||
}, | ||
{ | ||
width: 600, | ||
height: 480, | ||
style: { | ||
colCell: { | ||
maxLines: 3, | ||
wordWrap: true, | ||
textOverflow: 'ellipsis', | ||
}, | ||
dataCell: { | ||
maxLines: 3, | ||
wordWrap: true, | ||
textOverflow: 'ellipsis', | ||
}, | ||
}, | ||
}, | ||
); | ||
|
||
await tableSheet.render(); | ||
const actualText1 = tableSheet.facet.getDataCells()[0].getActualText(); | ||
|
||
await tableSheet.render(); | ||
const actualText2 = tableSheet.facet.getDataCells()[0].getActualText(); | ||
|
||
expect(actualText1).toEqual(actualText2); | ||
}); | ||
}); |
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