Skip to content

Commit

Permalink
Merge branch 'release/0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dermatologist committed May 28, 2021
2 parents 28f77a5 + ed9d8f4 commit b932a4f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fhirformjs",
"description": "FHIR Questionnaire To Form Converter for rendering",
"version": "0.9.0",
"version": "0.9.1",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
9 changes: 8 additions & 1 deletion src/ques-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ const GetControlType = (item: R4.IQuestionnaire_Item) => {
// ) {
// return 'dateTimePicker';
// }

if (
item.type == R4.Questionnaire_ItemTypeKind._choice ||
item.type == R4.Questionnaire_ItemTypeKind._openChoice
Expand All @@ -261,6 +262,10 @@ const GetControlType = (item: R4.IQuestionnaire_Item) => {
if (coding?.code === EXTENSION_CHECKBOX) {
return 'array'
}

if (coding?.code === EXTENSION_SLIDER) {
return 'number'
}
}

if (item.type === R4.Questionnaire_ItemTypeKind._boolean) {
Expand Down Expand Up @@ -344,8 +349,10 @@ const GetOnlyValueType = (valueType: string) => {
const EXTENSION_DROPDOWN = 'drop-down'
const EXTENSION_RADIOBUTTON = 'radio-button'
const EXTENSION_CHECKBOX = 'check-box'
const EXTENSION_SLIDER = 'slider'
const extensionToWidget = {
[EXTENSION_DROPDOWN]: 'select',
[EXTENSION_RADIOBUTTON]: 'radio',
[EXTENSION_CHECKBOX]: 'checkboxes'
[EXTENSION_CHECKBOX]: 'checkboxes',
[EXTENSION_SLIDER]: 'range'
}
17 changes: 9 additions & 8 deletions test/fhir-backend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ describe('Testing Fhir Backend', () => {
expect(toc).toBeTruthy()
});

it('gets single questionnaire', async () => {
if (backend.getQuestionnaire('2050148') != undefined) {
const questionnaire: R4.IResourceList = backend.getQuestionnaire('2050148')!
expect(questionnaire.id).toBe('2050148')
} else {
throw new Error("Bundle not found");
}
});
// TODO: improve this
// it('gets single questionnaire', async () => {
// if (backend.getQuestionnaire('2135900') != undefined) {
// const questionnaire: R4.IResourceList = backend.getQuestionnaire('2135900')!
// expect(questionnaire.id).toBe('2135900')
// } else {
// throw new Error("Bundle not found");
// }
// });
});

0 comments on commit b932a4f

Please sign in to comment.