Skip to content

Commit

Permalink
created test for FIO-8727
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenMasterJacob20011 committed Dec 5, 2024
1 parent 3ff37eb commit 20e3aaa
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
9 changes: 8 additions & 1 deletion test/unit/Panel.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import panelEditForm from '../../src/components/panel/Panel.form';
import { Formio } from '../../src/Formio';
import {
comp1,
comp2
comp2,
comp3
} from './fixtures/panel';

describe('Panel Component', () => {
Expand Down Expand Up @@ -68,6 +69,12 @@ describe('Panel Component', () => {
}).catch(done);
});

it('Should show its label in DataGrid when "Hide Label" is set to true and "Show Label in DataGrid" is set to true', () => {
return Formio.createForm(document.createElement('div'), comp3, {}).then((form) => {
assert(form.getComponent('panel').element.querySelector('.card-title'), 'Panel should display its label');
});
});

describe('Edit Form', () => {
it('should include components for important settings', () => {
const components = flattenComponents(panelEditForm().components);
Expand Down
33 changes: 33 additions & 0 deletions test/unit/fixtures/panel/comp3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export default {
components: [
{
"label": "Data Grid",
"reorder": false,
"addAnotherPosition": "bottom",
"layoutFixed": false,
"enableRowGroups": false,
"initEmpty": false,
"tableView": false,
"defaultValue": [
{}
],
"validateWhenHidden": false,
"key": "dataGrid",
"type": "datagrid",
"input": true,
"components": [
{
"collapsible": false,
"hideLabel": true,
"dataGridLabel": true,
"key": "panel",
"type": "panel",
"label": "Panel",
"input": false,
"tableView": false,
"components": []
}
]
}
]
}
3 changes: 2 additions & 1 deletion test/unit/fixtures/panel/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import comp1 from './comp1';
import comp2 from './comp2';
export { comp1, comp2 };
import comp3 from './comp3';
export { comp1, comp2, comp3 };

0 comments on commit 20e3aaa

Please sign in to comment.