Skip to content

Commit

Permalink
fix(form): showing of field value in case of calculated questions
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria Vatasoiu authored and luytena committed Nov 28, 2024
1 parent 8e8a0ff commit 8173db0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/form/addon/components/cf-field-value.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
{{else if (and @field.answer.value @field.question.useNumberSeparatorWidget)}}
{{format-number @field.answer.value maximumFractionDigits=20}}
{{else}}
{{@field.answer.value}}
{{@field.value}}
{{/if}}
17 changes: 17 additions & 0 deletions packages/form/tests/integration/components/cf-field-value-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,30 @@ module("Integration | Component | cf-field-value", function (hooks) {
answer: {
value: "foo",
},
value: "foo",
};

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

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

test("it renders calculated float questions", async function (assert) {
this.field = {
questionType: "CalculatedFloatQuestion",
question: {
raw: {
__typename: "CalculatedFloatQuestion",
},
},
value: 1111111.111111,
};

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

assert.dom(this.element).hasText("1111111.111111");
});

test("it renders file questions", async function (assert) {
const file = this.server.create("file");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ module("Integration | Component | cf-field/input/table", function (hooks) {
slug: "first-name",
},
answer: { value: "Max" },
value: "Max",
},
{
question: {
raw: { __typename: "TextQuestion" },
slug: "last-name",
},
answer: { value: "Muster" },
value: "Muster",
},
],
},
Expand Down

0 comments on commit 8173db0

Please sign in to comment.