diff --git a/packages/survey-angular-ui/src/questions/boolean.component.html b/packages/survey-angular-ui/src/questions/boolean.component.html index 320bc33658..b6866e966b 100644 --- a/packages/survey-angular-ui/src/questions/boolean.component.html +++ b/packages/survey-angular-ui/src/questions/boolean.component.html @@ -15,7 +15,7 @@
- +
diff --git a/packages/survey-vue3-ui/src/BooleanSwitch.vue b/packages/survey-vue3-ui/src/BooleanSwitch.vue index e54cd08357..15386257b3 100644 --- a/packages/survey-vue3-ui/src/BooleanSwitch.vue +++ b/packages/survey-vue3-ui/src/BooleanSwitch.vue @@ -35,7 +35,7 @@ :class="question.cssClasses.switch" v-on:click="onSwitchClick($event)" > - +
- + diff --git a/src/question_boolean.ts b/src/question_boolean.ts index 2cb1e78d7e..475bbe8cb6 100644 --- a/src/question_boolean.ts +++ b/src/question_boolean.ts @@ -87,26 +87,6 @@ export class QuestionBooleanModel extends Question { return this.isLabelRendered ? this.ariaTitleId : null; } - @property() leftAnswerElement: HTMLElement; - @property() thumbMargin: string; - - public updateThumbMargin(): void { - if (!this.isIndeterminate && this.leftAnswerElement) { - if (!this.swapOrder && this.value === this.getValueTrue() || this.swapOrder && this.value === this.getValueFalse()) { - const el = this.leftAnswerElement; - setTimeout(() => { - this.thumbMargin = el.clientWidth + (this.swapOrder ? 4 : 2) + "px"; - }, 50); - } - } - this.thumbMargin = undefined; - } - - public afterRender(el: HTMLElement) { - super.afterRender(el); - this.leftAnswerElement = el.querySelectorAll("." + this.cssClasses.sliderGhost)[0] as HTMLElement; - this.updateThumbMargin(); - } public beforeDestroyQuestionElement(el: HTMLElement): void { super.beforeDestroyQuestionElement(el); this.leftAnswerElement = undefined; @@ -256,12 +236,10 @@ export class QuestionBooleanModel extends Question { updateValueFromSurvey(newValue: any, clearData: boolean = false): void { super.updateValueFromSurvey(newValue, clearData); - this.updateThumbMargin(); } protected onValueChanged(): void { super.onValueChanged(); - this.updateThumbMargin(); } public get svgIcon(): string { diff --git a/src/react/boolean.tsx b/src/react/boolean.tsx index 360e61e12a..9dea33db1a 100644 --- a/src/react/boolean.tsx +++ b/src/react/boolean.tsx @@ -88,7 +88,7 @@ export class SurveyQuestionBoolean extends SurveyQuestionElementBase {
- + { this.question.isDeterminated && cssClasses.sliderText ? {this.renderLocString(this.question.getCheckedLabel())} diff --git a/src/vue/boolean-switch.vue b/src/vue/boolean-switch.vue index 14630f7131..9826904e33 100644 --- a/src/vue/boolean-switch.vue +++ b/src/vue/boolean-switch.vue @@ -32,7 +32,7 @@ :class="question.cssClasses.switch" v-on:click="onSwitchClick($event)" > - + diff --git a/tests/questionBooleanTests.ts b/tests/questionBooleanTests.ts index 41e8af78d3..5af3826791 100644 --- a/tests/questionBooleanTests.ts +++ b/tests/questionBooleanTests.ts @@ -281,42 +281,3 @@ QUnit.test("Boolean in matrix dynamic", function (assert) { q.visibleRows[0].cells[0].value = "abc"; assert.deepEqual(q.value, [{ col1: "abc" }], "there is not boolean value"); }); - -QUnit.test("Invoke updateThumbMargin on value changed", function (assert) { - var survey = new SurveyModel({ - elements: [ - { - "type": "boolean", - "name": "question1", - "valueTrue": "yes", - "valueFalse": "no" - }, - { - "type": "radiogroup", - "name": "question1", - "choices": [ - { - "value": "yes", - "text": "Yes" - }, - { - "value": "no", - "text": "No" - } - ] - } - ] - }); - const q = survey.getAllQuestions()[0]; - const radio = survey.getAllQuestions()[1]; - const c = { counter: 0 }; - q.updateThumbMargin = () => c.counter++; - - assert.equal(c.counter, 0, "Initial"); - q.value = "yes"; - assert.equal(c.counter, 1, "Set value to question"); - radio.value = "no"; - assert.equal(c.counter, 2, "Set value to another question"); - survey.data = { question1: "yes" }; - assert.equal(c.counter, 4, "Set value to survey"); -}); diff --git a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-disabled.png b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-disabled.png index 0b4ff68274..ecf82e38c5 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-disabled.png and b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-disabled.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-hovered.png b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-hovered.png index d1174e6b66..174b2774b3 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-hovered.png and b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked-hovered.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked.png b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked.png index c4b1bab04d..7a8956aa8e 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked.png and b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-exch-clicked.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-word-wrap.png b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-word-wrap.png index ef10405d76..fc8a522aba 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/boolean-question-word-wrap.png and b/visualRegressionTests/tests/defaultV2/etalons/boolean-question-word-wrap.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-right.png b/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-right.png index ba85c9dcf1..07f0883627 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-right.png and b/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-right.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-swapped-no.png b/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-swapped-no.png index c3c3a892d9..875ea39877 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-swapped-no.png and b/visualRegressionTests/tests/defaultV2/etalons/boolean-switch-thumb-swapped-no.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/complex-question.png b/visualRegressionTests/tests/defaultV2/etalons/complex-question.png index ea79ed4351..3655ff99a5 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/complex-question.png and b/visualRegressionTests/tests/defaultV2/etalons/complex-question.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/preview-boolean.png b/visualRegressionTests/tests/defaultV2/etalons/preview-boolean.png index f3e37c453e..66867dc59f 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/preview-boolean.png and b/visualRegressionTests/tests/defaultV2/etalons/preview-boolean.png differ diff --git a/visualRegressionTests/tests/defaultV2/etalons/readonly-boolean.png b/visualRegressionTests/tests/defaultV2/etalons/readonly-boolean.png index 7e99d23eb5..fce65f3b1f 100644 Binary files a/visualRegressionTests/tests/defaultV2/etalons/readonly-boolean.png and b/visualRegressionTests/tests/defaultV2/etalons/readonly-boolean.png differ