Skip to content

Commit

Permalink
Add a unit test on delete panel/page
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Aug 8, 2023
1 parent 9c7c933 commit 82e4a50
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17470,4 +17470,26 @@ QUnit.test("survey.applyTheme", function (assert) {
assert.equal(survey.backgroundImageAttachment, "fixed");
assert.equal(survey.backgroundOpacity, 0.6);
assert.equal(survey["isCompact"], true);
});
});
QUnit.test("page/panel delete do it recursively", function (assert) {
const survey = new SurveyModel({
elements: [{ type: "panel", name: "p1",
elements: [
{ type: "text", name: "q1" },
] },
{ type: "panel", name: "p2",
elements: [
{ type: "text", name: "q2" },
] }
] });
const p1 = survey.getPanelByName("p1");
const p2 = survey.getPanelByName("p2");
const q1 = survey.getQuestionByName("q1");
const q2 = survey.getQuestionByName("q2");
p2.delete();
assert.equal(p2.isDisposed, true, "p2.isDisposed");
assert.equal(q2.isDisposed, true, "q2.isDisposed");
survey.currentPage.delete();
assert.equal(p1.isDisposed, true, "p1.isDisposed");
assert.equal(q1.isDisposed, true, "q1.isDisposed");
});

0 comments on commit 82e4a50

Please sign in to comment.