Merge pull request #7164 from Snuffleupagus/issue-6905-dom_utils_spec

Use `beforeAll`/`afterAll` in `isExternalLinkTargetSet` in dom_utils_spec.js (issue 6905)
This commit is contained in:
Tim van der Meij 2016-04-07 20:39:01 +02:00
commit bc8df673a6

View File

@ -1,5 +1,5 @@
/* globals expect, it, describe, PDFJS, isExternalLinkTargetSet, LinkTarget, /* globals expect, it, describe, PDFJS, isExternalLinkTargetSet, LinkTarget,
getFilenameFromUrl */ getFilenameFromUrl, beforeAll, afterAll */
'use strict'; 'use strict';
@ -21,8 +21,16 @@ describe('dom_utils', function() {
}); });
describe('isExternalLinkTargetSet', function() { describe('isExternalLinkTargetSet', function() {
// Save the current state, to avoid interfering with other tests. var savedExternalLinkTarget;
var previousExternalLinkTarget = PDFJS.externalLinkTarget;
beforeAll(function (done) {
savedExternalLinkTarget = PDFJS.externalLinkTarget;
done();
});
afterAll(function () {
PDFJS.externalLinkTarget = savedExternalLinkTarget;
});
it('handles the predefined LinkTargets', function() { it('handles the predefined LinkTargets', function() {
for (var key in LinkTarget) { for (var key in LinkTarget) {
@ -43,8 +51,5 @@ describe('dom_utils', function() {
expect(isExternalLinkTargetSet()).toEqual(false); expect(isExternalLinkTargetSet()).toEqual(false);
} }
}); });
// Reset the state.
PDFJS.externalLinkTarget = previousExternalLinkTarget;
}); });
}); });