Skip to content

Commit 8173db0

Browse files
Maria Vatasoiuluytena
Maria Vatasoiu
authored andcommitted
fix(form): showing of field value in case of calculated questions
1 parent 8e8a0ff commit 8173db0

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Diff for: packages/form/addon/components/cf-field-value.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
{{else if (and @field.answer.value @field.question.useNumberSeparatorWidget)}}
2525
{{format-number @field.answer.value maximumFractionDigits=20}}
2626
{{else}}
27-
{{@field.answer.value}}
27+
{{@field.value}}
2828
{{/if}}

Diff for: packages/form/tests/integration/components/cf-field-value-test.js

+17
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,30 @@ module("Integration | Component | cf-field-value", function (hooks) {
106106
answer: {
107107
value: "foo",
108108
},
109+
value: "foo",
109110
};
110111

111112
await render(hbs`<CfFieldValue @field={{this.field}} />`);
112113

113114
assert.dom(this.element).hasText("foo");
114115
});
115116

117+
test("it renders calculated float questions", async function (assert) {
118+
this.field = {
119+
questionType: "CalculatedFloatQuestion",
120+
question: {
121+
raw: {
122+
__typename: "CalculatedFloatQuestion",
123+
},
124+
},
125+
value: 1111111.111111,
126+
};
127+
128+
await render(hbs`<CfFieldValue @field={{this.field}} />`);
129+
130+
assert.dom(this.element).hasText("1111111.111111");
131+
});
132+
116133
test("it renders file questions", async function (assert) {
117134
const file = this.server.create("file");
118135

Diff for: packages/form/tests/integration/components/cf-field/input/table-test.js

+2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ module("Integration | Component | cf-field/input/table", function (hooks) {
2323
slug: "first-name",
2424
},
2525
answer: { value: "Max" },
26+
value: "Max",
2627
},
2728
{
2829
question: {
2930
raw: { __typename: "TextQuestion" },
3031
slug: "last-name",
3132
},
3233
answer: { value: "Muster" },
34+
value: "Muster",
3335
},
3436
],
3537
},

0 commit comments

Comments
 (0)