Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Sep 4, 2023
1 parent 0b08ac4 commit cac0b48
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/flat_layout/flat_multipletext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export class FlatMultipleText extends FlatQuestion {
super(survey, question, controller);
this.question = <QuestionMultipleTextModel>question;
}
private getVisibleRows() {
return this.question.getRows().filter(row => row.isVisible);
}
private async generateFlatItem(point: IPoint, row_index: number, col_index: number,
item: MultipleTextItemModel): Promise<IPdfBrick> {
const colWidth: number = SurveyHelper.getPageAvailableWidth(this.controller);
Expand All @@ -38,17 +41,17 @@ export class FlatMultipleText extends FlatQuestion {
public async generateFlatsContent(point: IPoint): Promise<IPdfBrick[]> {
const rowsFlats: CompositeBrick[] = [];
const currPoint: IPoint = SurveyHelper.clone(point);
const rows = this.question.getRows();
const rows = this.getVisibleRows();
for (let i: number = 0; i < rows.length; i++) {
rowsFlats.push(new CompositeBrick());
let yBot: number = currPoint.yTop;
this.controller.pushMargins();
for (let j: number = 0; j < rows[i].length; j++) {
for (let j: number = 0; j < rows[i].cells.length; j++) {
this.controller.pushMargins();
SurveyHelper.setColumnMargins(this.controller, this.question.colCount, j);
currPoint.xLeft = this.controller.margins.left;
const itemFlat: IPdfBrick = await this.generateFlatItem(
currPoint, i, j, rows[i][j]);
currPoint, i, j, rows[i].cells[j].item);
rowsFlats[rowsFlats.length - 1].addBrick(itemFlat);
yBot = Math.max(yBot, itemFlat.yBot);
this.controller.popMargins();
Expand Down

0 comments on commit cac0b48

Please sign in to comment.