From a8021208eaef252363c226046c575577530cc164 Mon Sep 17 00:00:00 2001 From: calixteman Date: Fri, 12 Feb 2021 05:19:58 -0800 Subject: [PATCH] Restore window.alert after use in scripting test (#12987) --- test/unit/scripting_spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/scripting_spec.js b/test/unit/scripting_spec.js index 9448cb67bf946..3890f2c555a32 100644 --- a/test/unit/scripting_spec.js +++ b/test/unit/scripting_spec.js @@ -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`; @@ -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 }); @@ -76,6 +77,7 @@ describe("Scripting", function () { sandbox.nukeSandbox(); sandbox = null; send_queue = null; + window.alert = windowAlert; }); describe("Sandbox", function () {