Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent spacing and trailing commas in objects in test/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on #8477

Merged
merged 1 commit into from
Jun 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/chromium/test-telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function createExtensionGlobal() {
window.chrome.runtime = {};
window.chrome.runtime.id = 'oemmndcbldboiebfnladdacbdfmadadm';
window.chrome.runtime.getManifest = function() {
return {version: '1.0.0'};
return { version: '1.0.0', };
};

function createStorageAPI() {
Expand Down Expand Up @@ -324,7 +324,7 @@ var tests = [
var window = createExtensionGlobal();
telemetryScript.runInNewContext(window);
window.chrome.runtime.getManifest = function() {
return {version: '1.0.1'};
return { version: '1.0.1', };
};
window.Date.test_now_value += 12 * 36E5;
telemetryScript.runInNewContext(window);
Expand Down
2 changes: 1 addition & 1 deletion test/downloadutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function downloadManifestFiles(manifest, callback) {
var linkfile = file + '.link';
var url = fs.readFileSync(linkfile).toString();
url = url.replace(/\s+$/, '');
return {file: file, url: url};
return { file: file, url: url, };
});

var i = 0;
Expand Down
14 changes: 7 additions & 7 deletions test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
stylePromise.then(function (styles) {
style.textContent = styles;

var annotation_viewport = viewport.clone({ dontFlip: true });
var annotation_viewport = viewport.clone({ dontFlip: true, });
var parameters = {
viewport: annotation_viewport,
div,
Expand Down Expand Up @@ -347,7 +347,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
let task = this.manifest[this.currentTask];
task.round = 0;
task.pageNum = task.firstPage || 1;
task.stats = { times: [] };
task.stats = { times: [], };

this._log('Loading file "' + task.file + '"\n');

Expand Down Expand Up @@ -460,7 +460,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
this._log(' Loading page ' + task.pageNum + '/' +
task.pdfDoc.numPages + '... ');
this.canvas.mozOpaque = true;
ctx = this.canvas.getContext('2d', {alpha: false});
ctx = this.canvas.getContext('2d', { alpha: false, });
task.pdfDoc.getPage(task.pageNum).then(function(page) {
var viewport = page.getViewport(PDF_TO_CSS_UNITS);
self.canvas.width = viewport.width;
Expand Down Expand Up @@ -516,7 +516,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars

// The annotation builder will draw its content on the canvas.
initPromise =
page.getAnnotations({ intent: 'display' }).then(
page.getAnnotations({ intent: 'display', }).then(
function(annotations) {
return rasterizeAnnotationLayer(annotationLayerContext,
viewport, annotations,
Expand Down Expand Up @@ -572,7 +572,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
},

_clearCanvas: function Driver_clearCanvas() {
var ctx = this.canvas.getContext('2d', {alpha: false});
var ctx = this.canvas.getContext('2d', { alpha: false, });
ctx.beginPath();
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
},
Expand Down Expand Up @@ -649,7 +649,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
round: task.round,
page: task.pageNum,
snapshot,
stats: task.stats.times
stats: task.stats.times,
});
this._send('/submit_task_results', result, callback);
},
Expand All @@ -676,7 +676,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
};
this.inflight.textContent = this.inFlightRequests++;
r.send(message);
}
},
};

return Driver;
Expand Down
6 changes: 3 additions & 3 deletions test/font/jasmine-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function initializePDFJS(callback) {
var queryString = new jasmine.QueryString({
getWindowLocation() {
return window.location;
}
},
});

var catchingExceptions = queryString.getParam('catch');
Expand Down Expand Up @@ -116,7 +116,7 @@ function initializePDFJS(callback) {
createTextNode() {
return document.createTextNode.apply(document, arguments);
},
timer: new jasmine.Timer()
timer: new jasmine.Timer(),
});

env.addReporter(htmlReporter);
Expand All @@ -132,7 +132,7 @@ function initializePDFJS(callback) {
var specFilter = new jasmine.HtmlSpecFilter({
filterString() {
return queryString.getParam('spec');
}
},
});

env.specFilter = function(spec) {
Expand Down
4 changes: 2 additions & 2 deletions test/font/ttxdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ function runTtx(ttxResourcesHome, fontPath, registerOnCancel, callback) {
}
var ttxEnv = {
'PYTHONPATH': path.join(fontToolsHome, 'Lib'),
'PYTHONDONTWRITEBYTECODE': true
'PYTHONDONTWRITEBYTECODE': true,
};
var ttxStdioMode = 'ignore';
var ttx = spawn('python', [ttxPath, fontPath],
{cwd: fontToolsHome, stdio: ttxStdioMode, env: ttxEnv});
{ cwd: fontToolsHome, stdio: ttxStdioMode, env: ttxEnv, });
var ttxRunError;
registerOnCancel(function (reason) {
ttxRunError = reason;
Expand Down
2 changes: 1 addition & 1 deletion test/stats/statcmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function flatten(stats) {
pdf: stat['pdf'],
round: stat['round'],
stat: s['name'],
time: s['end'] - s['start']
time: s['end'] - s['start'],
});
});
});
Expand Down
14 changes: 7 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function refTestPostHandler(req, res) {
body += data;
});
req.on('end', function () {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.writeHead(200, { 'Content-Type': 'text/plain', });
res.end();

var session;
Expand Down Expand Up @@ -517,15 +517,15 @@ function refTestPostHandler(req, res) {

taskResults[round][page] = {
failure: failure,
snapshot: snapshot
snapshot: snapshot,
};
if (stats) {
stats.push({
'browser': browser,
'pdf': id,
'page': page,
'round': round,
'stats': data.stats
'stats': data.stats,
});
}

Expand Down Expand Up @@ -594,13 +594,13 @@ function unitTestPostHandler(req, res) {
onCancel = fn;
}, function (err, xml) {
clearTimeout(timeoutId);
res.writeHead(200, {'Content-Type': 'text/xml'});
res.writeHead(200, { 'Content-Type': 'text/xml', });
res.end(err ? '<error>' + err + '</error>' : xml);
});
return;
}

res.writeHead(200, {'Content-Type': 'text/plain'});
res.writeHead(200, { 'Content-Type': 'text/plain', });
res.end();

var data = JSON.parse(body);
Expand Down Expand Up @@ -633,7 +633,7 @@ function startBrowsers(url, initSessionCallback) {
} else if (options.browser) {
var browserPath = options.browser;
var name = path.basename(browserPath, path.extname(browserPath));
browsers = [{name: name, path: browserPath}];
browsers = [{ name: name, path: browserPath, }];
} else {
console.error('Specify either browser or browserManifestFile.');
process.exit(1);
Expand All @@ -653,7 +653,7 @@ function startBrowsers(url, initSessionCallback) {
name: b.name,
config: b,
browser: browser,
closed: false
closed: false,
};
if (initSessionCallback) {
initSessionCallback(session);
Expand Down
14 changes: 7 additions & 7 deletions test/unit/annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ describe('annotation', function() {

expect(data.url).toBeUndefined();
expect(data.unsafeUrl).toBeUndefined();
expect(data.dest).toEqual([{ num: 17, gen: 0, }, { name: 'XYZ' },
expect(data.dest).toEqual([{ num: 17, gen: 0, }, { name: 'XYZ', },
0, 841.89, null]);
});
});
Expand Down Expand Up @@ -1085,11 +1085,11 @@ describe('annotation', function() {
var expected = [
{
exportValue: 'foo_export',
displayValue: 'Foo'
displayValue: 'Foo',
},
{
exportValue: 'bar_export',
displayValue: 'Bar'
displayValue: 'Bar',
}
];

Expand Down Expand Up @@ -1118,11 +1118,11 @@ describe('annotation', function() {
var expected = [
{
exportValue: 'Foo',
displayValue: 'Foo'
displayValue: 'Foo',
},
{
exportValue: 'Bar',
displayValue: 'Bar'
displayValue: 'Bar',
}
];

Expand All @@ -1148,8 +1148,8 @@ describe('annotation', function() {
['Value2', 'Description2'],
];
var expected = [
{ exportValue: 'Value1', displayValue: 'Description1' },
{ exportValue: 'Value2', displayValue: 'Description2' },
{ exportValue: 'Value1', displayValue: 'Description1', },
{ exportValue: 'Value2', displayValue: 'Description2', },
];

var parentDict = new Dict();
Expand Down
29 changes: 15 additions & 14 deletions test/unit/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ describe('api', function() {
});
it('gets page index', function(done) {
// reference to second page
var ref = {num: 17, gen: 0};
var ref = { num: 17, gen: 0, };
var promise = doc.getPageIndex(ref);
promise.then(function(pageIndex) {
expect(pageIndex).toEqual(1);
Expand All @@ -490,7 +490,7 @@ describe('api', function() {
});
});
it('gets invalid page index', function (done) {
var ref = { num: 3, gen: 0 }; // Reference to a font dictionary.
var ref = { num: 3, gen: 0, }; // Reference to a font dictionary.
var promise = doc.getPageIndex(ref);
promise.then(function () {
done.fail('shall fail for invalid page reference.');
Expand All @@ -503,8 +503,9 @@ describe('api', function() {
it('gets destinations, from /Dests dictionary', function(done) {
var promise = doc.getDestinations();
promise.then(function(data) {
expect(data).toEqual({ chapter1: [{ gen: 0, num: 17 }, { name: 'XYZ' },
0, 841.89, null] });
expect(data).toEqual({
chapter1: [{ gen: 0, num: 17, }, { name: 'XYZ', }, 0, 841.89, null],
});
done();
}).catch(function (reason) {
done.fail(reason);
Expand All @@ -513,7 +514,7 @@ describe('api', function() {
it('gets a destination, from /Dests dictionary', function(done) {
var promise = doc.getDestination('chapter1');
promise.then(function(data) {
expect(data).toEqual([{ gen: 0, num: 17 }, { name: 'XYZ' },
expect(data).toEqual([{ gen: 0, num: 17, }, { name: 'XYZ', },
0, 841.89, null]);
done();
}).catch(function (reason) {
Expand All @@ -538,8 +539,8 @@ describe('api', function() {
});
promise.then(function (destinations) {
expect(destinations).toEqual({
'Page.1': [{ num: 1, gen: 0}, { name: 'XYZ' }, 0, 375, null],
'Page.2': [{ num: 6, gen: 0}, { name: 'XYZ' }, 0, 375, null],
'Page.1': [{ num: 1, gen: 0, }, { name: 'XYZ', }, 0, 375, null],
'Page.2': [{ num: 6, gen: 0, }, { name: 'XYZ', }, 0, 375, null],
});

loadingTask.destroy().then(done);
Expand All @@ -553,7 +554,7 @@ describe('api', function() {
return pdfDocument.getDestination('Page.1');
});
promise.then(function (destination) {
expect(destination).toEqual([{ num: 1, gen: 0}, { name: 'XYZ' },
expect(destination).toEqual([{ num: 1, gen: 0, }, { name: 'XYZ', },
0, 375, null]);

loadingTask.destroy().then(done);
Expand Down Expand Up @@ -793,7 +794,7 @@ describe('api', function() {
it('gets download info', function(done) {
var promise = doc.getDownloadInfo();
promise.then(function (data) {
expect(data).toEqual({ length: basicApiFileLength });
expect(data).toEqual({ length: basicApiFileLength, });
done();
}).catch(function (reason) {
done.fail(reason);
Expand All @@ -802,7 +803,7 @@ describe('api', function() {
it('gets stats', function(done) {
var promise = doc.getStats();
promise.then(function (stats) {
expect(stats).toEqual({ streamTypes: [], fontTypes: [] });
expect(stats).toEqual({ streamTypes: [], fontTypes: [], });
done();
}).catch(function (reason) {
done.fail(reason);
Expand Down Expand Up @@ -864,7 +865,7 @@ describe('api', function() {
expect(page.rotate).toEqual(0);
});
it('gets ref', function () {
expect(page.ref).toEqual({ num: 15, gen: 0 });
expect(page.ref).toEqual({ num: 15, gen: 0, });
});
it('gets userUnit', function () {
expect(page.userUnit).toEqual(1.0);
Expand All @@ -886,12 +887,12 @@ describe('api', function() {
expect(data.length).toEqual(4);
});

var displayPromise = page.getAnnotations({ intent: 'display' }).then(
var displayPromise = page.getAnnotations({ intent: 'display', }).then(
function (data) {
expect(data.length).toEqual(4);
});

var printPromise = page.getAnnotations({ intent: 'print' }).then(
var printPromise = page.getAnnotations({ intent: 'print', }).then(
function (data) {
expect(data.length).toEqual(4);
});
Expand Down Expand Up @@ -1011,7 +1012,7 @@ describe('api', function() {

promise.then(function (stats) {
expect(stats).toEqual({ streamTypes: expectedStreamTypes,
fontTypes: expectedFontTypes });
fontTypes: expectedFontTypes, });
done();
}).catch(function (reason) {
done.fail(reason);
Expand Down
4 changes: 2 additions & 2 deletions test/unit/cff_parser_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ describe('CFFParser', function() {
]);
parser.bytes = bytes;
var encoding = parser.parseEncoding(2, {}, new CFFStrings(), null);
expect(encoding.encoding).toEqual(createWithNullProto({0x8: 1}));
expect(encoding.encoding).toEqual(createWithNullProto({ 0x8: 1, }));
});

it('parses encoding format 1', function() {
Expand All @@ -297,7 +297,7 @@ describe('CFFParser', function() {
parser.bytes = bytes;
var encoding = parser.parseEncoding(2, {}, new CFFStrings(), null);
expect(encoding.encoding).toEqual(
createWithNullProto({0x7: 0x01, 0x08: 0x02}));
createWithNullProto({ 0x7: 0x01, 0x08: 0x02, }));
});

it('parses fdselect format 0', function() {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/custom_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('custom canvas rendering', function() {
canvasContext: canvasAndCtx.context,
viewport,
}).then(function() {
var { r, g, b, a } = getTopLeftPixel(canvasAndCtx.context);
var { r, g, b, a, } = getTopLeftPixel(canvasAndCtx.context);
CanvasFactory.destroy(canvasAndCtx);
expect(r).toEqual(255);
expect(g).toEqual(255);
Expand All @@ -94,9 +94,9 @@ describe('custom canvas rendering', function() {
page.render({
canvasContext: canvasAndCtx.context,
viewport,
background: 'rgba(255,0,0,1.0)'
background: 'rgba(255,0,0,1.0)',
}).then(function() {
var { r, g, b, a } = getTopLeftPixel(canvasAndCtx.context);
var { r, g, b, a, } = getTopLeftPixel(canvasAndCtx.context);
CanvasFactory.destroy(canvasAndCtx);
expect(r).toEqual(255);
expect(g).toEqual(0);
Expand Down
Loading