From c6c5b8fab812b8b783d44eabc5f8d03d05f45156 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 7 Apr 2016 14:00:40 +0200 Subject: [PATCH] Use `beforeAll`/`afterAll` in `isExternalLinkTargetSet` in dom_utils_spec.js (issue 6905) Re: issue 6905. --- test/unit/dom_utils_spec.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/unit/dom_utils_spec.js b/test/unit/dom_utils_spec.js index ae20a7063..025fc3893 100644 --- a/test/unit/dom_utils_spec.js +++ b/test/unit/dom_utils_spec.js @@ -1,5 +1,5 @@ /* globals expect, it, describe, PDFJS, isExternalLinkTargetSet, LinkTarget, - getFilenameFromUrl */ + getFilenameFromUrl, beforeAll, afterAll */ 'use strict'; @@ -21,8 +21,16 @@ describe('dom_utils', function() { }); describe('isExternalLinkTargetSet', function() { - // Save the current state, to avoid interfering with other tests. - var previousExternalLinkTarget = PDFJS.externalLinkTarget; + var savedExternalLinkTarget; + + beforeAll(function (done) { + savedExternalLinkTarget = PDFJS.externalLinkTarget; + done(); + }); + + afterAll(function () { + PDFJS.externalLinkTarget = savedExternalLinkTarget; + }); it('handles the predefined LinkTargets', function() { for (var key in LinkTarget) { @@ -43,8 +51,5 @@ describe('dom_utils', function() { expect(isExternalLinkTargetSet()).toEqual(false); } }); - - // Reset the state. - PDFJS.externalLinkTarget = previousExternalLinkTarget; }); });