Skip to content

Commit

Permalink
Restore window.alert after use in scripting test (#12987)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman authored Feb 12, 2021
1 parent fc92582 commit a802120
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/unit/scripting_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { loadScript } from "../../src/display/display_utils.js";
const sandboxBundleSrc = "../../build/generic/build/pdf.sandbox.js";

describe("Scripting", function () {
let sandbox, send_queue, test_id, ref;
let sandbox, send_queue, test_id, ref, windowAlert;

function getId() {
const id = `${ref++}R`;
Expand Down Expand Up @@ -48,6 +48,7 @@ describe("Scripting", function () {
send_queue.set(event.detail.id, event.detail);
}
};
windowAlert = window.alert;
window.alert = value => {
const command = "alert";
send_queue.set(command, { command, value });
Expand Down Expand Up @@ -76,6 +77,7 @@ describe("Scripting", function () {
sandbox.nukeSandbox();
sandbox = null;
send_queue = null;
window.alert = windowAlert;
});

describe("Sandbox", function () {
Expand Down

0 comments on commit a802120

Please sign in to comment.