-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 增加单测,保证"开启中心文本交互时,显式注册 tooltip 交互可以开启 tooltip"
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 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,37 @@ | ||
import { Pie } from '../../src'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
describe('#2096', () => { | ||
const pie = new Pie(createDiv(), { | ||
data: [ | ||
{ type: '1', value: 10 }, | ||
{ type: '13', value: 10 }, | ||
{ type: '55', value: 10 }, | ||
], | ||
angleField: 'value', | ||
colorField: 'type', | ||
radius: 0.8, | ||
}); | ||
|
||
it('normal', () => { | ||
pie.render(); | ||
expect(pie.chart.interactions.tooltip).toBeDefined(); | ||
}); | ||
|
||
it('开启中心文本交互时,默认关闭 tooltip', () => { | ||
pie.update({ | ||
innerRadius: 0.64, | ||
statistic: {}, | ||
interactions: [{ type: 'pie-statistic-active' }], | ||
}); | ||
|
||
expect(pie.chart.interactions.tooltip).not.toBeDefined(); | ||
}); | ||
|
||
it('开启中心文本交互时,需要显式注册 tooltip 交互来开启 tooltip', () => { | ||
pie.update({ | ||
interactions: [{ type: 'pie-statistic-active' }, { type: 'tooltip' }], | ||
}); | ||
expect(pie.chart.interactions.tooltip).toBeDefined(); | ||
}); | ||
}); |