Skip to content

Commit

Permalink
Merge pull request #7165 from surveyjs/issue/7141-expression-title-lo…
Browse files Browse the repository at this point in the history
…cation-left

Expression titleLocation left Fixes #7141
  • Loading branch information
OlgaLarina authored Oct 17, 2023
2 parents cc8092b + dc1c6b1 commit 3f73721
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/survey-vue3-ui/src/Expression.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="question.cssClasses.text" ref="root">
<div :class="question.cssClasses.root" ref="root">
{{ question.formatedValue }}
</div>
</template>
Expand Down
4 changes: 4 additions & 0 deletions src/defaultV2-theme/blocks/sd-expression.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
color: $font-questiontitle-color;
font-size: calcFontSize(1);
}
.sd-question__content--left .sd-expression {
line-height: calcSize(3);
margin-top: calcSize(1.5);
}
2 changes: 1 addition & 1 deletion src/vue/expression.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="question.cssClasses.text">{{ question.formatedValue }}</div>
<div :class="question.cssClasses.root">{{ question.formatedValue }}</div>
</template>

<script lang="ts">
Expand Down
1 change: 1 addition & 0 deletions tests/markup/etalon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * from "./etalon_matrixdynamic";
export * from "./etalon_question";
export * from "./etalon_survey";
export * from "./etalon_signaturepad";
export * from "./etalon_expression";
export { markupTests } from "./helper";

registerMarkupTests([
Expand Down
21 changes: 21 additions & 0 deletions tests/markup/etalon_expression.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { StylesManager } from "survey-core";
import { registerMarkupTest } from "./helper";

registerMarkupTest(
{
name: "Test Expression question markup",
json: {
questions: [
{
name: "name",
type: "expression",
expression: "123",
titleLocation: "hidden"
}
]
},
snapshot: "expression",
removeIds: true,
before: () => StylesManager.applyTheme("defaultV2"),
after: () => StylesManager.applyTheme("default"),
});
1 change: 1 addition & 0 deletions tests/markup/snapshots/expression.snap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="sd-expression">123</div>
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.
49 changes: 49 additions & 0 deletions visualRegressionTests/tests/defaultV2/expression.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Selector, ClientFunction } from "testcafe";
import { url, frameworks, initSurvey, setOptions, url_test, takeElementScreenshot, wrapVisualTest, resetFocusToBody } from "../../helper";

const title = "Expression Screenshot";

fixture`${title}`.page`${url}`.beforeEach(async (t) => {

});

const applyTheme = ClientFunction(theme => {
(<any>window).Survey.StylesManager.applyTheme(theme);
});

const theme = "defaultV2";

frameworks.forEach(framework => {
fixture`${framework} ${title} ${theme}`
.page`${url_test}${theme}/${framework}`.beforeEach(async t => {
await applyTheme(theme);
});

test("Check expression question", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
questions: [
{
"type": "expression",
"name": "q1",
"title": "Question1",
"titleLocation": "left",
"expression": "123"
},
{
"type": "expression",
"name": "q2",
"title": "Question2",
"expression": "123"
},
],
"focusFirstQuestionAutomatic": true
});
await takeElementScreenshot("expression-title-left.png", Selector(".sd-question[data-name=q1]"), t, comparer);
await takeElementScreenshot("expression-title-top.png", Selector(".sd-question[data-name=q2]"), t, comparer);
});
});

});

0 comments on commit 3f73721

Please sign in to comment.