Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix property grid resets tab's name when question's name is changing #6736

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export class PropertyGridViewModel extends Base {
let titleName = this.getTitle();
this.selectedElementName = titleName;
this.objectSelectionAction.tooltip = titleName;
this.objectSelectionAction.title = this.propertyGridModel.showOneCategoryInPropertyGrid ? "" : titleName;
if(!this.propertyGridModel.showOneCategoryInPropertyGrid) {
this.objectSelectionAction.title = titleName;
}
}
private getTitle(): string {
var obj = this.getSelectedObj();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import {
PopupModel,
IAction,
QuestionMatrixDynamicModel,
_setIsTouch
_setIsTouch,
QuestionTextModel
} from "survey-core";
import { PropertyGridViewModel } from "../../src/property-grid/property-grid-view-model";
export { PropertyGridEditorMatrix } from "../../src/property-grid/matrices";
import { CreatorTester } from "../creator-tester";
import { ObjectSelectorModel } from "../../src/property-grid/object-selector";
import { settings } from "../../src/creator-settings";
import { TabDesignerPlugin } from "../../src/components/tabs/designer-plugin";

test("Generate and update title correctly", () => {
const creator = new CreatorTester();
Expand Down Expand Up @@ -191,4 +193,26 @@ test("Create the property grid survey on request", () => {
const model = new PropertyGridViewModel(propertyGrid, creator);
expect(model.getPropertyValue("survey")).toBeFalsy();
expect(model.survey).toBeTruthy();
});
});

test("Object selector's title should be leaved unchanged when changing question's name - Bug#6699", () => {
const creator = new CreatorTester();
creator.JSON = {
elements: [
{
type: "text",
name: "question1"
}
]
};
const question = creator.survey.getQuestionByName("question1");
creator.showOneCategoryInPropertyGrid = true;
const propertyGridViewModel = (creator.getPlugin("designer") as TabDesignerPlugin).propertyGridViewModel;
const selectorBarItem = propertyGridViewModel.objectSelectionAction;
creator.selectElement(question);
expect(selectorBarItem.title).toBe("General");
expect(selectorBarItem.tooltip).toBe("question1");
question.name = "question2";
expect(selectorBarItem.title).toBe("General");
expect(selectorBarItem.tooltip).toBe("question2");
});