Skip to content

Commit

Permalink
Add a unit test for inheritBaseProps
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jan 24, 2024
1 parent 0689814 commit 7bcfd99
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/question_customtests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,34 @@ QUnit.test("single component: inheritBaseProps: array<string>", function (assert

ComponentCollection.Instance.clear();
});
QUnit.test("single component: inheritBaseProps: array<string> #2", function (assert) {
ComponentCollection.Instance.add({
name: "customtext",
inheritBaseProps: ["placeholder"],
questionJSON: {
type: "text",
placeholder: "abc"
},
});

const survey = new SurveyModel({
elements: [
{ type: "customtext", name: "q1" }
]
});
const q1 = <QuestionCustomModel>survey.getQuestionByName("q1");
const content = <QuestionTextModel>q1.contentQuestion;
assert.equal(q1.placeholder, "abc", "q1.placeholder #1");
assert.equal(content.placeholder, "abc", "content.placeholder #1");
q1.placeholder = "bcd";
assert.equal(q1.placeholder, "bcd", "q1.placeholder #2");
assert.equal(content.placeholder, "bcd", "content.placeholder #2");
content.placeholder = "cde";
assert.equal(q1.placeholder, "cde", "q1.placeholder #3");
assert.equal(content.placeholder, "cde", "content.placeholder #3");

ComponentCollection.Instance.clear();
});
QUnit.test("single component: inheritBaseProps: true", function (assert) {
ComponentCollection.Instance.add({
name: "customdropdown",
Expand Down

0 comments on commit 7bcfd99

Please sign in to comment.