-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scroll): emit 'annotations_initialized' when annotations first i…
…nitializes. (#515) * feat(scroll): add method to return annotation by Id * feat(scroll): add method to return annotation by Id * accommodate changes in content-preview to send ready event with annotations once annotations are loaded. * feat(scroll): add method to return annotation by Id * PR Feedback * feat(scroll): add method to return annotation by Id * Refactor to emit 'annotations_initialized' using eventing middleware * feat(scroll): add method to return annotation by Id * Remove un-used class variable * feat(scroll): add method to return annotation by Id * PR Feedback * feat(scroll): add method to return annotation by Id * PR Feedback Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
28e2e1d
commit 6021585
Showing
14 changed files
with
95 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import eventManager from '../../../common/EventManager'; | ||
import annotationState from '../../annotations/__mocks__/annotationsState'; | ||
import { AppState } from '../../types'; | ||
import { handleAnnotationsInitialized } from '../init'; | ||
|
||
jest.mock('../../../common/EventManager'); | ||
|
||
describe('store/eventing/init', () => { | ||
test('should emit annotations_initialized event with annotations', () => { | ||
handleAnnotationsInitialized({} as AppState, { annotations: annotationState } as AppState); | ||
|
||
expect(eventManager.emit).toBeCalledWith('annotations_initialized', { | ||
annotations: [annotationState.byId.test1, annotationState.byId.test2, annotationState.byId.test3], | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import eventManager from '../../common/EventManager'; | ||
import { AppState } from '../types'; | ||
import { Event } from '../../@types'; | ||
import { getAnnotations } from '../annotations'; | ||
|
||
export const handleAnnotationsInitialized = (prevState: AppState, nextState: AppState): void => { | ||
eventManager.emit(Event.ANNOTATIONS_INITIALIZED, { annotations: getAnnotations(nextState) }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters