diff --git a/test/driver.js b/test/driver.js index 464eb2aa3..d492f5697 100644 --- a/test/driver.js +++ b/test/driver.js @@ -87,15 +87,17 @@ function cleanup() { // Clear out all the stylesheets since a new one is created for each font. while (document.styleSheets.length > 0) { var styleSheet = document.styleSheets[0]; - while (styleSheet.cssRules.length > 0) + while (styleSheet.cssRules.length > 0) { styleSheet.deleteRule(0); + } var ownerNode = styleSheet.ownerNode; ownerNode.parentNode.removeChild(ownerNode); } var guard = document.getElementById('content-end'); var body = document.body; - while (body.lastChild !== guard) + while (body.lastChild !== guard) { body.removeChild(body.lastChild); + } // Wipe out the link to the pdfdoc so it can be GC'ed. for (var i = 0; i < manifest.length; i++) { @@ -107,10 +109,12 @@ function cleanup() { } function exceptionToString(e) { - if (typeof e !== 'object') + if (typeof e !== 'object') { return String(e); - if (!('message' in e)) + } + if (!('message' in e)) { return JSON.stringify(e); + } return e.message + ('stack' in e ? ' at ' + e.stack.split('\n')[0] : ''); } @@ -198,8 +202,8 @@ SimpleTextLayerBuilder.prototype = { var ctx = this.ctx, viewport = this.viewport; // vScale and hScale already contain the scaling to pixel units var fontHeight = geom.fontSize * Math.abs(geom.vScale); - var fontAscent = geom.ascent ? geom.ascent * fontHeight : - geom.descent ? (1 + geom.descent) * fontHeight : fontHeight; + var fontAscent = (geom.ascent ? geom.ascent * fontHeight : + (geom.descent ? (1 + geom.descent) * fontHeight : fontHeight)); ctx.save(); ctx.beginPath(); ctx.strokeStyle = 'red'; @@ -429,13 +433,15 @@ function checkScrolling() { } function log(str) { - if (stdout.insertAdjacentHTML) + if (stdout.insertAdjacentHTML) { stdout.insertAdjacentHTML('BeforeEnd', str); - else + } else { stdout.innerHTML += str; + } - if (str.lastIndexOf('\n') >= 0) + if (str.lastIndexOf('\n') >= 0) { checkScrolling(); + } } })(); // DriverClosure diff --git a/test/unit/crypto_spec.js b/test/unit/crypto_spec.js index 5e5e0131e..e17f2b11e 100644 --- a/test/unit/crypto_spec.js +++ b/test/unit/crypto_spec.js @@ -9,8 +9,9 @@ describe('crypto', function() { function string2binary(s) { var n = s.length, i; var result = new Uint8Array(n); - for (i = 0; i < n; ++i) + for (i = 0; i < n; ++i) { result[i] = s.charCodeAt(i) % 0xFF; + } return result; } @@ -226,19 +227,19 @@ describe('CipherTransformFactory', function() { describe('#ctor', function() { it('should accept user password', function() { var factory = new CipherTransformFactory(new DictMock(map1), fileID1, - '123456'); + '123456'); }); it('should accept owner password', function() { var factory = new CipherTransformFactory(new DictMock(map1), fileID1, - '654321'); + '654321'); }); it('should not accept wrong password', function() { var thrown = false; try { var factory = new CipherTransformFactory(new DictMock(map1), fileID1, - 'wrong'); + 'wrong'); } catch (e) { thrown = true; } diff --git a/test/unit/font_spec.js b/test/unit/font_spec.js index aa50cc532..15d1ce1bf 100644 --- a/test/unit/font_spec.js +++ b/test/unit/font_spec.js @@ -10,8 +10,9 @@ describe('font', function() { var line = ''; for (var i = 0, ii = bytes.length; i < ii; ++i) { var b = bytes[i].toString(16); - if (b.length < 2) + if (b.length < 2) { b = '0' + b; + } line += b.toString(16); } return line; @@ -34,12 +35,17 @@ describe('font', function() { fontData.push(parseInt(hex, 16)); } var bytes = new Uint8Array(fontData); - fontData = {getBytes: function() { return bytes; }}; + fontData = { + getBytes: function() { + return bytes; + } + }; function bytesToString(bytesArray) { var str = ''; - for (var i = 0, ii = bytesArray.length; i < ii; i++) + for (var i = 0, ii = bytesArray.length; i < ii; i++) { str += String.fromCharCode(bytesArray[i]); + } return str; } @@ -70,8 +76,9 @@ describe('font', function() { index = new CFFIndex(); var longName = []; - for (var i = 0; i < 129; i++) + for (var i = 0; i < 129; i++) { longName.push(0); + } index.add(longName); names = parser.parseNameIndex(index); expect(names[0].length).toEqual(127); diff --git a/test/unit/function_spec.js b/test/unit/function_spec.js index fd61b1a23..10d0a38c1 100644 --- a/test/unit/function_spec.js +++ b/test/unit/function_spec.js @@ -10,21 +10,25 @@ describe('function', function() { this.addMatchers({ toMatchArray: function(expected) { var actual = this.actual; - if (actual.length != expected.length) + if (actual.length != expected.length) { return false; + } for (var i = 0; i < expected.length; i++) { var a = actual[i], b = expected[i]; if (isArray(b)) { - if (a.length != b.length) + if (a.length != b.length) { return false; + } for (var j = 0; j < a.length; j++) { var suba = a[j], subb = b[j]; - if (suba !== subb) + if (suba !== subb) { return false; + } } } else { - if (a !== b) + if (a !== b) { return false; + } } } return true; diff --git a/test/unit/parser_spec.js b/test/unit/parser_spec.js index 03d700a40..fdab17a0d 100644 --- a/test/unit/parser_spec.js +++ b/test/unit/parser_spec.js @@ -17,7 +17,7 @@ describe('parser', function() { it('should parse PostScript numbers', function() { var numbers = ['-.002', '34.5', '-3.62', '123.6e10', '1E-5', '-1.', '0.0', '123', '-98', '43445', '0', '+17']; - for (var i=0, ii=numbers.length; i