Skip to content

Commit

Permalink
Merge branch 'master' into features/node-section
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed Nov 3, 2024
2 parents b960a5d + 7c7b36d commit 1cec32b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/DocumentContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DocumentContext extends EventEmitter {
availableHeight: this.availableHeight,
availableWidth: this.availableWidth,
page: this.page,
bottomByPage: bottomByPage ? bottomByPage : {},
bottomByPage: bottomByPage ? bottomByPage : {},
bottomMost: {
x: this.x,
y: this.y,
Expand All @@ -43,7 +43,7 @@ class DocumentContext extends EventEmitter {
}
}

updateBottomByPage () {
updateBottomByPage() {
const lastSnapshot = this.snapshots[this.snapshots.length - 1];
const lastPage = this.page;
let previousBottom = -Number.MIN_VALUE;
Expand Down
6 changes: 3 additions & 3 deletions src/LayoutBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,12 @@ class LayoutBuilder {
* @property {number} target.prevY - Updated to the maximum `prevY` value between `break1` and `break2`.
* @property {number} target.y - Updated to the minimum `y` value between `break1` and `break2`.
*/
_resolveBreakY (break1, break2, target) {
_resolveBreakY(break1, break2, target) {
target.prevY = Math.max(break1.prevY, break2.prevY);
target.y = Math.min(break1.y, break2.y);
};

_storePageBreakData (data, startsRowSpan, pageBreaks, tableNode) {
_storePageBreakData(data, startsRowSpan, pageBreaks, tableNode) {
if (!startsRowSpan) {
let pageDesc = this._getPageBreak(pageBreaks, data.prevPage);
let pageDescBySpan = this._getPageBreakListBySpan(tableNode, data.prevPage, data.rowIndex);
Expand Down Expand Up @@ -862,7 +862,7 @@ class LayoutBuilder {
}

return {
pageBreaksBySpan : pageBreaksByRowSpan,
pageBreaksBySpan: pageBreaksByRowSpan,
pageBreaks: pageBreaks,
positions: positions
};
Expand Down
4 changes: 2 additions & 2 deletions src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Renderer {
let renderedItems = 0;

for (let i = 0; i < pages.length; i++) {
this.pdfDocument.addPage({size: [pages[i].pageSize.width, pages[i].pageSize.height]});
this.pdfDocument.addPage({ size: [pages[i].pageSize.width, pages[i].pageSize.height] });

let page = pages[i];
for (let ii = 0, il = page.items.length; ii < il; ii++) {
Expand Down Expand Up @@ -349,7 +349,7 @@ class Renderer {
this.pdfDocument.link(svg.x, svg.y, svg._width, svg._height, svg.link);
}
if (svg.linkToPage) {
this.pdfDocument.ref({Type: 'Action', S: 'GoTo', D: [svg.linkToPage, 0, 0]}).end();
this.pdfDocument.ref({ Type: 'Action', S: 'GoTo', D: [svg.linkToPage, 0, 0] }).end();
this.pdfDocument.annotate(svg.x, svg.y, svg._width, svg._height, { Subtype: 'Link', Dest: [svg.linkToPage - 1, 'XYZ', null, null, null] });
}
if (svg.linkToDestination) {
Expand Down
1 change: 0 additions & 1 deletion standard-fonts/Helvetica.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ module.exports = {
bolditalics: 'Helvetica-BoldOblique'
}
};

2 changes: 1 addition & 1 deletion tests/unit/DocMeasure.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('DocMeasure', function () {
});

it('should not increase listMarker when list item is a nested list', function () {
var node = { ol: ['parent item 1', { ol: ['nested item 1', 'nested item 2']}, 'parent item 2'] };
var node = { ol: ['parent item 1', { ol: ['nested item 1', 'nested item 2'] }, 'parent item 2'] };
docPreprocessor.preprocessList(node);
var result = docMeasure.measureOrderedList(node);

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Printer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Printer', function () {
});


it('should not switch width and height for pdfkit if page orientation changes from landscape to landscape',async function () {
it('should not switch width and height for pdfkit if page orientation changes from landscape to landscape', async function () {
printer = new Printer(fontDescriptors);
var docDefinition = {
pageOrientation: 'portrait',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/StyleContextStack.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('StyleContextStack', function () {
it('should not push any style if no style nor style-property is defined', function () {
assert.equal(fullStack.autopush({ anotherProperty: 'test' }), 1);
assert.equal(fullStack.styleOverrides.length, 1);
styleProperties.forEach(function(key) {
styleProperties.forEach(function (key) {
assert.equal(fullStack.styleOverrides[0][key], undefined);
});
});
Expand Down
18 changes: 9 additions & 9 deletions tests/unit/TableProcessor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 2;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.headerRows, 0);
assert.equal(tableProcessor.rowsWithoutPageBreak, 0);
Expand All @@ -252,7 +252,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 2;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.headerRows, 0);
assert.equal(tableProcessor.rowsWithoutPageBreak, 0);
Expand All @@ -264,7 +264,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 2;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.headerRows, 0);
assert.equal(tableProcessor.rowsWithoutPageBreak, 0);
Expand All @@ -275,7 +275,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 2;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.headerRows, 0);
assert.equal(tableProcessor.rowsWithoutPageBreak, 0);
Expand All @@ -286,7 +286,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 1.5;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.headerRows, 1);
assert.equal(tableProcessor.rowsWithoutPageBreak, 1);
Expand All @@ -297,7 +297,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = '1.5';

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.headerRows, 2);
assert.equal(tableProcessor.rowsWithoutPageBreak, 2);
Expand All @@ -308,7 +308,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 2;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.rowsWithoutPageBreak, 3);
assert.equal(tableProcessor.headerRows, 1);
Expand All @@ -319,7 +319,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 0;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
tableProcessor.beginTable(fakeWriter);
assert.equal(tableProcessor.rowsWithoutPageBreak, 1);
assert.equal(tableProcessor.headerRows, 1);
Expand All @@ -330,7 +330,7 @@ describe('TableProcessor', function () {
inputTable.table.keepWithHeaderRows = 0;

var tableProcessor = new TableProcessor(inputTable);
tableProcessor.drawHorizontalLine = function() { };
tableProcessor.drawHorizontalLine = function () { };
assert.throws(() => tableProcessor.beginTable(fakeWriter), /Too few rows in the table/);
});
});
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/columnCalculator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ describe('ColumnCalculator', function () {
];
const tableNode = {
table: {
widths: ['50%', '25%', '25%'],
body: [['50%', '25%', '25%']]
widths: ['50%', '25%', '25%'],
body: [['50%', '25%', '25%']]
},
_layout: {
vLineWidth: function (i) {
Expand All @@ -169,10 +169,10 @@ describe('ColumnCalculator', function () {
return 4;
}
},
paddingLeft: function(i) {
paddingLeft: function (i) {
return i === 0 ? 5 : 3;
},
paddingRight: function() {
paddingRight: function () {
return 7;
}
}
Expand Down

0 comments on commit 1cec32b

Please sign in to comment.