Skip to content

Commit

Permalink
fix wrappable rating items
Browse files Browse the repository at this point in the history
  • Loading branch information
novikov82 committed Nov 27, 2023
1 parent 69a07ff commit 20f8fcc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/defaultV2-theme/blocks/sd-rating.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
&.sd-rating--wrappable {
fieldset {
flex-wrap: wrap;
min-width: 0;
}
}
}
Expand Down Expand Up @@ -318,22 +319,20 @@ legend+sv-ng-rating-item+.sd-rating__item-smiley {
}
}

.sd-rating__item .sd-rating__item-text {
margin: 0 2px;
}
.sd-rating__item-text.sd-rating__item-text {
font-family: $font-editorfont-family;
font-weight: $font-editorfont-weight;
color: $font-questiontitle-color;
font-size: $font-editorfont-size;
line-height: multiply(1.5, $font-editorfont-size);
display: inline-block;
border: 2px solid transparent;
box-sizing: border-box;

&.sd-rating__min-text,
&.sd-rating__max-text {
margin-top: calcSize(1.25);
margin-bottom: calcSize(1.25);
border: 2px solid transparent;
color: $font-questiondescription-color;
}

Expand All @@ -356,13 +355,23 @@ legend+sv-ng-rating-item+.sd-rating__item-smiley {
min-width: calcSize(3);
}
}
.sd-rating--wrappable .sd-rating__item-text {
max-width: 100%;

.sv-string-viewer {
max-width: 100%;
text-overflow: ellipsis;
overflow: hidden;
display: block
}
}
.sd-rating__item:focus-within .sd-rating__item-text.sd-rating__item-text {
margin: 0;
border: none;
}
.sd-rating__item--selected .sd-rating__item-text.sd-rating__item-text {
color: $primary-foreground;
font-weight: inherit;
margin: 0;
border: none;
}

.sd-rating-dropdown-item {
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions visualRegressionTests/tests/defaultV2/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,45 @@ frameworks.forEach(framework => {
});
});

test("Check rating question - long items, button mode", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "rating",
"name": "question1",
"autoGenerate": false,
"displayMode": "buttons",
"rateValues": [
1,
{
"value": 2,
"text": "item 2"
},
{
"value": 3,
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
},
4,
5
]
}
]
}
]
});

const questionRoot = Selector(".sd-question");
await resetFocusToBody();
await takeElementScreenshot("question-rating-long-items-buttons.png", questionRoot, t, comparer);
});
});

test("Check big rating in panel", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1000, 1080);
Expand Down

0 comments on commit 20f8fcc

Please sign in to comment.