diff --git a/src/flat_layout/flat_file.ts b/src/flat_layout/flat_file.ts index fe8ee6b..caac556 100644 --- a/src/flat_layout/flat_file.ts +++ b/src/flat_layout/flat_file.ts @@ -64,7 +64,7 @@ export class FlatFile extends FlatQuestion { public async generateFlatsContent(point: IPoint): Promise { if (this.question.previewValue.length === 0) { return [await SurveyHelper.createTextFlat(point, this.question, - this.controller, surveyLocalization.getString('noFileChosen'), TextBrick)]; + this.controller, this.question.noFileChosenCaption, TextBrick)]; } const rowsFlats: CompositeBrick[] = [new CompositeBrick()]; const currPoint: IPoint = SurveyHelper.clone(point); diff --git a/tests/flat_file.test.ts b/tests/flat_file.test.ts index be7b2b3..990f071 100644 --- a/tests/flat_file.test.ts +++ b/tests/flat_file.test.ts @@ -35,6 +35,28 @@ test('Check no files', async () => { survey.getAllQuestions()[0], controller, 'No file chosen', TextBrick); TestHelper.equalRect(expect, flats[0][0], assumeFile); }); +test('Check noFileChosen locale', async () => { + let json: any = { + elements: [ + { + type: 'file', + name: 'faque', + titleLocation: 'hidden' + } + ] + }; + let survey: SurveyPDF = new SurveyPDF(json, TestHelper.defaultOptions); + survey.getAllQuestions()[0].noFileChosenCaption = 'test'; + let controller: DocController = new DocController(TestHelper.defaultOptions); + let flats: IPdfBrick[][] = await FlatSurvey.generateFlats(survey, controller); + expect(flats.length).toBe(1); + expect(flats[0].length).toBe(1); + controller.margins.left += controller.unitWidth; + let assumeFile: IRect = await SurveyHelper.createTextFlat(controller.leftTopPoint, + survey.getAllQuestions()[0], controller, 'test', TextBrick); + TestHelper.equalRect(expect, flats[0][0], assumeFile); + expect(((flats[0][0])['bricks'][0])['text']).toEqual('test'); +}); test('Check one text file', async () => { let json: any = { elements: [