mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Enable running the ui_utils
unit-tests on Travis
With the exception of just one test-case, all the current `ui_utils` unit-tests can run successfully on Node.js (since most of them doesn't rely on the DOM). To get this working, I had to first of all add a new `LIB` build flag such that `gulp lib` produces a `web/pdfjs.js` file that is able to load `pdf.js` successfully. Second of all, since neither `document` nor `navigator` is available in Node.js, `web/ui_utils.js` was adjusted slightly to avoid errors.
This commit is contained in:
parent
5fe26bb9da
commit
ae04cf1c37
5 changed files with 17 additions and 4 deletions
|
@ -23,7 +23,11 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {
|
|||
if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {
|
||||
pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||
} else if (typeof require === 'function') {
|
||||
pdfjsLib = require('../build/pdf.js');
|
||||
if (PDFJSDev.test('LIB')) {
|
||||
pdfjsLib = require('../pdf.js');
|
||||
} else {
|
||||
pdfjsLib = require('../build/pdf.js');
|
||||
}
|
||||
} else {
|
||||
throw new Error('Neither `require` nor `window` found');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue