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

Text Max Length indicator is incorrectly displayed #5850

Merged
merged 2 commits into from
Mar 23, 2023
Merged
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
2 changes: 2 additions & 0 deletions src/defaultCss/defaultV2Css.ts
Original file line number Diff line number Diff line change
@@ -292,6 +292,7 @@ export var defaultV2Css = {
itemLabelOnError: "sd-multipletext__item-container--error",
item: "sd-multipletext__item",
itemTitle: "sd-multipletext__item-title",
content: "sd-multipletext__content sd-question__content",
row: "sd-multipletext__row",
cell: "sd-multipletext__cell"
},
@@ -404,6 +405,7 @@ export var defaultV2Css = {
empty: "sd-question--empty",
root: "sd-table sd-matrixdynamic",
tableWrapper: "sd-table-wrapper",
content: "sd-matrixdynamic__content sd-question__content",
cell: "sd-table__cell",
row: "sd-table__row",
itemCell: "sd-table__cell--item",
3 changes: 3 additions & 0 deletions src/defaultV2-theme/blocks/sd-multipletext.scss
Original file line number Diff line number Diff line change
@@ -46,6 +46,9 @@
.sd-multipletext__item {
flex-grow: 1;
}
.sd-multipletext__content .sd-multipletext__item-container {
position: relative;
}
.sd-multipletext__item-container--error {
background-color: $red-light;
.sd-input--error {
3 changes: 3 additions & 0 deletions src/defaultV2-theme/blocks/sd-table.scss
Original file line number Diff line number Diff line change
@@ -139,6 +139,9 @@
min-width: calcSize(12);
padding: calcSize(2.5) calcSize(1);
}
.sd-matrixdynamic__content .sd-table__question-wrapper {
position: relative;
}
.sd-table__question-wrapper:not(:focus-within):hover {
position: relative;
.sd-question__erbox--tooltip {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 137 additions & 2 deletions visualRegressionTests/tests/defaultV2/question.ts
Original file line number Diff line number Diff line change
@@ -395,21 +395,156 @@ frameworks.forEach(framework => {
type: "text",
maxLength: 10,
defaultValue: "Test"
},
{
}, {
name: "comment",
type: "comment",
maxLength: 10,
defaultValue: "Test"
},
{
"type": "multipletext",
"name": "question1",
"validators": [
{
"type": "expression"
}
],
"items": [
{
"name": "text1",
"maxLength": 10
},
{
"name": "text2",
"maxLength": 15
}
]
}]
});

await takeElementScreenshot("question-text-remaining-character-counter.png", Selector(".sd-text__content"), t, comparer);

await t.pressKey("tab");

await takeElementScreenshot("question-comment-remaining-character-counter.png", Selector(".sd-comment__content"), t, comparer);

await t.pressKey("tab");
await takeElementScreenshot("question-multipletext-remaining-character-counter.png", Selector(".sd-multipletext__content"), t, comparer);
});
});

test("Remaining character counter matrixdynamic", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1280, 1100);
await initSurvey(framework, {
questions: [
{
"type": "matrixdynamic",
"name": "relatives",
"title": "Please enter all blood relatives you know",
"columns": [
{
"name": "relativeType",
"title": "Relative",
"cellType": "dropdown",
"isRequired": true,
"choices": [
"father",
"mother",
"brother",
"sister",
"son",
"daughter"
]
},
{
"name": "firstName",
"title": "First name",
"cellType": "text",
"isRequired": true,
"maxLength": 25
},
{
"name": "lastName",
"title": "Last name",
"cellType": "text",
"isRequired": true,
"maxLength": 25
}
],
"detailElements": [
{
"type": "radiogroup",
"name": "isalive",
"startWithNewLine": false,
"title": "Alive?",
"isRequired": true,
"choices": [
"Yes",
"No"
],
"colCount": 0
},
{
"type": "dropdown",
"name": "liveage",
"visibleIf": "{row.isalive} = 'Yes'",
"startWithNewLine": false,
"title": "Age",
"isRequired": true,
"choicesMin": 1,
"choicesMax": 115
},
{
"type": "dropdown",
"name": "deceasedage",
"visibleIf": "{row.isalive} = 'No'",
"startWithNewLine": false,
"title": "Deceased Age",
"isRequired": true,
"choices": [
{
"value": -1,
"text": "Unknown"
}
],
"choicesMin": 1,
"choicesMax": 115
},
{
"type": "radiogroup",
"name": "causeofdeathknown",
"visibleIf": "{row.isalive} = 'No'",
"startWithNewLine": false,
"title": "Cause of Death Known?",
"isRequired": true,
"choices": [
"Yes",
"No"
],
"colCount": 0
},
{
"type": "text",
"name": "causeofdeath",
"visibleIf": "{row.isalive} = 'No' and {row.causeofdeathknown} = 'Yes'",
"startWithNewLine": false,
"title": "Cause of Death",
"isRequired": true
}
],
"detailPanelMode": "underRow",
"rowCount": 1,
"addRowText": "Add a blood relative",
"removeRowText": "Remove the relative"
}]
});

await t.pressKey("tab tab");
await takeElementScreenshot("question-matrixdynamic-remaining-character-counter.png", Selector(".sd-matrixdynamic__content"), t, comparer);
});
});

test("Check question with indent", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await initSurvey(framework, {