1- import Guest from '../guest' ;
1+ import Guest , { $imports } from '../guest' ;
22import { EventBus } from '../util/emitter' ;
3- import { $imports } from '../guest' ;
43
54class FakeAdder {
65 constructor ( container , options ) {
@@ -234,7 +233,7 @@ describe('Guest', () => {
234233 } ) ;
235234
236235 describe ( 'events from sidebar' , ( ) => {
237- const emitGuestEvent = ( event , ...args ) => {
236+ const emitSidebarEvent = ( event , ...args ) => {
238237 for ( let [ evt , fn ] of fakeBridge . on . args ) {
239238 if ( event === evt ) {
240239 fn ( ...args ) ;
@@ -252,7 +251,7 @@ describe('Guest', () => {
252251 { annotation : { $tag : 'tag2' } , highlights : [ highlight1 ] } ,
253252 ] ;
254253
255- emitGuestEvent ( 'focusAnnotations' , [ 'tag1' ] ) ;
254+ emitSidebarEvent ( 'focusAnnotations' , [ 'tag1' ] ) ;
256255
257256 assert . calledWith (
258257 highlighter . setHighlightsFocused ,
@@ -270,7 +269,7 @@ describe('Guest', () => {
270269 { annotation : { $tag : 'tag2' } , highlights : [ highlight1 ] } ,
271270 ] ;
272271
273- emitGuestEvent ( 'focusAnnotations' , [ 'tag1' ] ) ;
272+ emitSidebarEvent ( 'focusAnnotations' , [ 'tag1' ] ) ;
274273
275274 assert . calledWith (
276275 highlighter . setHighlightsFocused ,
@@ -282,8 +281,8 @@ describe('Guest', () => {
282281 it ( 'updates focused tag set' , ( ) => {
283282 const guest = createGuest ( ) ;
284283
285- emitGuestEvent ( 'focusAnnotations' , [ 'tag1' ] ) ;
286- emitGuestEvent ( 'focusAnnotations' , [ 'tag2' , 'tag3' ] ) ;
284+ emitSidebarEvent ( 'focusAnnotations' , [ 'tag1' ] ) ;
285+ emitSidebarEvent ( 'focusAnnotations' , [ 'tag2' , 'tag3' ] ) ;
287286
288287 assert . deepEqual ( [ ...guest . focusedAnnotationTags ] , [ 'tag2' , 'tag3' ] ) ;
289288 } ) ;
@@ -302,7 +301,7 @@ describe('Guest', () => {
302301 } ,
303302 ] ;
304303
305- emitGuestEvent ( 'scrollToAnnotation' , 'tag1' ) ;
304+ emitSidebarEvent ( 'scrollToAnnotation' , 'tag1' ) ;
306305
307306 assert . called ( fakeIntegration . scrollToAnchor ) ;
308307 assert . calledWith ( fakeIntegration . scrollToAnchor , guest . anchors [ 0 ] ) ;
@@ -326,7 +325,7 @@ describe('Guest', () => {
326325 resolve ( ) ;
327326 } ) ;
328327
329- emitGuestEvent ( 'scrollToAnnotation' , 'tag1' ) ;
328+ emitSidebarEvent ( 'scrollToAnnotation' , 'tag1' ) ;
330329 } ) ;
331330 } ) ;
332331
@@ -345,7 +344,7 @@ describe('Guest', () => {
345344 event . preventDefault ( )
346345 ) ;
347346
348- emitGuestEvent ( 'scrollToAnnotation' , 'tag1' ) ;
347+ emitSidebarEvent ( 'scrollToAnnotation' , 'tag1' ) ;
349348
350349 assert . notCalled ( fakeIntegration . scrollToAnchor ) ;
351350 } ) ;
@@ -354,7 +353,7 @@ describe('Guest', () => {
354353 const guest = createGuest ( ) ;
355354
356355 guest . anchors = [ { annotation : { $tag : 'tag1' } } ] ;
357- emitGuestEvent ( 'scrollToAnnotation' , 'tag1' ) ;
356+ emitSidebarEvent ( 'scrollToAnnotation' , 'tag1' ) ;
358357
359358 assert . notCalled ( fakeIntegration . scrollToAnchor ) ;
360359 } ) ;
@@ -374,7 +373,7 @@ describe('Guest', () => {
374373 const eventEmitted = sandbox . stub ( ) ;
375374 guest . element . addEventListener ( 'scrolltorange' , eventEmitted ) ;
376375
377- emitGuestEvent ( 'scrollToAnnotation' , 'tag1' ) ;
376+ emitSidebarEvent ( 'scrollToAnnotation' , 'tag1' ) ;
378377
379378 assert . notCalled ( eventEmitted ) ;
380379 assert . notCalled ( fakeIntegration . scrollToAnchor ) ;
@@ -408,7 +407,7 @@ describe('Guest', () => {
408407
409408 fakeIntegration . getMetadata . resolves ( metadata ) ;
410409
411- emitGuestEvent (
410+ emitSidebarEvent (
412411 'getDocumentInfo' ,
413412 createCallback ( 'https://example.com/test.pdf' , metadata , done )
414413 ) ;
@@ -419,14 +418,14 @@ describe('Guest', () => {
419418 it ( 'sets visibility of highlights in document' , ( ) => {
420419 const guest = createGuest ( ) ;
421420
422- emitGuestEvent ( 'setVisibleHighlights' , true ) ;
421+ emitSidebarEvent ( 'setVisibleHighlights' , true ) ;
423422 assert . calledWith (
424423 highlighter . setHighlightsVisible ,
425424 guest . element ,
426425 true
427426 ) ;
428427
429- emitGuestEvent ( 'setVisibleHighlights' , false ) ;
428+ emitSidebarEvent ( 'setVisibleHighlights' , false ) ;
430429 assert . calledWith (
431430 highlighter . setHighlightsVisible ,
432431 guest . element ,
0 commit comments