@@ -3,6 +3,7 @@ import DocumentAnnotator from '../DocumentAnnotator';
33import HighlightListener from '../../highlight/HighlightListener' ;
44import RegionManager from '../../region/RegionManager' ;
55import { Annotation , Event } from '../../@types' ;
6+ import { annotation as highlight } from '../../highlight/__mocks__/data' ;
67import { annotations as regions } from '../../region/__mocks__/data' ;
78import { fetchAnnotationsAction } from '../../store' ;
89import { HighlightManager } from '../../highlight' ;
@@ -39,7 +40,7 @@ describe('DocumentAnnotator', () => {
3940 } ;
4041
4142 const payload = {
42- entries : regions as Annotation [ ] ,
43+ entries : [ ... regions , highlight ] as Annotation [ ] ,
4344 limit : 1000 ,
4445 next_marker : null ,
4546 previous_marker : null ,
@@ -263,5 +264,13 @@ describe('DocumentAnnotator', () => {
263264 annotator . scrollToAnnotation ( null ) ;
264265 expect ( scrollToLocation ) . not . toHaveBeenCalled ( ) ;
265266 } ) ;
267+
268+ test ( 'should call scrollToLocation for highlight annotations' , ( ) => {
269+ const parentEl = annotator . annotatedEl as HTMLElement ;
270+ const referenceEl = parentEl . querySelector ( '[data-page-number="1"]' ) ;
271+
272+ annotator . scrollToAnnotation ( '223' ) ;
273+ expect ( scrollToLocation ) . toHaveBeenCalledWith ( parentEl , referenceEl , { offsets : { x : 15 , y : 10 } } ) ;
274+ } ) ;
266275 } ) ;
267276} ) ;
0 commit comments