diff --git a/src/document/DocumentProgramFormatter.js b/src/document/DocumentProgramFormatter.js index 6c20fd5..9e73737 100644 --- a/src/document/DocumentProgramFormatter.js +++ b/src/document/DocumentProgramFormatter.js @@ -177,11 +177,13 @@ module.exports = Class( 'DocumentProgramFormatter', const field_value = bucket.getDataByName( field_id ); const field_label = this._program.fields[ field_id ].label; + const field_type = this._program.fields[ field_id ].type; const question = {}; question.id = field_id; question.label = field_label; question.value = field_value; + question.type = field_type; question.applicable = this._getApplicable( classes, field_id, diff --git a/test/document/DocumentProgramFormatterTest.js b/test/document/DocumentProgramFormatterTest.js index 86aec98..5adc649 100644 --- a/test/document/DocumentProgramFormatterTest.js +++ b/test/document/DocumentProgramFormatterTest.js @@ -64,18 +64,21 @@ describe( 'DocumentProgramFormatter', () => id: "sell_alcohol", label: "Does the insured sell alcohol?", value: [ "foo", "" ], + type: "noyes", applicable: [ true, false ] }, { id: "serve_alcohol", label: "Does the insured serve alcohol?", value: [ "" ], + type: "noyes", applicable: [ false ] }, { id: "field_no_vis", label: "Does this field have a visibility class?", value: [ "true" ], + type: "noyes", applicable: [ true ] } ] @@ -87,18 +90,21 @@ describe( 'DocumentProgramFormatter', () => id: "sell_ecigs", label: "Does the insured sell e-cigarettes?", value: [ "", "bar" ], + type: "noyes", applicable: [ false, true ] }, { id: "dist_ecigs", label: "Does the Insured distribute Electronic Cigarette products?", value: [ "" ], + type: "noyes", applicable: [ false ] }, { id: "field_no_array", label: "Does this field have an array for the visibility class?", value: [ "bar" ], + type: "noyes", applicable: [ true ] } ]