-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: 修复列等宽布局模式下角头出现省略号 close #2726 * test: 更新快照
- Loading branch information
1 parent
439162d
commit b4e07b9
Showing
4 changed files
with
64 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* @description spec for issue #2726 | ||
* https://github.com/antvis/S2/issues/2726 | ||
*/ | ||
import { LayoutWidthType, type S2Options } from '../../src'; | ||
import { createPivotSheet } from '../util/helpers'; | ||
import { SpreadSheet } from '@/sheet-type'; | ||
|
||
const s2Options: S2Options = { | ||
width: 800, | ||
height: 600, | ||
style: { | ||
layoutWidthType: LayoutWidthType.ColAdaptive, | ||
}, | ||
showDefaultHeaderActionIcon: false, | ||
}; | ||
|
||
describe('Col Adaptive Layout Tests', () => { | ||
const expectTextOverflowing = (s2: SpreadSheet) => { | ||
s2.facet.getCells().forEach((cell) => { | ||
expect(cell.getTextShape().isOverflowing()).toBeFalsy(); | ||
}); | ||
}; | ||
|
||
test('should get max row header width by corner cell width', async () => { | ||
const s2 = createPivotSheet(s2Options); | ||
|
||
s2.setDataCfg({ | ||
meta: [ | ||
{ | ||
field: 'province', | ||
name: '省份省份省份省份省份省份省份', | ||
}, | ||
{ | ||
field: 'city', | ||
name: '城市城市城市城市城市', | ||
}, | ||
], | ||
}); | ||
|
||
await s2.render(); | ||
|
||
const cornerNodeWidthList = s2.facet | ||
.getCornerNodes() | ||
.map((node) => Math.floor(node.width)); | ||
|
||
expect(cornerNodeWidthList).toEqual([184, 136, 320]); | ||
expectTextOverflowing(s2); | ||
}); | ||
}); |
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