Skip to content

Commit

Permalink
Knockout: Text for carry forward choices are not changed immediately …
Browse files Browse the repository at this point in the history
…on changing survey locale fix #8367 (#8368)
  • Loading branch information
andrewtelnov authored Jun 5, 2024
1 parent b06e513 commit 83ddd47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/question_baseselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ export class QuestionSelectBase extends Question {
ItemValue.locStrsChanged(this.choicesFromUrl);
ItemValue.locStrsChanged(this.visibleChoices);
}
if(this.isUsingCarryForward) {
ItemValue.locStrsChanged(this.visibleChoices);
}
}
public get otherValue(): string {
if(!this.showCommentArea) return this.comment;
Expand Down
6 changes: 6 additions & 0 deletions tests/question_baseselecttests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,12 @@ QUnit.test("Carry Forward and localization, bug#6352", function (assert) {
assert.equal(q2.visibleChoices.length, 1);
assert.deepEqual(q2.visibleChoices[0].locText.getJson(), { default: "A de", en: "A en" });
assert.equal(q2.visibleChoices[0].text, "A en");
let counter = 0;
q2.visibleChoices[0].locText.onStringChanged.add((sender, options) => {
counter ++;
});
survey.locale = "de";
assert.equal(counter, 1, "Fire str changed");
surveyLocalization.defaultLocale = "en";
});
QUnit.test("Carry Forward and keepIncorrectValues, bug#6490", function (assert) {
Expand Down

0 comments on commit 83ddd47

Please sign in to comment.