Enable the object-shorthand
ESLint rule
Please see http://eslint.org/docs/rules/object-shorthand.
Unfortunately, based on commit 9276d1dcd9
, it seems that we still need to maintain compatibility with old Node.js versions, hence certain files/directories that are executed in Node.js are currently exempt from this rule.
Furthermore, since the files specific to the Chromium extension are not run through Babel, the `/extensions/chromium/` directory is also exempt from this rule.
This commit is contained in:
parent
00d67371ec
commit
7560f12a17
@ -154,7 +154,7 @@
|
|||||||
"no-useless-computed-key": "error",
|
"no-useless-computed-key": "error",
|
||||||
"no-useless-constructor": "error",
|
"no-useless-constructor": "error",
|
||||||
"no-useless-rename": "error",
|
"no-useless-rename": "error",
|
||||||
"object-shorthand": ["off", "always", {
|
"object-shorthand": ["error", "always", {
|
||||||
"avoidQuotes": true,
|
"avoidQuotes": true,
|
||||||
}],
|
}],
|
||||||
"rest-spread-spacing": ["error", "never"],
|
"rest-spread-spacing": ["error", "never"],
|
||||||
|
@ -6,4 +6,8 @@
|
|||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"sourceType": "script"
|
"sourceType": "script"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"object-shorthand": "off",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
4
external/.eslintrc
vendored
4
external/.eslintrc
vendored
@ -7,4 +7,8 @@
|
|||||||
"node": true,
|
"node": true,
|
||||||
"shelljs": true,
|
"shelljs": true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"object-shorthand": "off",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
|
/* eslint-disable object-shorthand */
|
||||||
/* globals target */
|
/* globals target */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable object-shorthand */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable object-shorthand */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -32,23 +32,23 @@ var LinkServiceMock = (function LinkServiceMockClosure() {
|
|||||||
|
|
||||||
set page(value) {},
|
set page(value) {},
|
||||||
|
|
||||||
navigateTo: function (dest) {},
|
navigateTo(dest) {},
|
||||||
|
|
||||||
getDestinationHash: function (dest) {
|
getDestinationHash(dest) {
|
||||||
return '#';
|
return '#';
|
||||||
},
|
},
|
||||||
|
|
||||||
getAnchorUrl: function (hash) {
|
getAnchorUrl(hash) {
|
||||||
return '#';
|
return '#';
|
||||||
},
|
},
|
||||||
|
|
||||||
setHash: function (hash) {},
|
setHash(hash) {},
|
||||||
|
|
||||||
executeNamedAction: function (action) {},
|
executeNamedAction(action) {},
|
||||||
|
|
||||||
onFileAttachmentAnnotation: function (params) {},
|
onFileAttachmentAnnotation(params) {},
|
||||||
|
|
||||||
cachePageRef: function (pageNum, pageRef) {},
|
cachePageRef(pageNum, pageRef) {},
|
||||||
};
|
};
|
||||||
|
|
||||||
return LinkServiceMock;
|
return LinkServiceMock;
|
||||||
@ -101,10 +101,10 @@ var rasterizeTextLayer = (function rasterizeTextLayerClosure() {
|
|||||||
|
|
||||||
// Rendering text layer as HTML.
|
// Rendering text layer as HTML.
|
||||||
var task = PDFJS.renderTextLayer({
|
var task = PDFJS.renderTextLayer({
|
||||||
textContent: textContent,
|
textContent,
|
||||||
container: div,
|
container: div,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
enhanceTextSelection: enhanceTextSelection,
|
enhanceTextSelection,
|
||||||
});
|
});
|
||||||
Promise.all([stylePromise, task.promise]).then(function (results) {
|
Promise.all([stylePromise, task.promise]).then(function (results) {
|
||||||
task.expandTextDivs(true);
|
task.expandTextDivs(true);
|
||||||
@ -200,11 +200,11 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
|
|||||||
var annotation_viewport = viewport.clone({ dontFlip: true });
|
var annotation_viewport = viewport.clone({ dontFlip: true });
|
||||||
var parameters = {
|
var parameters = {
|
||||||
viewport: annotation_viewport,
|
viewport: annotation_viewport,
|
||||||
div: div,
|
div,
|
||||||
annotations: annotations,
|
annotations,
|
||||||
page: page,
|
page,
|
||||||
linkService: new LinkServiceMock(),
|
linkService: new LinkServiceMock(),
|
||||||
renderInteractiveForms: renderInteractiveForms,
|
renderInteractiveForms,
|
||||||
};
|
};
|
||||||
PDFJS.AnnotationLayer.render(parameters);
|
PDFJS.AnnotationLayer.render(parameters);
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
|
|||||||
|
|
||||||
var renderContext = {
|
var renderContext = {
|
||||||
canvasContext: ctx,
|
canvasContext: ctx,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
renderInteractiveForms: renderForms,
|
renderInteractiveForms: renderForms,
|
||||||
};
|
};
|
||||||
var completeRender = (function(error) {
|
var completeRender = (function(error) {
|
||||||
@ -605,7 +605,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
|
|||||||
_info: function Driver_info(message) {
|
_info: function Driver_info(message) {
|
||||||
this._send('/info', JSON.stringify({
|
this._send('/info', JSON.stringify({
|
||||||
browser: this.browser,
|
browser: this.browser,
|
||||||
message: message
|
message,
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -641,11 +641,11 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
|
|||||||
numPages: task.pdfDoc ?
|
numPages: task.pdfDoc ?
|
||||||
(task.lastPage || task.pdfDoc.numPages) : 0,
|
(task.lastPage || task.pdfDoc.numPages) : 0,
|
||||||
lastPageNum: this._getLastPageNumber(task),
|
lastPageNum: this._getLastPageNumber(task),
|
||||||
failure: failure,
|
failure,
|
||||||
file: task.file,
|
file: task.file,
|
||||||
round: task.round,
|
round: task.round,
|
||||||
page: task.pageNum,
|
page: task.pageNum,
|
||||||
snapshot: snapshot,
|
snapshot,
|
||||||
stats: task.stats.times
|
stats: task.stats.times
|
||||||
});
|
});
|
||||||
this._send('/submit_task_results', result, callback);
|
this._send('/submit_task_results', result, callback);
|
||||||
|
@ -71,7 +71,7 @@ function initializePDFJS(callback) {
|
|||||||
|
|
||||||
// Runner Parameters
|
// Runner Parameters
|
||||||
var queryString = new jasmine.QueryString({
|
var queryString = new jasmine.QueryString({
|
||||||
getWindowLocation: function() {
|
getWindowLocation() {
|
||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -93,27 +93,27 @@ function initializePDFJS(callback) {
|
|||||||
|
|
||||||
// Reporters
|
// Reporters
|
||||||
var htmlReporter = new jasmine.HtmlReporter({
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
env: env,
|
env,
|
||||||
onRaiseExceptionsClick: function() {
|
onRaiseExceptionsClick() {
|
||||||
queryString.navigateWithNewParam('catch', !env.catchingExceptions());
|
queryString.navigateWithNewParam('catch', !env.catchingExceptions());
|
||||||
},
|
},
|
||||||
onThrowExpectationsClick: function() {
|
onThrowExpectationsClick() {
|
||||||
queryString.navigateWithNewParam('throwFailures',
|
queryString.navigateWithNewParam('throwFailures',
|
||||||
!env.throwingExpectationFailures());
|
!env.throwingExpectationFailures());
|
||||||
},
|
},
|
||||||
onRandomClick: function() {
|
onRandomClick() {
|
||||||
queryString.navigateWithNewParam('random', !env.randomTests());
|
queryString.navigateWithNewParam('random', !env.randomTests());
|
||||||
},
|
},
|
||||||
addToExistingQueryString: function(key, value) {
|
addToExistingQueryString(key, value) {
|
||||||
return queryString.fullStringWithNewParam(key, value);
|
return queryString.fullStringWithNewParam(key, value);
|
||||||
},
|
},
|
||||||
getContainer: function() {
|
getContainer() {
|
||||||
return document.body;
|
return document.body;
|
||||||
},
|
},
|
||||||
createElement: function() {
|
createElement() {
|
||||||
return document.createElement.apply(document, arguments);
|
return document.createElement.apply(document, arguments);
|
||||||
},
|
},
|
||||||
createTextNode: function() {
|
createTextNode() {
|
||||||
return document.createTextNode.apply(document, arguments);
|
return document.createTextNode.apply(document, arguments);
|
||||||
},
|
},
|
||||||
timer: new jasmine.Timer()
|
timer: new jasmine.Timer()
|
||||||
@ -130,7 +130,7 @@ function initializePDFJS(callback) {
|
|||||||
// Filter which specs will be run by matching the start of the full name
|
// Filter which specs will be run by matching the start of the full name
|
||||||
// against the `spec` query param.
|
// against the `spec` query param.
|
||||||
var specFilter = new jasmine.HtmlSpecFilter({
|
var specFilter = new jasmine.HtmlSpecFilter({
|
||||||
filterString: function() {
|
filterString() {
|
||||||
return queryString.getParam('spec');
|
return queryString.getParam('spec');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable object-shorthand */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ describe('annotation', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
XRefMock.prototype = {
|
XRefMock.prototype = {
|
||||||
fetch: function (ref) {
|
fetch(ref) {
|
||||||
return this.map[ref.toString()];
|
return this.map[ref.toString()];
|
||||||
},
|
},
|
||||||
fetchIfRef: function (obj) {
|
fetchIfRef(obj) {
|
||||||
if (!isRef(obj)) {
|
if (!isRef(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ describe('annotation', function() {
|
|||||||
obj: params.startObjId || 0,
|
obj: params.startObjId || 0,
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
createObjId: function () {
|
createObjId() {
|
||||||
return uniquePrefix + (++idCounters.obj);
|
return uniquePrefix + (++idCounters.obj);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -153,7 +153,7 @@ describe('annotation', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set and get flags', function() {
|
it('should set and get flags', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setFlags(13);
|
annotation.setFlags(13);
|
||||||
|
|
||||||
expect(annotation.hasFlag(AnnotationFlag.INVISIBLE)).toEqual(true);
|
expect(annotation.hasFlag(AnnotationFlag.INVISIBLE)).toEqual(true);
|
||||||
@ -163,63 +163,63 @@ describe('annotation', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should be viewable and not printable by default', function() {
|
it('should be viewable and not printable by default', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
|
|
||||||
expect(annotation.viewable).toEqual(true);
|
expect(annotation.viewable).toEqual(true);
|
||||||
expect(annotation.printable).toEqual(false);
|
expect(annotation.printable).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set and get a valid rectangle', function() {
|
it('should set and get a valid rectangle', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setRectangle([117, 694, 164.298, 720]);
|
annotation.setRectangle([117, 694, 164.298, 720]);
|
||||||
|
|
||||||
expect(annotation.rectangle).toEqual([117, 694, 164.298, 720]);
|
expect(annotation.rectangle).toEqual([117, 694, 164.298, 720]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not set and get an invalid rectangle', function() {
|
it('should not set and get an invalid rectangle', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setRectangle([117, 694, 164.298]);
|
annotation.setRectangle([117, 694, 164.298]);
|
||||||
|
|
||||||
expect(annotation.rectangle).toEqual([0, 0, 0, 0]);
|
expect(annotation.rectangle).toEqual([0, 0, 0, 0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reject a color if it is not an array', function() {
|
it('should reject a color if it is not an array', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setColor('red');
|
annotation.setColor('red');
|
||||||
|
|
||||||
expect(annotation.color).toEqual(new Uint8Array([0, 0, 0]));
|
expect(annotation.color).toEqual(new Uint8Array([0, 0, 0]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set and get a transparent color', function() {
|
it('should set and get a transparent color', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setColor([]);
|
annotation.setColor([]);
|
||||||
|
|
||||||
expect(annotation.color).toEqual(null);
|
expect(annotation.color).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set and get a grayscale color', function() {
|
it('should set and get a grayscale color', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setColor([0.4]);
|
annotation.setColor([0.4]);
|
||||||
|
|
||||||
expect(annotation.color).toEqual(new Uint8Array([102, 102, 102]));
|
expect(annotation.color).toEqual(new Uint8Array([102, 102, 102]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set and get an RGB color', function() {
|
it('should set and get an RGB color', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setColor([0, 0, 1]);
|
annotation.setColor([0, 0, 1]);
|
||||||
|
|
||||||
expect(annotation.color).toEqual(new Uint8Array([0, 0, 255]));
|
expect(annotation.color).toEqual(new Uint8Array([0, 0, 255]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set and get a CMYK color', function() {
|
it('should set and get a CMYK color', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setColor([0.1, 0.92, 0.84, 0.02]);
|
annotation.setColor([0.1, 0.92, 0.84, 0.02]);
|
||||||
|
|
||||||
expect(annotation.color).toEqual(new Uint8Array([233, 59, 47]));
|
expect(annotation.color).toEqual(new Uint8Array([233, 59, 47]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not set and get an invalid color', function() {
|
it('should not set and get an invalid color', function() {
|
||||||
var annotation = new Annotation({ dict: dict, ref: ref });
|
var annotation = new Annotation({ dict, ref, });
|
||||||
annotation.setColor([0.4, 0.6]);
|
annotation.setColor([0.4, 0.6]);
|
||||||
|
|
||||||
expect(annotation.color).toEqual(new Uint8Array([0, 0, 0]));
|
expect(annotation.color).toEqual(new Uint8Array([0, 0, 0]));
|
||||||
|
@ -216,7 +216,7 @@ describe('api', function() {
|
|||||||
var url = new URL('../pdfs/pr6531_2.pdf', window.location).href;
|
var url = new URL('../pdfs/pr6531_2.pdf', window.location).href;
|
||||||
|
|
||||||
var passwordNeededLoadingTask = PDFJS.getDocument({
|
var passwordNeededLoadingTask = PDFJS.getDocument({
|
||||||
url: url, password: '',
|
url, password: '',
|
||||||
});
|
});
|
||||||
var result1 = passwordNeededLoadingTask.promise.then(function () {
|
var result1 = passwordNeededLoadingTask.promise.then(function () {
|
||||||
done.fail('shall fail with no password');
|
done.fail('shall fail with no password');
|
||||||
@ -228,7 +228,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var passwordIncorrectLoadingTask = PDFJS.getDocument({
|
var passwordIncorrectLoadingTask = PDFJS.getDocument({
|
||||||
url: url, password: 'qwerty',
|
url, password: 'qwerty',
|
||||||
});
|
});
|
||||||
var result2 = passwordIncorrectLoadingTask.promise.then(function () {
|
var result2 = passwordIncorrectLoadingTask.promise.then(function () {
|
||||||
done.fail('shall fail with wrong password');
|
done.fail('shall fail with wrong password');
|
||||||
@ -240,7 +240,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var passwordAcceptedLoadingTask = PDFJS.getDocument({
|
var passwordAcceptedLoadingTask = PDFJS.getDocument({
|
||||||
url: url, password: 'asdfasdf',
|
url, password: 'asdfasdf',
|
||||||
});
|
});
|
||||||
|
|
||||||
var result3 = passwordAcceptedLoadingTask.promise.then(function (data) {
|
var result3 = passwordAcceptedLoadingTask.promise.then(function (data) {
|
||||||
@ -259,7 +259,7 @@ describe('api', function() {
|
|||||||
var url = new URL('../pdfs/issue3371.pdf', window.location).href;
|
var url = new URL('../pdfs/issue3371.pdf', window.location).href;
|
||||||
var passwordNeededLoadingTask = PDFJS.getDocument(url);
|
var passwordNeededLoadingTask = PDFJS.getDocument(url);
|
||||||
var passwordIncorrectLoadingTask = PDFJS.getDocument({
|
var passwordIncorrectLoadingTask = PDFJS.getDocument({
|
||||||
url: url, password: 'qwerty',
|
url, password: 'qwerty',
|
||||||
});
|
});
|
||||||
|
|
||||||
passwordNeededLoadingTask.onPassword = function (callback, reason) {
|
passwordNeededLoadingTask.onPassword = function (callback, reason) {
|
||||||
@ -342,7 +342,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
it('worker created and can be used in getDocument', function (done) {
|
it('worker created and can be used in getDocument', function (done) {
|
||||||
var worker = new PDFJS.PDFWorker('test1');
|
var worker = new PDFJS.PDFWorker('test1');
|
||||||
var loadingTask = PDFJS.getDocument({url: basicApiUrl, worker: worker});
|
var loadingTask = PDFJS.getDocument({ url: basicApiUrl, worker, });
|
||||||
loadingTask.promise.then(function () {
|
loadingTask.promise.then(function () {
|
||||||
var docWorker = loadingTask._worker;
|
var docWorker = loadingTask._worker;
|
||||||
expect(!!docWorker).toEqual(false);
|
expect(!!docWorker).toEqual(false);
|
||||||
@ -893,7 +893,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var docBaseUrlLoadingTask = PDFJS.getDocument({
|
var docBaseUrlLoadingTask = PDFJS.getDocument({
|
||||||
url: url,
|
url,
|
||||||
docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf',
|
docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf',
|
||||||
});
|
});
|
||||||
var docBaseUrlPromise = docBaseUrlLoadingTask.promise.then(
|
var docBaseUrlPromise = docBaseUrlLoadingTask.promise.then(
|
||||||
@ -904,7 +904,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var invalidDocBaseUrlLoadingTask = PDFJS.getDocument({
|
var invalidDocBaseUrlLoadingTask = PDFJS.getDocument({
|
||||||
url: url,
|
url,
|
||||||
docBaseUrl: 'qwerty.pdf',
|
docBaseUrl: 'qwerty.pdf',
|
||||||
});
|
});
|
||||||
var invalidDocBaseUrlPromise = invalidDocBaseUrlLoadingTask.promise.then(
|
var invalidDocBaseUrlPromise = invalidDocBaseUrlLoadingTask.promise.then(
|
||||||
@ -1001,7 +1001,7 @@ describe('api', function() {
|
|||||||
|
|
||||||
var renderTask = page.render({
|
var renderTask = page.render({
|
||||||
canvasContext: canvasAndCtx.context,
|
canvasContext: canvasAndCtx.context,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
});
|
});
|
||||||
renderTask.cancel();
|
renderTask.cancel();
|
||||||
|
|
||||||
@ -1041,7 +1041,7 @@ describe('api', function() {
|
|||||||
viewport.height);
|
viewport.height);
|
||||||
return page.render({
|
return page.render({
|
||||||
canvasContext: canvasAndCtx.context,
|
canvasContext: canvasAndCtx.context,
|
||||||
viewport: viewport,
|
viewport,
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
var data = canvasAndCtx.canvas.toDataURL();
|
var data = canvasAndCtx.canvas.toDataURL();
|
||||||
CanvasFactory.destroy(canvasAndCtx);
|
CanvasFactory.destroy(canvasAndCtx);
|
||||||
|
@ -46,7 +46,7 @@ describe('cmap', function() {
|
|||||||
|
|
||||||
fetchBuiltInCMap = function (name) {
|
fetchBuiltInCMap = function (name) {
|
||||||
return CMapReaderFactory.fetch({
|
return CMapReaderFactory.fetch({
|
||||||
name: name,
|
name,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
done();
|
done();
|
||||||
@ -175,7 +175,7 @@ describe('cmap', function() {
|
|||||||
var stream = new StringStream(str);
|
var stream = new StringStream(str);
|
||||||
var cmapPromise = CMapFactory.create({
|
var cmapPromise = CMapFactory.create({
|
||||||
encoding: stream,
|
encoding: stream,
|
||||||
fetchBuiltInCMap: fetchBuiltInCMap,
|
fetchBuiltInCMap,
|
||||||
useCMap: null,
|
useCMap: null,
|
||||||
});
|
});
|
||||||
cmapPromise.then(function (cmap) {
|
cmapPromise.then(function (cmap) {
|
||||||
@ -214,7 +214,7 @@ describe('cmap', function() {
|
|||||||
it('loads built in cmap', function(done) {
|
it('loads built in cmap', function(done) {
|
||||||
var cmapPromise = CMapFactory.create({
|
var cmapPromise = CMapFactory.create({
|
||||||
encoding: Name.get('Adobe-Japan1-1'),
|
encoding: Name.get('Adobe-Japan1-1'),
|
||||||
fetchBuiltInCMap: fetchBuiltInCMap,
|
fetchBuiltInCMap,
|
||||||
useCMap: null,
|
useCMap: null,
|
||||||
});
|
});
|
||||||
cmapPromise.then(function (cmap) {
|
cmapPromise.then(function (cmap) {
|
||||||
@ -231,7 +231,7 @@ describe('cmap', function() {
|
|||||||
it('loads built in identity cmap', function(done) {
|
it('loads built in identity cmap', function(done) {
|
||||||
var cmapPromise = CMapFactory.create({
|
var cmapPromise = CMapFactory.create({
|
||||||
encoding: Name.get('Identity-H'),
|
encoding: Name.get('Identity-H'),
|
||||||
fetchBuiltInCMap: fetchBuiltInCMap,
|
fetchBuiltInCMap,
|
||||||
useCMap: null,
|
useCMap: null,
|
||||||
});
|
});
|
||||||
cmapPromise.then(function (cmap) {
|
cmapPromise.then(function (cmap) {
|
||||||
@ -250,7 +250,7 @@ describe('cmap', function() {
|
|||||||
it('attempts to load a non-existent built-in CMap', function(done) {
|
it('attempts to load a non-existent built-in CMap', function(done) {
|
||||||
var cmapPromise = CMapFactory.create({
|
var cmapPromise = CMapFactory.create({
|
||||||
encoding: Name.get('null'),
|
encoding: Name.get('null'),
|
||||||
fetchBuiltInCMap: fetchBuiltInCMap,
|
fetchBuiltInCMap,
|
||||||
useCMap: null,
|
useCMap: null,
|
||||||
});
|
});
|
||||||
cmapPromise.then(function () {
|
cmapPromise.then(function () {
|
||||||
@ -268,7 +268,7 @@ describe('cmap', function() {
|
|||||||
var CMapReaderFactory = isNodeJS() ?
|
var CMapReaderFactory = isNodeJS() ?
|
||||||
new NodeCMapReaderFactory({ }) : new DOMCMapReaderFactory({ });
|
new NodeCMapReaderFactory({ }) : new DOMCMapReaderFactory({ });
|
||||||
return CMapReaderFactory.fetch({
|
return CMapReaderFactory.fetch({
|
||||||
name: name,
|
name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ describe('evaluator', function() {
|
|||||||
this.queue = queue || [];
|
this.queue = queue || [];
|
||||||
}
|
}
|
||||||
XrefMock.prototype = {
|
XrefMock.prototype = {
|
||||||
fetchIfRef: function() {
|
fetchIfRef() {
|
||||||
return this.queue.shift();
|
return this.queue.shift();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -32,13 +32,13 @@ describe('evaluator', function() {
|
|||||||
this.inputs = [];
|
this.inputs = [];
|
||||||
}
|
}
|
||||||
HandlerMock.prototype = {
|
HandlerMock.prototype = {
|
||||||
send: function(name, data) {
|
send(name, data) {
|
||||||
this.inputs.push({name: name, data: data});
|
this.inputs.push({ name, data, });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function ResourcesMock() { }
|
function ResourcesMock() { }
|
||||||
ResourcesMock.prototype = {
|
ResourcesMock.prototype = {
|
||||||
get: function(name) {
|
get(name) {
|
||||||
return this[name];
|
return this[name];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -319,7 +319,7 @@ describe('evaluator', function() {
|
|||||||
describe('operator list', function () {
|
describe('operator list', function () {
|
||||||
function MessageHandlerMock() { }
|
function MessageHandlerMock() { }
|
||||||
MessageHandlerMock.prototype = {
|
MessageHandlerMock.prototype = {
|
||||||
send: function () { },
|
send() { },
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should get correct total length after flushing', function () {
|
it('should get correct total length after flushing', function () {
|
||||||
|
@ -76,8 +76,8 @@ var checkProblematicCharRanges = function checkProblematicCharRanges() {
|
|||||||
throw new Error('Total number of chars must not exceed the PUA length.');
|
throw new Error('Total number of chars must not exceed the PUA length.');
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
numChars: numChars,
|
numChars,
|
||||||
puaLength: puaLength,
|
puaLength,
|
||||||
percentage: 100 * (numChars / puaLength),
|
percentage: 100 * (numChars / puaLength),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -23,9 +23,9 @@ import { StringStream } from '../../src/core/stream';
|
|||||||
describe('function', function() {
|
describe('function', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
jasmine.addMatchers({
|
jasmine.addMatchers({
|
||||||
toMatchArray: function(util, customEqualityTesters) {
|
toMatchArray(util, customEqualityTesters) {
|
||||||
return {
|
return {
|
||||||
compare: function (actual, expected) {
|
compare(actual, expected) {
|
||||||
var result = {};
|
var result = {};
|
||||||
if (actual.length !== expected.length) {
|
if (actual.length !== expected.length) {
|
||||||
result.pass = false;
|
result.pass = false;
|
||||||
|
@ -79,7 +79,7 @@ function initializePDFJS(callback) {
|
|||||||
|
|
||||||
// Runner Parameters
|
// Runner Parameters
|
||||||
var queryString = new jasmine.QueryString({
|
var queryString = new jasmine.QueryString({
|
||||||
getWindowLocation: function() {
|
getWindowLocation() {
|
||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -101,27 +101,27 @@ function initializePDFJS(callback) {
|
|||||||
|
|
||||||
// Reporters
|
// Reporters
|
||||||
var htmlReporter = new jasmine.HtmlReporter({
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
env: env,
|
env,
|
||||||
onRaiseExceptionsClick: function() {
|
onRaiseExceptionsClick() {
|
||||||
queryString.navigateWithNewParam('catch', !env.catchingExceptions());
|
queryString.navigateWithNewParam('catch', !env.catchingExceptions());
|
||||||
},
|
},
|
||||||
onThrowExpectationsClick: function() {
|
onThrowExpectationsClick() {
|
||||||
queryString.navigateWithNewParam('throwFailures',
|
queryString.navigateWithNewParam('throwFailures',
|
||||||
!env.throwingExpectationFailures());
|
!env.throwingExpectationFailures());
|
||||||
},
|
},
|
||||||
onRandomClick: function() {
|
onRandomClick() {
|
||||||
queryString.navigateWithNewParam('random', !env.randomTests());
|
queryString.navigateWithNewParam('random', !env.randomTests());
|
||||||
},
|
},
|
||||||
addToExistingQueryString: function(key, value) {
|
addToExistingQueryString(key, value) {
|
||||||
return queryString.fullStringWithNewParam(key, value);
|
return queryString.fullStringWithNewParam(key, value);
|
||||||
},
|
},
|
||||||
getContainer: function() {
|
getContainer() {
|
||||||
return document.body;
|
return document.body;
|
||||||
},
|
},
|
||||||
createElement: function() {
|
createElement() {
|
||||||
return document.createElement.apply(document, arguments);
|
return document.createElement.apply(document, arguments);
|
||||||
},
|
},
|
||||||
createTextNode: function() {
|
createTextNode() {
|
||||||
return document.createTextNode.apply(document, arguments);
|
return document.createTextNode.apply(document, arguments);
|
||||||
},
|
},
|
||||||
timer: new jasmine.Timer()
|
timer: new jasmine.Timer()
|
||||||
@ -138,7 +138,7 @@ function initializePDFJS(callback) {
|
|||||||
// Filter which specs will be run by matching the start of the full name
|
// Filter which specs will be run by matching the start of the full name
|
||||||
// against the `spec` query param.
|
// against the `spec` query param.
|
||||||
var specFilter = new jasmine.HtmlSpecFilter({
|
var specFilter = new jasmine.HtmlSpecFilter({
|
||||||
filterString: function() {
|
filterString() {
|
||||||
return queryString.getParam('spec');
|
return queryString.getParam('spec');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -27,19 +27,19 @@ describe('primitives', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
XRefMock.prototype = {
|
XRefMock.prototype = {
|
||||||
fetch: function (ref) {
|
fetch(ref) {
|
||||||
return this.map[ref.toString()];
|
return this.map[ref.toString()];
|
||||||
},
|
},
|
||||||
fetchIfRef: function (obj) {
|
fetchIfRef(obj) {
|
||||||
if (!isRef(obj)) {
|
if (!isRef(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
return this.fetch(obj);
|
return this.fetch(obj);
|
||||||
},
|
},
|
||||||
fetchAsync: function (ref) {
|
fetchAsync(ref) {
|
||||||
return Promise.resolve(this.fetch(ref));
|
return Promise.resolve(this.fetch(ref));
|
||||||
},
|
},
|
||||||
fetchIfRefAsync: function (obj) {
|
fetchIfRefAsync(obj) {
|
||||||
return Promise.resolve(this.fetchIfRef(obj));
|
return Promise.resolve(this.fetchIfRef(obj));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -19,9 +19,9 @@ import { Dict } from '../../src/core/primitives';
|
|||||||
describe('stream', function() {
|
describe('stream', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
jasmine.addMatchers({
|
jasmine.addMatchers({
|
||||||
toMatchTypedArray: function(util, customEqualityTesters) {
|
toMatchTypedArray(util, customEqualityTesters) {
|
||||||
return {
|
return {
|
||||||
compare: function (actual, expected) {
|
compare(actual, expected) {
|
||||||
var result = {};
|
var result = {};
|
||||||
if (actual.length !== expected.length) {
|
if (actual.length !== expected.length) {
|
||||||
result.pass = false;
|
result.pass = false;
|
||||||
|
@ -24,13 +24,13 @@ var TestReporter = function(browser, appPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendInfo(message) {
|
function sendInfo(message) {
|
||||||
send('/info', {message: message});
|
send('/info', { message, });
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendResult(status, description, error) {
|
function sendResult(status, description, error) {
|
||||||
var message = {
|
var message = {
|
||||||
status: status,
|
status,
|
||||||
description: description
|
description,
|
||||||
};
|
};
|
||||||
if (typeof error !== 'undefined') {
|
if (typeof error !== 'undefined') {
|
||||||
message['error'] = error;
|
message['error'] = error;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable object-shorthand */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable object-shorthand */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user