Skip to content

Commit

Permalink
The 'Uncaught TypeError: e.useRateValues is not a function' exception… (
Browse files Browse the repository at this point in the history
#5372)

* The 'Uncaught TypeError: e.useRateValues is not a function' exception is thrown when setting 'inheritBaseProps: true' for a Rating specialized question type fix #5370

* Improve the fix #5370
  • Loading branch information
andrewtelnov committed Apr 2, 2024
1 parent 0139339 commit 2ff5b53
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export class QuestionRatingAdornerViewModel extends Base {
}

static useRateValues(element: any): boolean {
return element.useRateValues();
const el = !!element.contentQuestion ? element.contentQuestion : element;
return !!el.useRateValues && el.useRateValues();
}

public addItem(model: QuestionRatingAdornerViewModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3266,4 +3266,21 @@ test("PropertyGridEditorMaskType editor: localize item", () => {
expect(maskTypeQuestion.selectedItem.title).toEqual("Unmasked");

enLocale.pe.maskTypes.none = oldMaskTypesNone;
});
test("PropertyGridEditorMaskType editor: localize item", () => {
ComponentCollection.Instance.add({
name: "CSAT",
inheritBaseProps: true,
questionJSON: {
type: "rating",
rateType: "labels"
}
});
const question = Serializer.createClass("CSAT", { name: "q1" });
expect(question.getType()).toBe("csat");
const propertyGrid = new PropertyGridModelTester(question);
const autoGenerateQuestion = propertyGrid.survey.getQuestionByName("autoGenerate");
expect(autoGenerateQuestion.value).toBeTruthy();

ComponentCollection.Instance.clear();
});

0 comments on commit 2ff5b53

Please sign in to comment.