mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Add setStubs/unsetStubs to domstubs to support testing
Do not directly export to global. Instead, export all stubs in domstubs.js and add a method setStubs to assign all exported stubs to a namespace. Then replace the import domstubs with an explicit call to this setStubs method. Also added unsetStubs for undoing the changes. This is done to allow unit testing of the SVG backend without namespace pollution.
This commit is contained in:
parent
94f1dde07d
commit
9caaaf3a91
2 changed files with 22 additions and 5 deletions
|
@ -8,7 +8,7 @@
|
|||
var fs = require('fs');
|
||||
|
||||
// HACK few hacks to let PDF.js be loaded not as a module in global space.
|
||||
require('./domstubs.js');
|
||||
require('./domstubs.js').setStubs(global);
|
||||
|
||||
// Run `gulp dist-install` to generate 'pdfjs-dist' npm package files.
|
||||
var pdfjsLib = require('pdfjs-dist');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue