Skip to content

Commit

Permalink
[Editor] Move setting window.uiManager back to the test code
Browse files Browse the repository at this point in the history
In PR #18574 setting `window.uiManager` was moved into the `src` folder
to avoid intermittent integration test failures because at the time we
lacked a way to register event listeners early (before PDF.js loads).
However, in PR #18617 this functionality got introduced, so we can now
use the new way of setting up the event bus in the tests to move this
back to the `test` folder again and to reduce the amount of test-only
code in the main codebase as discussed in PR #18574.

Partially reverts e037c57.
  • Loading branch information
timvandermeij committed Aug 18, 2024
1 parent b47c7ec commit db06011
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/display/editor/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ class AnnotationEditorUIManager {
this.isShiftKeyDown = false;

if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
window.uiManager = this;
Object.defineProperty(this, "reset", {
value: () => {
this.selectAll();
Expand Down
8 changes: 7 additions & 1 deletion test/integration/highlight_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,13 @@ describe("Highlight Editor", () => {
"tracemonkey.pdf",
".annotationEditorLayer",
null,
null,
{
eventBusSetup: eventBus => {
eventBus.on("annotationeditoruimanager", ({ uiManager }) => {
window.uiManager = uiManager;
});
},
},
{
highlightEditorColors: "red=#AB0000",
supportsCaretBrowsingMode: true,
Expand Down
8 changes: 7 additions & 1 deletion test/integration/stamp_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,13 @@ describe("Stamp Editor", () => {
"empty.pdf",
".annotationEditorLayer",
null,
null,
{
eventBusSetup: eventBus => {
eventBus.on("annotationeditoruimanager", ({ uiManager }) => {
window.uiManager = uiManager;
});
},
},
{
enableAltText: true,
enableUpdatedAddImage: true,
Expand Down

0 comments on commit db06011

Please sign in to comment.