Skip to content

Commit

Permalink
fix: ensure html content variables are included in getSchemaVariables
Browse files Browse the repository at this point in the history
Closes #1047
  • Loading branch information
Skaiir committed Feb 15, 2024
1 parent 4226bd2 commit 6a19daa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/form-js-viewer/src/util/getSchemaVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const TEMPLATE_PROPERTIES = [
'label',
'source',
'text',
'content',
'url'
];

Expand Down
10 changes: 10 additions & 0 deletions packages/form-js-viewer/test/spec/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../../form-json-schema/resources/schema.json",
"type": "default",
"components": [
{
"type": "html",
"content": "<h1>{{heading}}</h1>\n<p>{{description}}</p>"
}
]
}
13 changes: 13 additions & 0 deletions packages/form-js-viewer/test/spec/util/GetSchemaVariables.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import validateSchema from '../validate.json';
import groupsSchema from '../groups.json';
import shipsExampleSchema from '../ships-example.json';
import iframesSchema from '../iframes.json';
import htmlSchema from '../html.json';

describe('util/getSchemaVariables', () => {

Expand Down Expand Up @@ -199,6 +200,18 @@ describe('util/getSchemaVariables', () => {
});


it('should include variables in html', () => {

const variables = getSchemaVariables(htmlSchema);

expect(variables).to.eql([
'heading',
'description'
]);

});


it('should include variables in ships example', () => {

const variables = getSchemaVariables(shipsExampleSchema);
Expand Down

0 comments on commit 6a19daa

Please sign in to comment.