|
@@ -259,10 +259,10 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
describe('PDFWorker', function () {
|
|
|
- if ((0, _is_node2.default)()) {
|
|
|
- pending('Worker is not supported in Node.js.');
|
|
|
- }
|
|
|
it('worker created or destroyed', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('Worker is not supported in Node.js.');
|
|
|
+ }
|
|
|
var worker = new _api.PDFWorker({ name: 'test1' });
|
|
|
worker.promise.then(function () {
|
|
|
expect(worker.name).toEqual('test1');
|
|
@@ -279,6 +279,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
it('worker created or destroyed by getDocument', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('Worker is not supported in Node.js.');
|
|
|
+ }
|
|
|
var loadingTask = (0, _api.getDocument)(basicApiGetDocumentParams);
|
|
|
var worker;
|
|
|
loadingTask.promise.then(function () {
|
|
@@ -298,6 +301,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
it('worker created and can be used in getDocument', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('Worker is not supported in Node.js.');
|
|
|
+ }
|
|
|
var worker = new _api.PDFWorker({ name: 'test1' });
|
|
|
var loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)(basicApiFileName, { worker: worker }));
|
|
|
loadingTask.promise.then(function () {
|
|
@@ -318,6 +324,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
it('creates more than one worker', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('Worker is not supported in Node.js.');
|
|
|
+ }
|
|
|
var worker1 = new _api.PDFWorker({ name: 'test1' });
|
|
|
var worker2 = new _api.PDFWorker({ name: 'test2' });
|
|
|
var worker3 = new _api.PDFWorker({ name: 'test3' });
|
|
@@ -333,6 +342,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
it('gets current workerSrc', function () {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('Worker is not supported in Node.js.');
|
|
|
+ }
|
|
|
var workerSrc = _api.PDFWorker.getWorkerSrc();
|
|
|
expect(typeof workerSrc === 'undefined' ? 'undefined' : _typeof(workerSrc)).toEqual('string');
|
|
|
expect(workerSrc).toEqual(_worker_options.GlobalWorkerOptions.workerSrc);
|
|
@@ -1019,10 +1031,7 @@ describe('api', function () {
|
|
|
})]).then(done);
|
|
|
});
|
|
|
});
|
|
|
- describe('Multiple PDFJS instances', function () {
|
|
|
- if ((0, _is_node2.default)()) {
|
|
|
- pending('TODO: Support Canvas testing in Node.js.');
|
|
|
- }
|
|
|
+ describe('Multiple `getDocument` instances', function () {
|
|
|
var pdf1 = (0, _test_utils.buildGetDocumentParams)('tracemonkey.pdf');
|
|
|
var pdf2 = (0, _test_utils.buildGetDocumentParams)('TAMReview.pdf');
|
|
|
var pdf3 = (0, _test_utils.buildGetDocumentParams)('issue6068.pdf');
|
|
@@ -1059,6 +1068,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
it('should correctly render PDFs in parallel', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('TODO: Support Canvas testing in Node.js.');
|
|
|
+ }
|
|
|
var baseline1, baseline2, baseline3;
|
|
|
var promiseDone = renderPDF(pdf1).then(function (data1) {
|
|
|
baseline1 = data1;
|
|
@@ -1083,12 +1095,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
describe('PDFDataRangeTransport', function () {
|
|
|
- if ((0, _is_node2.default)()) {
|
|
|
- pending('XMLHttpRequest is not supported in Node.js.');
|
|
|
- }
|
|
|
- var pdfPath = new URL('../pdfs/tracemonkey.pdf', window.location).href;
|
|
|
var loadPromise;
|
|
|
function getDocumentData() {
|
|
|
+ var pdfPath = new URL('../pdfs/tracemonkey.pdf', window.location).href;
|
|
|
if (loadPromise) {
|
|
|
return loadPromise;
|
|
|
}
|
|
@@ -1107,6 +1116,9 @@ describe('api', function () {
|
|
|
return loadPromise;
|
|
|
}
|
|
|
it('should fetch document info and page using ranges', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('XMLHttpRequest is not supported in Node.js.');
|
|
|
+ }
|
|
|
var transport;
|
|
|
var initialDataLength = 4000;
|
|
|
var fetches = 0;
|
|
@@ -1139,6 +1151,9 @@ describe('api', function () {
|
|
|
});
|
|
|
});
|
|
|
it('should fetch document info and page using range and streaming', function (done) {
|
|
|
+ if ((0, _is_node2.default)()) {
|
|
|
+ pending('XMLHttpRequest is not supported in Node.js.');
|
|
|
+ }
|
|
|
var transport;
|
|
|
var initialDataLength = 4000;
|
|
|
var fetches = 0;
|