mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Update packages
Jasmine had a major version bump and required a few minor changes in our booting code. Most notably, using `pending` in a `describe` block is no longer supported, so we can only return early there. On the positive side, the unit tests now run in a random order by default, which eliminates any dependencies between unit tests. Note that upgrading to Webpack 4 is out of scope for this patch since the bots cannot work well with the newly generated bundles (both browsers on both bots do not react within 120 seconds). Webpack 4 is not faster for us than Webpack 3, so for now there is no need to upgrade.
This commit is contained in:
parent
db6e316efd
commit
95de23e6e3
6 changed files with 61 additions and 37 deletions
|
@ -318,11 +318,11 @@ describe('api', function() {
|
|||
});
|
||||
|
||||
describe('PDFWorker', function() {
|
||||
if (isNodeJS()) {
|
||||
pending('Worker is not supported in Node.js.');
|
||||
}
|
||||
|
||||
it('worker created or destroyed', function (done) {
|
||||
if (isNodeJS()) {
|
||||
pending('Worker is not supported in Node.js.');
|
||||
}
|
||||
|
||||
var worker = new PDFWorker({ name: 'test1', });
|
||||
worker.promise.then(function () {
|
||||
expect(worker.name).toEqual('test1');
|
||||
|
@ -340,6 +340,10 @@ describe('api', function() {
|
|||
});
|
||||
});
|
||||
it('worker created or destroyed by getDocument', function (done) {
|
||||
if (isNodeJS()) {
|
||||
pending('Worker is not supported in Node.js.');
|
||||
}
|
||||
|
||||
var loadingTask = getDocument(basicApiGetDocumentParams);
|
||||
var worker;
|
||||
loadingTask.promise.then(function () {
|
||||
|
@ -360,6 +364,10 @@ describe('api', function() {
|
|||
});
|
||||
});
|
||||
it('worker created and can be used in getDocument', function (done) {
|
||||
if (isNodeJS()) {
|
||||
pending('Worker is not supported in Node.js.');
|
||||
}
|
||||
|
||||
var worker = new PDFWorker({ name: 'test1', });
|
||||
var loadingTask = getDocument(
|
||||
buildGetDocumentParams(basicApiFileName, {
|
||||
|
@ -385,6 +393,10 @@ describe('api', function() {
|
|||
});
|
||||
});
|
||||
it('creates more than one worker', function (done) {
|
||||
if (isNodeJS()) {
|
||||
pending('Worker is not supported in Node.js.');
|
||||
}
|
||||
|
||||
var worker1 = new PDFWorker({ name: 'test1', });
|
||||
var worker2 = new PDFWorker({ name: 'test2', });
|
||||
var worker3 = new PDFWorker({ name: 'test3', });
|
||||
|
@ -403,6 +415,10 @@ describe('api', function() {
|
|||
});
|
||||
});
|
||||
it('gets current workerSrc', function() {
|
||||
if (isNodeJS()) {
|
||||
pending('Worker is not supported in Node.js.');
|
||||
}
|
||||
|
||||
let workerSrc = PDFWorker.getWorkerSrc();
|
||||
expect(typeof workerSrc).toEqual('string');
|
||||
expect(workerSrc).toEqual(GlobalWorkerOptions.workerSrc);
|
||||
|
@ -1190,10 +1206,7 @@ describe('api', function() {
|
|||
]).then(done);
|
||||
});
|
||||
});
|
||||
describe('Multiple PDFJS instances', function() {
|
||||
if (isNodeJS()) {
|
||||
pending('TODO: Support Canvas testing in Node.js.');
|
||||
}
|
||||
describe('Multiple `getDocument` instances', function() {
|
||||
// Regression test for https://github.com/mozilla/pdf.js/issues/6205
|
||||
// A PDF using the Helvetica font.
|
||||
var pdf1 = buildGetDocumentParams('tracemonkey.pdf');
|
||||
|
@ -1247,6 +1260,10 @@ describe('api', function() {
|
|||
});
|
||||
|
||||
it('should correctly render PDFs in parallel', function(done) {
|
||||
if (isNodeJS()) {
|
||||
pending('TODO: Support Canvas testing in Node.js.');
|
||||
}
|
||||
|
||||
var baseline1, baseline2, baseline3;
|
||||
var promiseDone = renderPDF(pdf1).then(function(data1) {
|
||||
baseline1 = data1;
|
||||
|
@ -1275,12 +1292,9 @@ describe('api', function() {
|
|||
});
|
||||
});
|
||||
describe('PDFDataRangeTransport', function () {
|
||||
if (isNodeJS()) {
|
||||
pending('XMLHttpRequest is not supported in Node.js.');
|
||||
}
|
||||
var pdfPath = new URL('../pdfs/tracemonkey.pdf', window.location).href;
|
||||
var loadPromise;
|
||||
function getDocumentData() {
|
||||
const pdfPath = new URL('../pdfs/tracemonkey.pdf', window.location).href;
|
||||
if (loadPromise) {
|
||||
return loadPromise;
|
||||
}
|
||||
|
@ -1299,6 +1313,10 @@ describe('api', function() {
|
|||
return loadPromise;
|
||||
}
|
||||
it('should fetch document info and page using ranges', function (done) {
|
||||
if (isNodeJS()) {
|
||||
pending('XMLHttpRequest is not supported in Node.js.');
|
||||
}
|
||||
|
||||
var transport;
|
||||
var initialDataLength = 4000;
|
||||
var fetches = 0;
|
||||
|
@ -1333,6 +1351,10 @@ describe('api', function() {
|
|||
});
|
||||
it('should fetch document info and page using range and streaming',
|
||||
function (done) {
|
||||
if (isNodeJS()) {
|
||||
pending('XMLHttpRequest is not supported in Node.js.');
|
||||
}
|
||||
|
||||
var transport;
|
||||
var initialDataLength = 4000;
|
||||
var fetches = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue