Skip to content

Commit

Permalink
replace toggleVisibility -> show/hide
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaLarina committed Jan 10, 2025
1 parent 5f5a1b0 commit 2403684
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
26 changes: 13 additions & 13 deletions packages/survey-creator-core/tests/creator-base.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ test("Question type custom widgets", (): any => {
expect(creator.addNewQuestionText).toEqual("Add Question");
const selectorModel = creator.getQuestionTypeSelectorModel(() => { });
const listModel: ListModel = selectorModel.popupModel.contentComponentData.model;
selectorModel.popupModel.toggleVisibility();
selectorModel.popupModel.show();
const actionPopupViewModel = new PopupDropdownViewModel(selectorModel.popupModel); // need for popupModel.onShow
selectorModel.popupModel.show();
const customItem = listModel.actions.filter((item) => item.id == "test_widget")[0];
Expand Down Expand Up @@ -2295,7 +2295,7 @@ test("ConvertTo, show the current question type selected", (): any => {
const popup = questionModel.getActionById("convertTo").popupModel;
expect(popup).toBeTruthy();
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect(list).toBeTruthy();
expect(list.selectedItem).toBeTruthy();
Expand Down Expand Up @@ -2324,7 +2324,7 @@ test("ConvertTo, show it for a panel", (): any => {
const popup = panelModel.getActionById("convertTo").popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
expect(popup).toBeTruthy();
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect(list).toBeTruthy();
expect(list.selectedItem).toBeTruthy();
Expand Down Expand Up @@ -2428,23 +2428,23 @@ test("ConvertTo & addNewQuestion refresh items", (): any => {
expect(convertToAction.data.actions.length).toBe(0);
expect(questionTypeSelectorListModel.actions.length).toBe(0);

convertToAction.popupModel.toggleVisibility();
convertToAction.popupModel.show();
expect(convertToAction.data.actions.length).toBe(21);
convertToAction.popupModel.toggleVisibility();
convertToAction.popupModel.hide();

questionTypeSelectorModel.popupModel.toggleVisibility();
questionTypeSelectorModel.popupModel.show();
expect(questionTypeSelectorListModel.actions.length).toBe(21);
questionTypeSelectorModel.popupModel.toggleVisibility();
questionTypeSelectorModel.popupModel.hide();

pageModel.addNewQuestion("text", "q2");

convertToAction.popupModel.toggleVisibility();
convertToAction.popupModel.show();
expect(convertToAction.data.actions.length).toBe(20);
convertToAction.popupModel.toggleVisibility();
convertToAction.popupModel.hide();

questionTypeSelectorModel.popupModel.toggleVisibility();
questionTypeSelectorModel.popupModel.show();
expect(questionTypeSelectorListModel.actions.length).toBe(20);
questionTypeSelectorModel.popupModel.toggleVisibility();
questionTypeSelectorModel.popupModel.hide();

const q2AdornerModel = new QuestionAdornerViewModel(creator, creator.survey.getQuestionByName("q2"), undefined);
const convertToAction2 = q2AdornerModel.actionContainer.actions.filter(action => action.id === "convertTo")[0];
Expand Down Expand Up @@ -3285,7 +3285,7 @@ test("Add new question to Panel and Page", (): any => {
const selectorModelPage = pageAdornerModel.questionTypeSelectorModel;
const listModelPage: ListModel = selectorModelPage.popupModel.contentComponentData.model;
actionPopupViewModel = new PopupDropdownViewModel(selectorModelPage.popupModel); // need for popupModel.onShow
selectorModelPage.popupModel.toggleVisibility();
selectorModelPage.popupModel.show();
const rankingItem = listModelPage.actions.filter((item) => item.id == "ranking")[0];
listModelPage.onItemClick(rankingItem);

Expand All @@ -3297,7 +3297,7 @@ test("Add new question to Panel and Page", (): any => {
const selectorModelPage2 = pageAdornerModel2.questionTypeSelectorModel;
const listModelPage2: ListModel = selectorModelPage2.popupModel.contentComponentData.model;
actionPopupViewModel = new PopupDropdownViewModel(selectorModelPage2.popupModel); // need for popupModel.onShow
selectorModelPage2.popupModel.toggleVisibility();
selectorModelPage2.popupModel.show();
const htmlItem = listModelPage2.actions.filter((item) => item.id == "html")[0];
listModelPage2.onItemClick(htmlItem);

Expand Down
32 changes: 16 additions & 16 deletions packages/survey-creator-core/tests/question-adorner.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function getQuestionConverterList(creator: CreatorTester, questionName: string)
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
return list;
}
Expand All @@ -274,7 +274,7 @@ test("Check question converter no subitems", (): any => {
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect((list.getActionById("text").items || []).length).toBe(0);

Expand All @@ -299,13 +299,13 @@ test("Check question converter selected item for subitems", (): any => {
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect(list.selectedItem.id).toBe("text");

const popupSubtype = list.selectedItem.popupModel;
const popupViewModelSubtype = new PopupDropdownViewModel(popupSubtype); // need for popupModel.onShow
popupSubtype.toggleVisibility();
popupSubtype.show();
const listSubtype = popupSubtype.contentComponentData.model;
expect(listSubtype.selectedItem.id).toBe("email");

Expand Down Expand Up @@ -342,13 +342,13 @@ test("Check question converter selected item for customized subitems (types)", (
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect(list.selectedItem.id).toBe("matrix");

const popupSubtype = list.selectedItem.popupModel;
const popupViewModelSubtype = new PopupDropdownViewModel(popupSubtype); // need for popupModel.onShow
popupSubtype.toggleVisibility();
popupSubtype.show();
const listSubtype = popupSubtype.contentComponentData.model;
expect(listSubtype.selectedItem.id).toBe("matrixdropdown");

Expand Down Expand Up @@ -380,13 +380,13 @@ test("Check question converter selected item for customized subitems (json)", ()
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect(list.selectedItem.id).toBe("boolean");

const popupSubtype = list.selectedItem.popupModel;
const popupViewModelSubtype = new PopupDropdownViewModel(popupSubtype); // need for popupModel.onShow
popupSubtype.toggleVisibility();
popupSubtype.show();
const listSubtype = popupSubtype.contentComponentData.model;
expect(listSubtype.selectedItem.id).toBe("boolradio");

Expand Down Expand Up @@ -422,13 +422,13 @@ test("Check question converter selected item for single subitems (json)", (): an
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;
expect(list.selectedItem.id).toBe("comment");

const popupSubtype = list.selectedItem.popupModel;
const popupViewModelSubtype = new PopupDropdownViewModel(popupSubtype); // need for popupModel.onShow
popupSubtype.toggleVisibility();
popupSubtype.show();
const listSubtype = popupSubtype.contentComponentData.model;
expect(listSubtype.selectedItem.id).toBe("limitedLongText");

Expand All @@ -441,13 +441,13 @@ test("Check question converter selected item for single subitems (json)", (): an
const convertToAction2 = questionAdorner2.actionContainer.getActionById("convertTo");
const popup2 = convertToAction2.popupModel;
const popupViewModel2 = new PopupDropdownViewModel(popup2); // need for popupModel.onShow
popup2.toggleVisibility();
popup2.show();
const list2 = popup2.contentComponentData.model;
expect(list2.selectedItem.id).toBe("comment");

const popupSubtype2 = list2.selectedItem.popupModel;
const popupViewModelSubtype2 = new PopupDropdownViewModel(popupSubtype2); // need for popupModel.onShow
popupSubtype2.toggleVisibility();
popupSubtype2.show();
const listSubtype2 = popupSubtype2.contentComponentData.model;
expect(listSubtype2.actions.length).toBe(2);
expect(listSubtype2.selectedItem.title).toBe("Long Text");
Expand Down Expand Up @@ -485,7 +485,7 @@ test("Check question converter with subitems (json)", (): any => {
const convertToAction = questionAdorner.actionContainer.getActionById("convertTo");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
const list = popup.contentComponentData.model;

const booleanAction = list.getActionById("boolean");
Expand All @@ -494,7 +494,7 @@ test("Check question converter with subitems (json)", (): any => {
const questionConverted = creator.survey.getQuestionByName("q1");
expect(questionConverted.renderAs).toBe("checkbox");

popup.toggleVisibility();
popup.show();
const booleanCheckAction2 = booleanAction.items[0];
booleanCheckAction2.action();
const questionConverted2 = creator.survey.getQuestionByName("q1");
Expand Down Expand Up @@ -533,7 +533,7 @@ test("Check question converter with subitems for input type", (): any => {
const convertToAction = questionAdorner.actionContainer.getActionById("convertInputType");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
return popup.contentComponentData.model;
}

Expand Down Expand Up @@ -613,7 +613,7 @@ test("Check question converter with subitems for input type, bug #5884", (): any
const convertToAction = questionAdorner.actionContainer.getActionById("convertInputType");
const popup = convertToAction.popupModel;
const popupViewModel = new PopupDropdownViewModel(popup); // need for popupModel.onShow
popup.toggleVisibility();
popup.show();
return popup.contentComponentData.model;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/survey-creator-core/tests/tabs/test.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ test("Check popup viewType", (): any => {
expect(options.menuType).toEqual("popup");
});

question.dropdownListModel.popupModel.toggleVisibility();
question.dropdownListModel.popupModel.show();
expect(question.dropdownListModel.popupModel.isVisible).toBeTruthy();
_setIsTouch(false);
});
Expand Down Expand Up @@ -751,7 +751,7 @@ test("Check that popups inside survey are closed when scrolling container", ():

const model: TestSurveyTabViewModel = testPlugin.model;
const question = <QuestionDropdownModel>model.survey.getAllQuestions()[0];
question.dropdownListModel.popupModel.toggleVisibility();
question.dropdownListModel.popupModel.show();
expect(model.survey["onScrollCallback"]).toBeDefined();
expect(question.dropdownListModel.popupModel.isVisible).toBeTruthy();
model.onScroll();
Expand Down

0 comments on commit 2403684

Please sign in to comment.