Skip to content

Commit

Permalink
Merge pull request aehrc#978 from aehrc/feature/item-initial
Browse files Browse the repository at this point in the history
Add support for item.initial for repeating groups
  • Loading branch information
fongsean authored Aug 29, 2024
2 parents 164cb82 + 2bf37e8 commit eb01245
Show file tree
Hide file tree
Showing 11 changed files with 983 additions and 134 deletions.
2 changes: 1 addition & 1 deletion apps/demo-renderer-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@aehrc/sdc-populate": "^2.3.1",
"@aehrc/smart-forms-renderer": "^0.38.3",
"@aehrc/smart-forms-renderer": "^0.38.4",
"@tanstack/react-query": "^4.36.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@aehrc/sdc-assemble": "^1.3.1",
"@aehrc/sdc-populate": "^2.3.1",
"@aehrc/smart-forms-renderer": "^0.38.3",
"@aehrc/smart-forms-renderer": "^0.38.4",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.11.5",
"@fontsource/material-icons": "^5.0.18",
Expand Down
2 changes: 1 addition & 1 deletion documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@aehrc/smart-forms-renderer": "^0.38.3",
"@aehrc/smart-forms-renderer": "^0.38.4",
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-live-codeblock": "^3.4.0",
Expand Down
56 changes: 3 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smart-forms-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aehrc/smart-forms-renderer",
"version": "0.38.3",
"version": "0.38.4",
"description": "FHIR Structured Data Captured (SDC) rendering engine for Smart Forms",
"main": "lib/index.js",
"scripts": {
Expand Down
34 changes: 34 additions & 0 deletions packages/smart-forms-renderer/src/tests/initial.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2024 Commonwealth Scientific and Industrial Research
* Organisation (CSIRO) ABN 41 687 119 230.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { expect, test } from '@jest/globals';
import { initialiseQuestionnaireResponse } from '../utils';
import { qInitialValueSample } from './test-data/initialValueSample';

test('item.initial is properly pre-filled into QuestionnaireResponse', () => {
const outputResponse = initialiseQuestionnaireResponse(qInitialValueSample);

expect(outputResponse?.item?.[0]).toBeTruthy();
expect(outputResponse?.item?.[0].item?.[0]).toBeTruthy();
expect(outputResponse?.item?.[0].item?.[0].item?.[0]).toBeTruthy();
expect(outputResponse?.item?.[0].item?.[0].item?.[0].item?.[0].answer?.[0]).toStrictEqual({
valueCoding: {
system: 'http://snomed.info/sct',
code: '373066001'
}
});
});
Loading

0 comments on commit eb01245

Please sign in to comment.