-
Notifications
You must be signed in to change notification settings - Fork 605
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
* feat(radar): 雷达图辅助元素 point 默认继承主元素 state 设置(非 mix) * test(issue-2573): 增加单测
- Loading branch information
Showing
5 changed files
with
74 additions
and
6 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,68 @@ | ||
import { Radar } from '../../src'; | ||
import { SERIES_DATA } from '../data/radar'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
describe('#2573', () => { | ||
const data = SERIES_DATA; | ||
const radar = new Radar(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
data, | ||
xField: 'name', | ||
yField: 'value', | ||
seriesField: 'type', | ||
radius: 0.8, | ||
color: ['red', 'orange'], | ||
state: { | ||
default: { | ||
style: { | ||
stroke: 'red', | ||
}, | ||
}, | ||
active: { | ||
style: { | ||
stroke: 'green', | ||
}, | ||
}, | ||
}, | ||
point: {}, | ||
}); | ||
|
||
radar.render(); | ||
|
||
it('radar point 设置 state 状态样式不生效', () => { | ||
radar.setState('default', (datum) => datum['name'] === data[0].name); | ||
expect(radar.chart.geometries[1].elements[0].shape.attr('stroke')).toBe('red'); | ||
|
||
radar.setState('active', (datum) => datum['name'] === data[0].name); | ||
expect(radar.chart.geometries[1].elements[0].shape.attr('stroke')).toBe('green'); | ||
}); | ||
|
||
it('point state 优先级高', () => { | ||
radar.update({ | ||
point: { | ||
state: { | ||
default: { | ||
style: { | ||
stroke: 'blue', | ||
}, | ||
}, | ||
active: { | ||
style: { | ||
stroke: 'orange', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
radar.setState('default', (datum) => datum['name'] === data[0].name); | ||
expect(radar.chart.geometries[1].elements[0].shape.attr('stroke')).toBe('blue'); | ||
|
||
radar.setState('active', (datum) => datum['name'] === data[0].name); | ||
expect(radar.chart.geometries[1].elements[0].shape.attr('stroke')).toBe('orange'); | ||
}); | ||
|
||
afterAll(() => { | ||
radar.destroy(); | ||
}); | ||
}); |
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