Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix paneldynamic getQuestions() method when panels count is 0.
- Loading branch information
Dmitry Kuzin (DevExpress)
committed
Feb 18, 2020
1 parent
cf53a47
commit 3d5ddb7
Showing
2 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { SurveyModel, QuestionTextModel } from "survey-core"; | ||
import { VisualizationPanelDynamic } from "../src/visualizationPanelDynamic"; | ||
|
||
test("check paneldynamic visualization getQuestions() when panels count is 0", () => { | ||
const json = { | ||
elements: [ | ||
{ | ||
name: "question1", | ||
type: "paneldynamic", | ||
isRequired: true, | ||
templateElements: [ | ||
{ | ||
type: "text", | ||
name: "question2" | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
const data = [ | ||
{ | ||
question1: [{ question2: "testValue" }] | ||
} | ||
]; | ||
const survey = new SurveyModel(json); | ||
const question = survey.getAllQuestions()[0]; | ||
const viz = new VisualizationPanelDynamic( | ||
document.createElement("div"), | ||
<any>question, | ||
data, | ||
{} | ||
); | ||
expect(viz.getQuestions()).toBeTruthy(); | ||
}); |