Skip to content

Commit

Permalink
The text from question name (after change) is used for two lines in t…
Browse files Browse the repository at this point in the history
…he Property grid caption (#6543)

* work for surveyjs/private-tasks#451

* work for surveyjs/private-tasks#451

---------

Co-authored-by: OlgaLarina <[email protected]>
  • Loading branch information
OlgaLarina and OlgaLarina authored Feb 7, 2025
1 parent 5afc5ab commit efb16e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export class PropertyGridViewModel extends Base {
private updateTitle() {
let titleName = this.getTitle();
this.selectedElementName = titleName;
this.objectSelectionAction.title = titleName;
this.objectSelectionAction.tooltip = titleName;
this.objectSelectionAction.title = this.propertyGridModel.showOneCategoryInPropertyGrid ? "" : titleName;
}
private getTitle(): string {
var obj = this.getSelectedObj();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { settings } from "../../src/creator-settings";

test("Generate and update title correctly", () => {
const creator = new CreatorTester();
creator.showOneCategoryInPropertyGrid = false;
creator.JSON = {
elements: [
{
Expand All @@ -41,6 +42,27 @@ test("Generate and update title correctly", () => {
propertyGrid.survey.getQuestionByName("name").value = "Q2";
expect(model.objectSelectionAction.title).toEqual("Question:Q2");
});
test("showOneCategoryInPropertyGrid: Generate and update title correctly", () => {
const creator = new CreatorTester();
creator.JSON = { elements: [{ type: "text", name: "question1" }] };
const propertyGrid = creator["designerPropertyGrid"];
const model = new PropertyGridViewModel(propertyGrid, creator);
expect(model.objectSelectionAction.tooltip).toEqual("Survey");
propertyGrid.obj = creator.survey.getQuestionByName("question1");
expect(model.objectSelectionAction.tooltip).toEqual("question1");
propertyGrid.survey.getQuestionByName("name").value = "Q1";
expect(model.objectSelectionAction.tooltip).toEqual("Q1");
propertyGrid.options.getObjectDisplayName = (
obj: Base,
area: string,
reason: string,
displayName: string
) => {
return "Question:" + obj["name"];
};
propertyGrid.survey.getQuestionByName("name").value = "Q2";
expect(model.objectSelectionAction.tooltip).toEqual("Question:Q2");
});
test("Prev/next correctly, including columns via actions", () => {
const creator = new CreatorTester();
creator.propertyGridNavigationMode = "accordion";
Expand Down

0 comments on commit efb16e4

Please sign in to comment.