Skip to content

Commit

Permalink
Change addSurveyJSON into addCollectionItemsJson
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Mar 4, 2024
1 parent 03444f1 commit 3f521a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ export class SurveyCreatorModel extends Base
public get survey(): SurveyModel {
return this.surveyValue;
}
public addSurveyJson(json: any, indexPage?: number): void {
public addCollectionItemsJson(json: any, indexPage?: number): void {
const survey = new SurveyModel(json);
this.updateAddingSurvey(survey);
this.addSurveyPages(survey, indexPage);
Expand Down
12 changes: 6 additions & 6 deletions packages/survey-creator-core/tests/creator-addsurvey.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ test("Add pages into survey", (): any => {
const json = {
pages: [{ name: "page3", elements: [{ type: "text", name: "question3" }] }]
};
creator.addSurveyJson(json);
creator.addCollectionItemsJson(json);
expect(creator.survey.pages).toHaveLength(3);
expect(creator.survey.pages[2].name).toEqual("page3");

creator.JSON = surveyJSON;
expect(creator.survey.pages).toHaveLength(2);
creator.addSurveyJson(json, 1);
creator.addCollectionItemsJson(json, 1);
expect(creator.survey.pages).toHaveLength(3);
expect(creator.survey.pages[1].name).toEqual("page3");

creator.JSON = surveyJSON;
expect(creator.survey.pages).toHaveLength(2);
creator.addSurveyJson(json, 0);
creator.addCollectionItemsJson(json, 0);
expect(creator.survey.pages).toHaveLength(3);
expect(creator.survey.pages[0].name).toEqual("page3");
});
Expand All @@ -50,7 +50,7 @@ test("Add pages into survey", (): any => {
const json = {
pages: [{ name: "page1", elements: [{ type: "panel", name: "panel1", elements: [{ type: "text", name: "question1" }] }] }]
};
creator.addSurveyJson(json);
creator.addCollectionItemsJson(json);
expect(creator.survey.pages).toHaveLength(3);
const page = creator.survey.pages[2];
expect(page.name).toEqual("page3");
Expand All @@ -73,7 +73,7 @@ test("Update expressions", (): any => {
{ expression: "{question1} = 3" }
]
};
creator.addSurveyJson(json);
creator.addCollectionItemsJson(json);
expect(creator.survey.pages).toHaveLength(3);
const survey = creator.survey;
const page = survey.pages[2];
Expand All @@ -98,7 +98,7 @@ test("Update calculatedValues", (): any => {
{ name: "var1", expression: "1" }
]
};
creator.addSurveyJson(json);
creator.addCollectionItemsJson(json);
expect(creator.survey.pages).toHaveLength(3);
const survey = creator.survey;
const values = survey.calculatedValues;
Expand Down

0 comments on commit 3f521a9

Please sign in to comment.