1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #8331 from Snuffleupagus/ui-utils-unit-tests-travis

Enable running the `ui_utils` unit-tests on Travis
This commit is contained in:
Tim van der Meij 2017-04-27 15:33:32 +02:00 committed by GitHub
commit f4690a3c93
5 changed files with 17 additions and 4 deletions

View file

@ -77,6 +77,7 @@ var DEFINES = {
MINIFIED: false,
SINGLE_FILE: false,
COMPONENTS: false,
LIB: false,
PDFJS_NEXT: false,
};
@ -998,6 +999,7 @@ gulp.task('lib', ['buildnumber'], function () {
saveComments: false,
defines: builder.merge(DEFINES, {
GENERIC: true,
LIB: true,
BUNDLE_VERSION: versionInfo.version,
BUNDLE_BUILD: versionInfo.commit
})

View file

@ -16,6 +16,7 @@
"primitives_spec.js",
"stream_spec.js",
"type1_parser_spec.js",
"ui_utils_spec.js",
"unicode_spec.js",
"util_spec.js"
]

View file

@ -31,6 +31,7 @@ var binarySearchFirstItem = webUiUtils.binarySearchFirstItem;
var getPDFFileNameFromURL = webUiUtils.getPDFFileNameFromURL;
var EventBus = webUiUtils.EventBus;
var createObjectURL = sharedUtil.createObjectURL;
var isNodeJS = sharedUtil.isNodeJS;
describe('ui_utils', function() {
describe('binary search', function() {
@ -160,6 +161,9 @@ describe('ui_utils', function() {
it('gets PDF filename from query string appended to "blob:" URL',
function() {
if (isNodeJS()) {
pending('Blob in not supported in Node.js.');
}
var typedArray = new Uint8Array([1, 2, 3, 4, 5]);
var blobUrl = createObjectURL(typedArray, 'application/pdf');
// Sanity check to ensure that a "blob:" URL was returned.

View file

@ -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');
}

View file

@ -30,7 +30,8 @@ var RendererType = {
SVG: 'svg',
};
var mozL10n = document.mozL10n || document.webL10n;
var mozL10n = typeof document !== 'undefined' ?
(document.mozL10n || document.webL10n) : undefined;
/**
* Disables fullscreen support, and by extension Presentation Mode,
@ -81,8 +82,9 @@ if (typeof PDFJSDev === 'undefined' ||
* Interface locale settings.
* @var {string}
*/
PDFJS.locale = (PDFJS.locale === undefined ? navigator.language :
PDFJS.locale);
PDFJS.locale =
(PDFJS.locale === undefined && typeof navigator !== 'undefined' ?
navigator.language : PDFJS.locale);
}
/**