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 committed Nov 28, 2024
1 parent 8e8a0ff commit fe4d49f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/form/addon/components/cf-field-value.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
{{/each}}
{{else if (and @field.answer.value @field.question.useNumberSeparatorWidget)}}
{{format-number @field.answer.value maximumFractionDigits=20}}
{{else if (has-question-type @field.question "calculated_float")}}
{{@field.value}}
{{else}}
{{@field.answer.value}}
{{/if}}
16 changes: 16 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 @@ -113,6 +113,22 @@ module("Integration | Component | cf-field-value", function (hooks) {
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

0 comments on commit fe4d49f

Please sign in to comment.