Skip to content

Commit 5c39196

Browse files
authored
#9410 Dynamic matrix - In mobile view Show Detail/Hide Details buttons incorrect label issue (#9423)
* #9410 Dynamic matrix - In mobile view Show Detail/Hide Details buttons incorrect label issue Fixes #9410 * resize before test #9410 * fixed test Dynamic matrix - In mobile view Show Detail/Hide Details buttons incorrect label issue #9410
1 parent 922372f commit 5c39196

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

functionalTests/questions/matrixdynamic.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ frameworks.forEach((framework) => {
494494
fixture`${framework} ${title}`.page`${url}${framework}`;
495495

496496
test("Focus remove or add button removing", async (t) => {
497+
await t.resizeWindow(1920, 1080);
497498
await initSurvey(framework, {
498499
focusFirstQuestionAutomatic: true,
499500
elements: [
@@ -526,6 +527,7 @@ frameworks.forEach((framework) => {
526527
await t.expect(await getSurveyResult()).eql({ matrix: [{ name: "abc123" }] });
527528
});
528529
test("Focus remove or add button removing for horizontal columns layout", async (t) => {
530+
await t.resizeWindow(1920, 1080);
529531
await initSurvey(framework, {
530532
focusFirstQuestionAutomatic: true,
531533
elements: [
@@ -559,6 +561,7 @@ frameworks.forEach((framework) => {
559561
await t.expect(await getSurveyResult()).eql({ matrix: [{ name: "abc123" }] });
560562
});
561563
test("Editing cell loses focus when a dependent column appears, Bug#9233", async (t) => {
564+
await t.resizeWindow(1920, 1080);
562565
await initSurvey(framework, {
563566
textUpdateMode: "onTyping",
564567
elements: [
@@ -596,4 +599,52 @@ frameworks.forEach((framework) => {
596599

597600
await t.expect(await getSurveyResult()).eql({ matrix: [{ col2: "abc" }] });
598601
});
602+
test("show/hide details mobile", async (t) => {
603+
await initSurvey(framework, {
604+
"title": "TEST",
605+
"description": "TEST",
606+
"logoPosition": "right",
607+
"pages": [
608+
{
609+
"name": "page1",
610+
"elements": [
611+
{
612+
"type": "matrixdynamic",
613+
"name": "matrix",
614+
"titleLocation": "hidden",
615+
"verticalAlign": "top",
616+
"columns": [
617+
{
618+
"name": "header",
619+
"cellType": "text",
620+
},
621+
],
622+
"detailElements": [
623+
{
624+
"name": "detail",
625+
"type": "text",
626+
},
627+
],
628+
"detailPanelMode": "underRowSingle",
629+
"cellType": "text",
630+
"rowCount": 1,
631+
"addRowLocation": "top",
632+
"hideColumnsIfEmpty": true,
633+
"detailPanelShowOnAdding": true
634+
}
635+
]
636+
}
637+
],
638+
"showNavigationButtons": "none",
639+
"showQuestionNumbers": "off"
640+
});
641+
await t.resizeWindow(600, 1080);
642+
await t.click(Selector("button").withText("Add Row"));
643+
await t.expect(Selector("#show-detail-mobile").filterVisible().nth(0).innerText).contains("Show Details");
644+
await t.expect(Selector("#show-detail-mobile").filterVisible().nth(1).innerText).contains("Hide Details");
645+
646+
await t.click(Selector("#show-detail-mobile button").filterVisible().nth(0));
647+
await t.expect(Selector("#show-detail-mobile").filterVisible().nth(0).innerText).contains("Hide Details");
648+
await t.expect(Selector("#show-detail-mobile").filterVisible().nth(1).innerText).contains("Show Details");
649+
});
599650
});

packages/survey-core/src/question_matrixdropdownrendered.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { property, propertyArray } from "./jsonobject";
22
import { Question } from "./question";
3-
import { Base } from "./base";
3+
import { Base, ComputedUpdater } from "./base";
44
import { ItemValue } from "./itemvalue";
55
import { LocalizableString } from "./localizablestring";
66
import { PanelModel } from "./panel";
@@ -763,11 +763,10 @@ export class QuestionMatrixDropdownRenderedTable extends Base {
763763
actions.unshift(
764764
new Action({
765765
id: "show-detail-mobile",
766-
title: "Show Details",
766+
title: <any>new ComputedUpdater(() => row.isDetailPanelShowing ? this.matrix.getLocalizationString("hideDetails") : this.matrix.getLocalizationString("showDetails")),
767767
showTitle: true,
768768
location: "end",
769769
action: (context) => {
770-
context.title = row.isDetailPanelShowing ? this.matrix.getLocalizationString("showDetails") : this.matrix.getLocalizationString("hideDetails");
771770
row.showHideDetailPanelClick();
772771
},
773772
})

0 commit comments

Comments
 (0)