Skip to content

Commit

Permalink
feat(test): added test for marker legend node
Browse files Browse the repository at this point in the history
  • Loading branch information
Maen Juganaikloo committed Oct 9, 2024
1 parent f2c919f commit c5b78c0
Show file tree
Hide file tree
Showing 2 changed files with 977 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/line/tests/Line.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,36 @@ it('should call the custom label callback for each point', () => {
}
})

it('should display a custom legendNode for marker', () => {
const data = [
{
id: 'A',
data: [
{ x: 0, y: 3 },
{ x: 1, y: 7 },
{ x: 2, y: 11 },
{ x: 3, y: 9 },
{ x: 4, y: 8 },
],
},
]
const markers = [{

Check failure on line 308 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Insert `⏎········`
axis: "x",

Check failure on line 309 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `········axis:·"x"` with `············axis:·'x'`
lineStyle: {

Check failure on line 310 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `········` with `············`
stroke: "lightblue",

Check failure on line 311 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `stroke:·"lightblue"` with `····stroke:·'lightblue'`
strokeWidth: 5

Check failure on line 312 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `············strokeWidth:·5` with `················strokeWidth:·5,`
},

Check failure on line 313 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `········` with `············`
legendPosition: "top",

Check failure on line 314 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `········legendPosition:·"top"` with `············legendPosition:·'top'`
legendNode: <foreignObject x={0} y={0} width={32} height={32}><div>😎</div></foreignObject>,

Check failure on line 315 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `legendNode:·<foreignObject·x={0}·y={0}·width={32}·height={32}><div>😎</div></foreignObject>` with `····legendNode:·(⏎················<foreignObject·x={0}·y={0}·width={32}·height={32}>⏎····················<div>😎</div>⏎················</foreignObject>⏎············)`
}]

Check failure on line 316 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `····}` with `········},⏎····`

const component = renderer.create(<Line width={500} height={300} data={data} animate={false} markers={markers} />)

Check failure on line 318 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Replace `<Line·width={500}·height={300}·data={data}·animate={false}·markers={markers}·/>` with `⏎········<Line·width={500}·height={300}·data={data}·animate={false}·markers={markers}·/>⏎····`

let tree = component.toJSON()
expect(tree).toMatchSnapshot()

})

describe('curve interpolation', () => {
const curveInterpolations = [
'basis',
Expand Down
Loading

0 comments on commit c5b78c0

Please sign in to comment.