Skip to content

Commit

Permalink
FIO-8727: created test for FIO-8727 (#5937)
Browse files Browse the repository at this point in the history
* created test for FIO-8727

* FIO-8727 - update with bootstrap changes

* update renders

---------

Co-authored-by: lane-formio <lane@form.io>
  • Loading branch information
ZenMasterJacob20011 and lane-formio authored Dec 18, 2024
1 parent 0d6767f commit c7bfc28
Show file tree
Hide file tree
Showing 12 changed files with 1,765 additions and 1,491 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"homepage": "https://github.com/formio/formio.js#readme",
"dependencies": {
"@formio/bootstrap": "3.0.0-dev.111.ae7f187",
"@formio/bootstrap": "3.0.0-dev.119.c4cb299",
"@formio/choices.js": "^10.2.1",
"@formio/core": "2.1.0-dev.193.68cf8c3",
"@formio/text-mask-addons": "3.8.0-formio.4",
Expand Down
4 changes: 2 additions & 2 deletions test/renders/component-bootstrap-datagrid-multiple.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
">
<tbody ref="datagrid-dataGrid-tbody" data-key="datagrid-dataGrid">
<tr ref="datagrid-dataGrid-row">
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
4 changes: 2 additions & 2 deletions test/renders/component-bootstrap-datagrid-required.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
">
<tbody ref="datagrid-dataGrid-tbody" data-key="datagrid-dataGrid">
<tr ref="datagrid-dataGrid-row">
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
4 changes: 2 additions & 2 deletions test/renders/component-bootstrap-datagrid.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
">
<tbody ref="datagrid-dataGrid-tbody" data-key="datagrid-dataGrid">
<tr ref="datagrid-dataGrid-row">
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<div ref="messageContainer" class="formio-errors invalid-feedback"></div>
</div>
</td>
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
8 changes: 4 additions & 4 deletions test/renders/form-bootstrap-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@
<div ref="messageContainer" class="formio-errors invalid-feedback"></div>
</div>
</td>
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid2-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid2-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down Expand Up @@ -253,8 +253,8 @@
<div ref="messageContainer" class="formio-errors invalid-feedback"></div>
</div>
</td>
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-conditionalDataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-conditionalDataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
4 changes: 2 additions & 2 deletions test/renders/form-bootstrap-defaults.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@
<div ref="messageContainer" class="formio-errors invalid-feedback"></div>
</div>
</td>
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
4 changes: 2 additions & 2 deletions test/renders/form-bootstrap-formWithCustomFormatDate.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
<div ref="messageContainer" class="formio-errors invalid-feedback"></div>
</div>
</td>
<td class="col-1">
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove">
<td>
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="datagrid-dataGrid-removeRow" tabindex="0" aria-label="remove" style="display: block; margin: 0 auto">
<i class="fa fa-remove-circle bi bi-x-circle"></i>
</button>
</td>
Expand Down
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('dataGrid[0]').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 };
Loading

0 comments on commit c7bfc28

Please sign in to comment.