-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(strategysheet): 趋势分析表 Tooltip 增加 label 属性用于自定义标题 (#1540)
* feat(strategysheet): 趋势分析表 Tooltip 增加 label 属性用于自定义标题 * feat: update * test: 增加测试
- Loading branch information
1 parent
4d2c256
commit b44ffe3
Showing
9 changed files
with
130 additions
and
42 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
48 changes: 48 additions & 0 deletions
48
...es/s2-react/__tests__/unit/components/sheets/strategy-sheet/custom-tooltip/index-spec.tsx
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,48 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { createMockCellInfo } from '../../../../../util/helpers'; | ||
import { | ||
StrategySheetColTooltip, | ||
StrategySheetDataTooltip, | ||
StrategySheetRowTooltip, | ||
} from '../../../../../../src/components/sheets/strategy-sheet/custom-tooltip'; | ||
|
||
describe('StrategySheet Tooltip Tests', () => { | ||
const mockCellInfo = createMockCellInfo('test'); | ||
const mockCell = { | ||
...mockCellInfo.mockCell, | ||
getMeta: () => { | ||
return { | ||
spreadsheet: { | ||
options: { | ||
style: {}, | ||
}, | ||
getRowNodes: jest.fn(), | ||
getColumnNodes: jest.fn(), | ||
dataSet: { | ||
getFieldDescription: jest.fn(), | ||
getFieldName: jest.fn(), | ||
}, | ||
}, | ||
}; | ||
}, | ||
}; | ||
|
||
test.each([ | ||
{ | ||
label: 'test col label', | ||
component: StrategySheetColTooltip, | ||
}, | ||
{ | ||
label: 'test data label', | ||
component: StrategySheetDataTooltip, | ||
}, | ||
{ | ||
label: 'test row label', | ||
component: StrategySheetRowTooltip, | ||
}, | ||
])('should render tooltip with %o', ({ label, component: Comp }) => { | ||
render(<Comp cell={mockCell} label={label} />); | ||
expect(screen.getByText(label)).toBeDefined(); | ||
}); | ||
}); |
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
3 changes: 3 additions & 0 deletions
3
packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/index.ts
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,3 @@ | ||
export * from './custom-col-tooltip'; | ||
export * from './custom-data-tooltip'; | ||
export * from './custom-row-tooltip'; |
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