File tree 1 file changed +34
-1
lines changed
packages/scatterplot/tests
1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,40 @@ describe('event handlers', () => {
389
389
} )
390
390
391
391
describe ( 'annotations' , ( ) => {
392
- it ( 'should support annotations' , ( ) => { } )
392
+ it ( 'should support annotations' , ( ) => {
393
+ const wrapper = mount (
394
+ < ScatterPlot < TestDatum >
395
+ { ...baseProps }
396
+ layers = { [ 'nodes' , 'annotations' ] }
397
+ isInteractive = { false }
398
+ annotations = { [
399
+ {
400
+ match : d => d . index === 2 ,
401
+ type : 'circle' ,
402
+ note : 'annotation' ,
403
+ noteX : 350 ,
404
+ noteY : 50 ,
405
+ } ,
406
+ ] }
407
+ />
408
+ )
409
+
410
+ const annotation = wrapper . find ( 'Annotation' )
411
+ expect ( annotation . exists ( ) ) . toBe ( true )
412
+
413
+ const node = wrapper . find ( 'Node' ) . at ( 2 )
414
+
415
+ expect ( annotation . prop ( 'datum' ) ) . toBe ( node . prop ( 'node' ) )
416
+ expect ( annotation . prop ( 'x' ) ) . toBe ( node . prop < ScatterPlotNodeData < TestDatum > > ( 'node' ) . x )
417
+ expect ( annotation . prop ( 'y' ) ) . toBe ( node . prop < ScatterPlotNodeData < TestDatum > > ( 'node' ) . y )
418
+ expect ( annotation . prop ( 'size' ) ) . toBe ( node . prop < ScatterPlotNodeData < TestDatum > > ( 'node' ) . size )
419
+ expect ( annotation . prop ( 'width' ) ) . toBe (
420
+ node . prop < ScatterPlotNodeData < TestDatum > > ( 'node' ) . size
421
+ )
422
+ expect ( annotation . prop ( 'height' ) ) . toBe (
423
+ node . prop < ScatterPlotNodeData < TestDatum > > ( 'node' ) . size
424
+ )
425
+ } )
393
426
394
427
it ( 'should support markers' , ( ) => {
395
428
const wrapper = mount (
You can’t perform that action at this time.
0 commit comments