@@ -304,10 +304,66 @@ describe('BaseAnnotator', () => {
304304 } ) ;
305305 } ) ;
306306
307+ describe ( 'getActiveId()' , ( ) => {
308+ test ( 'should return the active annotation id from the store' , ( ) => {
309+ ( annotator . store . getState as jest . Mock ) . mockReturnValue ( {
310+ annotations : { activeId : 'abc123' } ,
311+ } ) ;
312+
313+ expect ( annotator . getActiveId ( ) ) . toBe ( 'abc123' ) ;
314+ } ) ;
315+
316+ test ( 'should return null if no active annotation' , ( ) => {
317+ ( annotator . store . getState as jest . Mock ) . mockReturnValue ( {
318+ annotations : { activeId : null } ,
319+ } ) ;
320+
321+ expect ( annotator . getActiveId ( ) ) . toBeNull ( ) ;
322+ } ) ;
323+ } ) ;
324+
325+ describe ( 'getAnnotationContainerEl()' , ( ) => {
326+ test ( 'should return the container element when initialized' , ( ) => {
327+ annotator . init ( 1 ) ;
328+
329+ expect ( annotator . getAnnotationContainerEl ( ) ) . toBe ( annotator . containerEl ) ;
330+ } ) ;
331+
332+ test ( 'should return null when containerEl is undefined' , ( ) => {
333+ annotator . containerEl = undefined ;
334+
335+ expect ( annotator . getAnnotationContainerEl ( ) ) . toBeNull ( ) ;
336+ } ) ;
337+ } ) ;
338+
307339 describe ( 'isFeatureEnabled()' , ( ) => {
308340 test ( 'should return whether feature is enabled or not' , ( ) => {
309341 expect ( annotator . isFeatureEnabled ( 'enabledFeature' ) ) . toBe ( true ) ;
310342 expect ( annotator . isFeatureEnabled ( 'notEnabledFeature' ) ) . toBe ( false ) ;
311343 } ) ;
312344 } ) ;
345+
346+ describe ( 'isPopupOpen()' , ( ) => {
347+ test ( 'should return true when a popup element exists' , ( ) => {
348+ annotator . init ( 1 ) ;
349+ const popup = document . createElement ( 'div' ) ;
350+ popup . classList . add ( 'ba-Popup' ) ;
351+ annotator . containerEl ?. appendChild ( popup ) ;
352+
353+ expect ( annotator . isPopupOpen ( ) ) . toBe ( true ) ;
354+ } ) ;
355+
356+ test ( 'should return false when no popup element exists' , ( ) => {
357+ annotator . init ( 1 ) ;
358+ annotator . containerEl ?. querySelectorAll ( '.ba-Popup' ) . forEach ( el => el . remove ( ) ) ;
359+
360+ expect ( annotator . isPopupOpen ( ) ) . toBe ( false ) ;
361+ } ) ;
362+
363+ test ( 'should return false when containerEl is undefined' , ( ) => {
364+ annotator . containerEl = undefined ;
365+
366+ expect ( annotator . isPopupOpen ( ) ) . toBe ( false ) ;
367+ } ) ;
368+ } ) ;
313369} ) ;
0 commit comments