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

Work for #269: fix no file chosen caption doesn't change locale #270

Merged
merged 1 commit into from
Sep 15, 2023
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
2 changes: 1 addition & 1 deletion src/flat_layout/flat_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class FlatFile extends FlatQuestion {
public async generateFlatsContent(point: IPoint): Promise<IPdfBrick[]> {
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);
Expand Down
22 changes: 22 additions & 0 deletions tests/flat_file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ test('Check no files', async () => {
<Question>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,
<Question>survey.getAllQuestions()[0], controller, 'test', TextBrick);
TestHelper.equalRect(expect, flats[0][0], assumeFile);
expect((<TextBrick>(<CompositeBrick>flats[0][0])['bricks'][0])['text']).toEqual('test');
});
test('Check one text file', async () => {
let json: any = {
elements: [
Expand Down