| 1 | import { imgSnapshotTest } from '../../helpers/util'; |
| 2 | |
| 3 | describe('radar structure', () => { |
| 4 | it('should render a simple radar diagram', () => { |
| 5 | imgSnapshotTest( |
| 6 | `radar-beta |
| 7 | title Best Radar Ever |
| 8 | axis A, B, C |
| 9 | curve c1{1, 2, 3} |
| 10 | ` |
| 11 | ); |
| 12 | }); |
| 13 | |
| 14 | it('should render a radar diagram with multiple curves', () => { |
| 15 | imgSnapshotTest( |
| 16 | `radar-beta |
| 17 | title Best Radar Ever |
| 18 | axis A, B, C |
| 19 | curve c1{1, 2, 3} |
| 20 | curve c2{2, 3, 1} |
| 21 | ` |
| 22 | ); |
| 23 | }); |
| 24 | |
| 25 | it('should render a complex radar diagram', () => { |
| 26 | imgSnapshotTest( |
| 27 | `radar-beta |
| 28 | title My favorite ninjas |
| 29 | axis Agility, Speed, Strength |
| 30 | axis Stam["Stamina"] , Intel["Intelligence"] |
| 31 | |
| 32 | curve Ninja1["Naruto Uzumaki"]{ |
| 33 | Agility 2, Speed 2, |
| 34 | Strength 3, Stam 5, |
| 35 | Intel 0 |
| 36 | } |
| 37 | curve Ninja2["Sasuke"]{2, 3, 4, 1, 5} |
| 38 | curve Ninja3 {3, 2, 1, 5, 4} |
| 39 | |
| 40 | showLegend true |
| 41 | ticks 3 |
| 42 | max 8 |
| 43 | min 0 |
| 44 | graticule polygon |
| 45 | ` |
| 46 | ); |
| 47 | cy.get('svg').should((svg) => { |
| 48 | expect(svg).to.have.length(1); |
| 49 | }); |
| 50 | }); |
| 51 | |
| 52 | it('should render radar diagram with config override', () => { |
| 53 | imgSnapshotTest( |
| 54 | `radar-beta |
| 55 | title Best Radar Ever |
| 56 | axis A,B,C |
| 57 | curve mycurve{1,2,3}`, |
| 58 | { radar: { marginTop: 100, axisScaleFactor: 0.5 } } |
| 59 | ); |
| 60 | }); |
| 61 | |
| 62 | it('should parse radar diagram with theme override', () => { |
| 63 | imgSnapshotTest( |
| 64 | `radar-beta |
| 65 | axis A,B,C |
| 66 | curve mycurve{1,2,3}`, |
| 67 | { theme: 'base', themeVariables: { fontSize: 80, cScale0: '#FF0000' } } |
| 68 | ); |
| 69 | }); |
| 70 | |
| 71 | it('should handle radar diagram with radar style override', () => { |
| 72 | imgSnapshotTest( |
| 73 | `radar-beta |
| 74 | axis A,B,C |
| 75 | curve mycurve{1,2,3}`, |
| 76 | { theme: 'base', themeVariables: { radar: { axisColor: '#FF0000' } } } |
| 77 | ); |
| 78 | }); |
| 79 | }); |
| 80 | |