Skip to content

Commit

Permalink
Add getDynamicType function #7661
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jan 17, 2024
1 parent 2eb2485 commit 1d769c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/question_custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ export class QuestionCustomModel extends QuestionCustomModelBase {
public getDynamicProperties(): Array<JsonObjectProperty> {
return this.customQuestion.getDynamicProperties() || [];
}
public getDynamicType(): string {
return this.questionWrapper ? this.questionWrapper.getType() : "question";
}
protected createWrapper(): void {
this.questionWrapper = this.createQuestion();
this.createDynamicProperties(this.questionWrapper);
Expand Down
1 change: 1 addition & 0 deletions tests/question_customtests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2787,6 +2787,7 @@ QUnit.test("single component: inheritBaseProps: true", function (assert) {
});
const q1 = <QuestionCustomModel>survey.getQuestionByName("q1");
const content = <QuestionDropdownModel>q1.contentQuestion;
assert.equal(q1.getDynamicType(), "dropdown", "q1.getDynamicType()");
assert.equal(content.choices.length, 3, "content.choices");
assert.notOk(q1.choices, "q1.choices");
assert.equal(q1.allowClear, false, "q1.allowClear #1");
Expand Down

0 comments on commit 1d769c4

Please sign in to comment.