Skip to content

Commit

Permalink
#6538 Survey Settings button is invisible when Property grid is shown (
Browse files Browse the repository at this point in the history
…#6541)

* #6538 Survey Settings button is invisible when Property grid is shown
Fixes #6538

* #6538 - fixed unit-test
  • Loading branch information
novikov82 authored Feb 7, 2025
1 parent 5999f4a commit 10fb64c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
10 changes: 10 additions & 0 deletions functionalTests/designer/surface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,14 @@ test("Page adorner header click - select", async (t) => {

await t.click(".svc-page__content-actions", { offsetX: 50, offsetY: 5 });
await t.expect(Selector(".svc-page__content").hasClass("svc-page__content--selected")).ok();
});

test("Check survey settings button", async (t) => {
const settingsButton = Selector('button[title="Survey settings"]');
await ClientFunction(() => window["creator"].showOneCategoryInPropertyGrid = true)();
await t.resizeWindow(1000, 800);
await t.resizeWindow(1600, 800);
await t.expect(settingsButton.hasClass("svc-toolbar__item--active")).notOk();
await t.click('.svc-menu-action__button[title="General"]');
await t.expect(settingsButton.hasClass("svc-toolbar__item--active")).ok();
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,22 @@ export class TabDesignerPlugin implements ICreatorPlugin {
return this.creator.isElementSelected(<any>this.creator.survey);
}
private get isSettingsActive(): boolean {
return this.creator.showSidebar && this.isSurveySelected;
const activePage = this.creator.sidebar.activePage;
return notShortCircuitAnd(this.creator.showSidebar,
this.isSurveySelected,
activePage !== this.propertyGridPlaceholderPage.id);
}
private get activePageIsPropertyGrid(): boolean {
return this.creator.sidebar.activePage === this.propertyGridTab.id;
}
private createSelectedUpdater() {
return <any>new ComputedUpdater<boolean>(() => {
return this.isSettingsActive;
});
}
private createVisibleUpdater() {
return <any>new ComputedUpdater<boolean>(() => {
const activePage = this.creator.sidebar.activePage;
return notShortCircuitAnd(this.creator.activeTab === "designer", activePage !== this.propertyGridPlaceholderPage.id);
return this.creator.activeTab === "designer";
});
}
private updateTabControl() {
Expand Down Expand Up @@ -404,7 +411,7 @@ export class TabDesignerPlugin implements ICreatorPlugin {
});
}
},
active: this.isSettingsActive,
active: this.createSelectedUpdater(),
visible: this.createVisibleUpdater(),
locTitleName: "ed.surveySettings",
locTooltipName: "ed.surveySettingsTooltip",
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-creator-core/tests/creator-base-1.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ test("Create new page, recreate designer survey via JSON", (): any => {
test("Check survey settings button ", (): any => {
const creator = new CreatorTester();
const item = creator.getActionBarItem("svd-settings");
expect(item.active).toBeTruthy();
expect(item.active).toBeFalsy();
creator.selectElement(creator.survey.pages[0]);
expect(item.active).toBeFalsy();
creator.selectElement(creator.survey);
Expand Down

0 comments on commit 10fb64c

Please sign in to comment.