From 606e45edb3c998c9991e6a0984a392f2c9b08486 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Mon, 8 Nov 2021 17:59:33 -0400 Subject: [PATCH 1/6] Tests for Select List + Mustache --- .../e2e/fixtures/select_list_array_data.json | 244 ++++++++++++++++ tests/e2e/fixtures/select_list_mustache.json | 260 ++++++++++++++++++ .../select_list_mustache_custom_key.json | 260 ++++++++++++++++++ .../select_list_mustache_request_data.json | 242 ++++++++++++++++ tests/e2e/specs/SelectListMustache.spec.js | 176 ++++++++++++ 5 files changed, 1182 insertions(+) create mode 100644 tests/e2e/fixtures/select_list_array_data.json create mode 100644 tests/e2e/fixtures/select_list_mustache.json create mode 100644 tests/e2e/fixtures/select_list_mustache_custom_key.json create mode 100644 tests/e2e/fixtures/select_list_mustache_request_data.json create mode 100644 tests/e2e/specs/SelectListMustache.spec.js diff --git a/tests/e2e/fixtures/select_list_array_data.json b/tests/e2e/fixtures/select_list_array_data.json new file mode 100644 index 000000000..56f8b5a06 --- /dev/null +++ b/tests/e2e/fixtures/select_list_array_data.json @@ -0,0 +1,244 @@ +{ + "type": "screen_package", + "version": "2", + "screens": [ + { + "id": 5, + "screen_category_id": "1", + "title": "select list array", + "description": "select list array", + "type": "FORM", + "config": [ + { + "name": "select list array", + "items": [ + { + "label": "Select List", + "config": { + "icon": "fas fa-angle-double-down", + "name": "form_select_list_1", + "label": "New Select List", + "helper": null, + "options": { + "key": "value", + "value": "content", + "dataName": "response", + "jsonData": "[{\"content\":\"one\",\"value\":\"1\"},{\"content\":\"two\",\"value\":\"2\"}]", + "renderAs": "dropdown", + "editIndex": null, + "pmqlQuery": null, + "dataSource": "provideData", + "optionsList": [ + { "value": "1", "content": "one" }, + { "value": "2", "content": "two" } + ], + "removeIndex": null, + "showRenderAs": true, + "showJsonEditor": false, + "showOptionCard": false, + "selectedOptions": [], + "allowMultiSelect": false, + "showRemoveWarning": false, + "valueTypeReturned": "single" + }, + "readonly": false, + "validation": [], + "placeholder": null, + "rootElement": "response", + "dataSourceUrl": null, + "dataSourceEndpoint": null + }, + "component": "FormSelectList", + "inspector": [ + { + "type": "FormInput", + "field": "name", + "config": { + "name": "Variable Name", + "label": "Variable Name", + "helper": "A variable name is a symbolic name to reference information.", + "validation": "regex:/^(?:[A-Za-z])(?:[0-9A-Z_a-z])*(?:\\.[0-9A-Z_a-z]+)*$/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super" + } + }, + { + "type": "FormInput", + "field": "label", + "config": { + "label": "Label", + "helper": "The label describes the field's name" + } + }, + { + "type": "FormInput", + "field": "placeholder", + "config": { + "label": "Placeholder Text", + "helper": "The placeholder is what is shown in the field when no value is provided yet" + } + }, + { + "type": "ValidationSelect", + "field": "validation", + "config": { + "label": "Validation Rules", + "helper": "The validation rules needed for this field" + } + }, + { + "type": "FormInput", + "field": "helper", + "config": { + "label": "Helper Text", + "helper": "Help text is meant to provide additional guidance on the field's value" + } + }, + { + "type": "OptionsList", + "field": "options", + "config": { "label": null, "helper": null } + }, + { + "type": "ColorSelect", + "field": "color", + "config": { + "label": "Text Color", + "helper": "Set the element's text color", + "options": [ + { "value": "text-primary", "content": "primary" }, + { "value": "text-secondary", "content": "secondary" }, + { "value": "text-success", "content": "success" }, + { "value": "text-danger", "content": "danger" }, + { "value": "text-warning", "content": "warning" }, + { "value": "text-info", "content": "info" }, + { "value": "text-light", "content": "light" }, + { "value": "text-dark", "content": "dark" } + ] + } + }, + { + "type": "ColorSelect", + "field": "bgcolor", + "config": { + "label": "Background Color", + "helper": "Set the element's background color", + "options": [ + { "value": "alert alert-primary", "content": "primary" }, + { + "value": "alert alert-secondary", + "content": "secondary" + }, + { "value": "alert alert-success", "content": "success" }, + { "value": "alert alert-danger", "content": "danger" }, + { "value": "alert alert-warning", "content": "warning" }, + { "value": "alert alert-info", "content": "info" }, + { "value": "alert alert-light", "content": "light" }, + { "value": "alert alert-dark", "content": "dark" } + ] + } + }, + { + "type": { + "props": ["value", "helper"], + "watch": { "value": { "immediate": true } }, + "methods": [], + "_scopeId": "data-v-7c18055b", + "computed": { "effectiveValue": [] }, + "_compiled": true, + "components": { + "MonacoEditor": { + "name": "monaco-editor", + "_Ctor": [], + "props": { "amdRequire": [] }, + "extends": { + "name": "MonacoEditor", + "model": { "event": "change" }, + "props": { + "theme": { "default": "vs" }, + "value": { "required": true }, + "options": [], + "language": [], + "original": [], + "amdRequire": [], + "diffEditor": { "default": false } + }, + "watch": { + "options": { "deep": true, "user": true } + }, + "methods": [] + }, + "methods": [] + } + }, + "staticRenderFns": [] + }, + "field": "defaultValue", + "config": { + "label": "Default Value", + "helper": "The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed." + } + }, + { + "type": "FormCheckbox", + "field": "readonly", + "config": { "label": "Read Only", "helper": null } + }, + { + "type": "FormInput", + "field": "conditionalHide", + "config": { + "label": "Visibility Rule", + "helper": "This control is hidden until this expression is true" + } + }, + { + "type": "FormInput", + "field": "customFormatter", + "config": { + "label": "Custom Format String", + "helper": "Use the Mask Pattern format
Date ##/##/####
SSN ###-##-####
Phone (###) ###-####", + "validation": null + } + }, + { + "type": "FormInput", + "field": "customCssSelector", + "config": { + "label": "CSS Selector Name", + "helper": "Use this in your custom css rules", + "validation": "regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]" + } + } + ], + "editor-control": "FormSelectList", + "editor-component": "FormSelectList" + } + ] + } + ], + "computed": [], + "custom_css": null, + "created_at": "2021-11-08T13:20:07-08:00", + "updated_at": "2021-11-08T13:20:39-08:00", + "status": "ACTIVE", + "key": null, + "watchers": [], + "categories": [ + { + "id": 1, + "name": "Uncategorized", + "status": "ACTIVE", + "is_system": 0, + "created_at": "2021-11-08T10:25:46-08:00", + "updated_at": "2021-11-08T10:25:46-08:00", + "pivot": { + "assignable_id": 5, + "category_id": 1, + "category_type": "ProcessMaker\\Models\\ScreenCategory" + } + } + ] + } + ], + "screen_categories": [], + "scripts": [] +} diff --git a/tests/e2e/fixtures/select_list_mustache.json b/tests/e2e/fixtures/select_list_mustache.json new file mode 100644 index 000000000..704720178 --- /dev/null +++ b/tests/e2e/fixtures/select_list_mustache.json @@ -0,0 +1,260 @@ +{ + "type": "screen_package", + "version": "2", + "screens": [ + { + "id": 4, + "screen_category_id": "1", + "title": "test select list pmql", + "description": "test select list pmql", + "type": "FORM", + "config": [ + { + "name": "test select list pmql", + "items": [ + { + "label": "Select List", + "config": { + "icon": "fas fa-angle-double-down", + "name": "form_select_list_1", + "label": "New Select List", + "helper": null, + "options": { + "key": "", + "value": "id: {{ data.id }}", + "dataName": "response.data", + "jsonData": null, + "renderAs": "dropdown", + "editIndex": null, + "pmqlQuery": null, + "dataSource": "dataConnector", + "optionsList": [], + "removeIndex": null, + "showRenderAs": true, + "showJsonEditor": false, + "showOptionCard": false, + "selectedOptions": [], + "allowMultiSelect": false, + "selectedEndPoint": "ListAll", + "showRemoveWarning": false, + "valueTypeReturned": "object", + "selectedDataSource": 2 + }, + "readonly": false, + "validation": [], + "placeholder": null, + "rootElement": "response", + "dataSourceUrl": null, + "dataSourceEndpoint": null + }, + "component": "FormSelectList", + "inspector": [ + { + "type": "FormInput", + "field": "name", + "config": { + "name": "Variable Name", + "label": "Variable Name", + "helper": "A variable name is a symbolic name to reference information.", + "validation": "regex:/^(?:[A-Za-z])(?:[0-9A-Z_.a-z])*[^.]$/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super,true,false" + } + }, + { + "type": "FormInput", + "field": "label", + "config": { + "label": "Label", + "helper": "The label describes the field's name" + } + }, + { + "type": "FormInput", + "field": "placeholder", + "config": { + "label": "Placeholder Text", + "helper": "The placeholder is what is shown in the field when no value is provided yet" + } + }, + { + "type": "ValidationSelect", + "field": "validation", + "config": { + "label": "Validation Rules", + "helper": "The validation rules needed for this field" + } + }, + { + "type": "FormInput", + "field": "helper", + "config": { + "label": "Helper Text", + "helper": "Help text is meant to provide additional guidance on the field's value" + } + }, + { + "type": "OptionsList", + "field": "options", + "config": { "label": null, "helper": null } + }, + { + "type": "ColorSelect", + "field": "color", + "config": { + "label": "Text Color", + "helper": "Set the element's text color", + "options": [ + { "value": "text-primary", "content": "primary" }, + { "value": "text-secondary", "content": "secondary" }, + { "value": "text-success", "content": "success" }, + { "value": "text-danger", "content": "danger" }, + { "value": "text-warning", "content": "warning" }, + { "value": "text-info", "content": "info" }, + { "value": "text-light", "content": "light" }, + { "value": "text-dark", "content": "dark" } + ] + } + }, + { + "type": "ColorSelect", + "field": "bgcolor", + "config": { + "label": "Background Color", + "helper": "Set the element's background color", + "options": [ + { "value": "alert alert-primary", "content": "primary" }, + { + "value": "alert alert-secondary", + "content": "secondary" + }, + { "value": "alert alert-success", "content": "success" }, + { "value": "alert alert-danger", "content": "danger" }, + { "value": "alert alert-warning", "content": "warning" }, + { "value": "alert alert-info", "content": "info" }, + { "value": "alert alert-light", "content": "light" }, + { "value": "alert alert-dark", "content": "dark" } + ] + } + }, + { + "type": { + "props": ["value", "helper"], + "watch": { "value": { "immediate": true } }, + "methods": [], + "_scopeId": "data-v-172d71e1", + "computed": { "effectiveValue": [] }, + "_compiled": true, + "components": { + "MonacoEditor": { + "name": "monaco-editor", + "_Ctor": [], + "props": { "amdRequire": [] }, + "extends": { + "name": "MonacoEditor", + "model": { "event": "change" }, + "props": { + "theme": { "default": "vs" }, + "value": { "required": true }, + "options": [], + "language": [], + "original": [], + "amdRequire": [], + "diffEditor": { "default": false } + }, + "watch": { + "options": { "deep": true, "user": true } + }, + "methods": [] + }, + "methods": [] + } + }, + "staticRenderFns": [] + }, + "field": "defaultValue", + "config": { + "label": "Default Value", + "helper": "The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed." + } + }, + { + "type": "FormCheckbox", + "field": "readonly", + "config": { "label": "Read Only", "helper": null } + }, + { + "type": "FormInput", + "field": "conditionalHide", + "config": { + "label": "Visibility Rule", + "helper": "This control is hidden until this expression is true" + } + }, + { + "type": "FormInput", + "field": "customFormatter", + "config": { + "label": "Custom Format String", + "helper": "Use the Mask Pattern format
Date ##/##/####
SSN ###-##-####
Phone (###) ###-####", + "validation": null + } + }, + { + "type": "FormInput", + "field": "customCssSelector", + "config": { + "label": "CSS Selector Name", + "helper": "Use this in your custom css rules", + "validation": "regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]" + } + }, + { + "type": "FormInput", + "field": "ariaLabel", + "config": { + "label": "Aria Label", + "helper": "Attribute designed to help assistive technology (e.g. screen readers) attach a label" + } + }, + { + "type": "FormInput", + "field": "tabindex", + "config": { + "label": "Tab Order", + "helper": "Order in which a user will move focus from one control to another by pressing the Tab key", + "validation": "regex: [0-9]*" + } + } + ], + "editor-control": "FormSelectList", + "editor-component": "FormSelectList" + } + ] + } + ], + "computed": [], + "custom_css": null, + "created_at": "2021-11-08T10:31:29-08:00", + "updated_at": "2021-11-08T10:38:21-08:00", + "status": "ACTIVE", + "key": null, + "watchers": [], + "categories": [ + { + "id": 1, + "name": "Uncategorized", + "status": "ACTIVE", + "is_system": 0, + "created_at": "2021-11-08T10:25:46-08:00", + "updated_at": "2021-11-08T10:25:46-08:00", + "pivot": { + "assignable_id": 4, + "category_id": 1, + "category_type": "ProcessMaker\\Models\\ScreenCategory" + } + } + ] + } + ], + "screen_categories": [], + "scripts": [] +} diff --git a/tests/e2e/fixtures/select_list_mustache_custom_key.json b/tests/e2e/fixtures/select_list_mustache_custom_key.json new file mode 100644 index 000000000..18a97d057 --- /dev/null +++ b/tests/e2e/fixtures/select_list_mustache_custom_key.json @@ -0,0 +1,260 @@ +{ + "type": "screen_package", + "version": "2", + "screens": [ + { + "id": 4, + "screen_category_id": "1", + "title": "test select list pmql", + "description": "test select list pmql", + "type": "FORM", + "config": [ + { + "name": "test select list pmql", + "items": [ + { + "label": "Select List", + "config": { + "icon": "fas fa-angle-double-down", + "name": "form_select_list_1", + "label": "New Select List", + "helper": null, + "options": { + "key": "data", + "value": "id: {{ data.id }}", + "dataName": "response.data", + "jsonData": null, + "renderAs": "dropdown", + "editIndex": null, + "pmqlQuery": null, + "dataSource": "dataConnector", + "optionsList": [], + "removeIndex": null, + "showRenderAs": true, + "showJsonEditor": false, + "showOptionCard": false, + "selectedOptions": [], + "allowMultiSelect": false, + "selectedEndPoint": "ListAll", + "showRemoveWarning": false, + "valueTypeReturned": "object", + "selectedDataSource": 2 + }, + "readonly": false, + "validation": [], + "placeholder": null, + "rootElement": "response", + "dataSourceUrl": null, + "dataSourceEndpoint": null + }, + "component": "FormSelectList", + "inspector": [ + { + "type": "FormInput", + "field": "name", + "config": { + "name": "Variable Name", + "label": "Variable Name", + "helper": "A variable name is a symbolic name to reference information.", + "validation": "regex:/^(?:[A-Za-z])(?:[0-9A-Z_.a-z])*[^.]$/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super,true,false" + } + }, + { + "type": "FormInput", + "field": "label", + "config": { + "label": "Label", + "helper": "The label describes the field's name" + } + }, + { + "type": "FormInput", + "field": "placeholder", + "config": { + "label": "Placeholder Text", + "helper": "The placeholder is what is shown in the field when no value is provided yet" + } + }, + { + "type": "ValidationSelect", + "field": "validation", + "config": { + "label": "Validation Rules", + "helper": "The validation rules needed for this field" + } + }, + { + "type": "FormInput", + "field": "helper", + "config": { + "label": "Helper Text", + "helper": "Help text is meant to provide additional guidance on the field's value" + } + }, + { + "type": "OptionsList", + "field": "options", + "config": { "label": null, "helper": null } + }, + { + "type": "ColorSelect", + "field": "color", + "config": { + "label": "Text Color", + "helper": "Set the element's text color", + "options": [ + { "value": "text-primary", "content": "primary" }, + { "value": "text-secondary", "content": "secondary" }, + { "value": "text-success", "content": "success" }, + { "value": "text-danger", "content": "danger" }, + { "value": "text-warning", "content": "warning" }, + { "value": "text-info", "content": "info" }, + { "value": "text-light", "content": "light" }, + { "value": "text-dark", "content": "dark" } + ] + } + }, + { + "type": "ColorSelect", + "field": "bgcolor", + "config": { + "label": "Background Color", + "helper": "Set the element's background color", + "options": [ + { "value": "alert alert-primary", "content": "primary" }, + { + "value": "alert alert-secondary", + "content": "secondary" + }, + { "value": "alert alert-success", "content": "success" }, + { "value": "alert alert-danger", "content": "danger" }, + { "value": "alert alert-warning", "content": "warning" }, + { "value": "alert alert-info", "content": "info" }, + { "value": "alert alert-light", "content": "light" }, + { "value": "alert alert-dark", "content": "dark" } + ] + } + }, + { + "type": { + "props": ["value", "helper"], + "watch": { "value": { "immediate": true } }, + "methods": [], + "_scopeId": "data-v-172d71e1", + "computed": { "effectiveValue": [] }, + "_compiled": true, + "components": { + "MonacoEditor": { + "name": "monaco-editor", + "_Ctor": [], + "props": { "amdRequire": [] }, + "extends": { + "name": "MonacoEditor", + "model": { "event": "change" }, + "props": { + "theme": { "default": "vs" }, + "value": { "required": true }, + "options": [], + "language": [], + "original": [], + "amdRequire": [], + "diffEditor": { "default": false } + }, + "watch": { + "options": { "deep": true, "user": true } + }, + "methods": [] + }, + "methods": [] + } + }, + "staticRenderFns": [] + }, + "field": "defaultValue", + "config": { + "label": "Default Value", + "helper": "The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed." + } + }, + { + "type": "FormCheckbox", + "field": "readonly", + "config": { "label": "Read Only", "helper": null } + }, + { + "type": "FormInput", + "field": "conditionalHide", + "config": { + "label": "Visibility Rule", + "helper": "This control is hidden until this expression is true" + } + }, + { + "type": "FormInput", + "field": "customFormatter", + "config": { + "label": "Custom Format String", + "helper": "Use the Mask Pattern format
Date ##/##/####
SSN ###-##-####
Phone (###) ###-####", + "validation": null + } + }, + { + "type": "FormInput", + "field": "customCssSelector", + "config": { + "label": "CSS Selector Name", + "helper": "Use this in your custom css rules", + "validation": "regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]" + } + }, + { + "type": "FormInput", + "field": "ariaLabel", + "config": { + "label": "Aria Label", + "helper": "Attribute designed to help assistive technology (e.g. screen readers) attach a label" + } + }, + { + "type": "FormInput", + "field": "tabindex", + "config": { + "label": "Tab Order", + "helper": "Order in which a user will move focus from one control to another by pressing the Tab key", + "validation": "regex: [0-9]*" + } + } + ], + "editor-control": "FormSelectList", + "editor-component": "FormSelectList" + } + ] + } + ], + "computed": [], + "custom_css": null, + "created_at": "2021-11-08T10:31:29-08:00", + "updated_at": "2021-11-08T10:38:21-08:00", + "status": "ACTIVE", + "key": null, + "watchers": [], + "categories": [ + { + "id": 1, + "name": "Uncategorized", + "status": "ACTIVE", + "is_system": 0, + "created_at": "2021-11-08T10:25:46-08:00", + "updated_at": "2021-11-08T10:25:46-08:00", + "pivot": { + "assignable_id": 4, + "category_id": 1, + "category_type": "ProcessMaker\\Models\\ScreenCategory" + } + } + ] + } + ], + "screen_categories": [], + "scripts": [] +} diff --git a/tests/e2e/fixtures/select_list_mustache_request_data.json b/tests/e2e/fixtures/select_list_mustache_request_data.json new file mode 100644 index 000000000..397f94925 --- /dev/null +++ b/tests/e2e/fixtures/select_list_mustache_request_data.json @@ -0,0 +1,242 @@ +{ + "type": "screen_package", + "version": "2", + "screens": [ + { + "id": 6, + "screen_category_id": "1", + "title": "select list request data", + "description": "select list request data", + "type": "FORM", + "config": [ + { + "name": "select list request data", + "items": [ + { + "label": "Select List", + "config": { + "icon": "fas fa-angle-double-down", + "name": "form_select_list_1", + "label": "New Select List", + "helper": null, + "options": { + "key": "id", + "value": "id: {{id}} {{content}}", + "dataName": "array", + "jsonData": null, + "renderAs": "dropdown", + "editIndex": null, + "pmqlQuery": null, + "dataSource": "dataObject", + "optionsList": [], + "removeIndex": null, + "showRenderAs": true, + "showJsonEditor": false, + "showOptionCard": false, + "selectedOptions": [], + "allowMultiSelect": false, + "showRemoveWarning": false, + "valueTypeReturned": "single", + "selectedDataSource": null + }, + "readonly": false, + "validation": [], + "placeholder": null, + "rootElement": "response", + "dataSourceUrl": null, + "dataSourceEndpoint": null + }, + "component": "FormSelectList", + "inspector": [ + { + "type": "FormInput", + "field": "name", + "config": { + "name": "Variable Name", + "label": "Variable Name", + "helper": "A variable name is a symbolic name to reference information.", + "validation": "regex:/^(?:[A-Za-z])(?:[0-9A-Z_a-z])*(?:\\.[0-9A-Z_a-z]+)*$/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super" + } + }, + { + "type": "FormInput", + "field": "label", + "config": { + "label": "Label", + "helper": "The label describes the field's name" + } + }, + { + "type": "FormInput", + "field": "placeholder", + "config": { + "label": "Placeholder Text", + "helper": "The placeholder is what is shown in the field when no value is provided yet" + } + }, + { + "type": "ValidationSelect", + "field": "validation", + "config": { + "label": "Validation Rules", + "helper": "The validation rules needed for this field" + } + }, + { + "type": "FormInput", + "field": "helper", + "config": { + "label": "Helper Text", + "helper": "Help text is meant to provide additional guidance on the field's value" + } + }, + { + "type": "OptionsList", + "field": "options", + "config": { "label": null, "helper": null } + }, + { + "type": "ColorSelect", + "field": "color", + "config": { + "label": "Text Color", + "helper": "Set the element's text color", + "options": [ + { "value": "text-primary", "content": "primary" }, + { "value": "text-secondary", "content": "secondary" }, + { "value": "text-success", "content": "success" }, + { "value": "text-danger", "content": "danger" }, + { "value": "text-warning", "content": "warning" }, + { "value": "text-info", "content": "info" }, + { "value": "text-light", "content": "light" }, + { "value": "text-dark", "content": "dark" } + ] + } + }, + { + "type": "ColorSelect", + "field": "bgcolor", + "config": { + "label": "Background Color", + "helper": "Set the element's background color", + "options": [ + { "value": "alert alert-primary", "content": "primary" }, + { + "value": "alert alert-secondary", + "content": "secondary" + }, + { "value": "alert alert-success", "content": "success" }, + { "value": "alert alert-danger", "content": "danger" }, + { "value": "alert alert-warning", "content": "warning" }, + { "value": "alert alert-info", "content": "info" }, + { "value": "alert alert-light", "content": "light" }, + { "value": "alert alert-dark", "content": "dark" } + ] + } + }, + { + "type": { + "props": ["value", "helper"], + "watch": { "value": { "immediate": true } }, + "methods": [], + "_scopeId": "data-v-7c18055b", + "computed": { "effectiveValue": [] }, + "_compiled": true, + "components": { + "MonacoEditor": { + "name": "monaco-editor", + "_Ctor": [], + "props": { "amdRequire": [] }, + "extends": { + "name": "MonacoEditor", + "model": { "event": "change" }, + "props": { + "theme": { "default": "vs" }, + "value": { "required": true }, + "options": [], + "language": [], + "original": [], + "amdRequire": [], + "diffEditor": { "default": false } + }, + "watch": { + "options": { "deep": true, "user": true } + }, + "methods": [] + }, + "methods": [] + } + }, + "staticRenderFns": [] + }, + "field": "defaultValue", + "config": { + "label": "Default Value", + "helper": "The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed." + } + }, + { + "type": "FormCheckbox", + "field": "readonly", + "config": { "label": "Read Only", "helper": null } + }, + { + "type": "FormInput", + "field": "conditionalHide", + "config": { + "label": "Visibility Rule", + "helper": "This control is hidden until this expression is true" + } + }, + { + "type": "FormInput", + "field": "customFormatter", + "config": { + "label": "Custom Format String", + "helper": "Use the Mask Pattern format
Date ##/##/####
SSN ###-##-####
Phone (###) ###-####", + "validation": null + } + }, + { + "type": "FormInput", + "field": "customCssSelector", + "config": { + "label": "CSS Selector Name", + "helper": "Use this in your custom css rules", + "validation": "regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]" + } + } + ], + "editor-control": "FormSelectList", + "editor-component": "FormSelectList" + } + ] + } + ], + "computed": [], + "custom_css": null, + "created_at": "2021-11-08T13:33:31-08:00", + "updated_at": "2021-11-08T13:36:25-08:00", + "status": "ACTIVE", + "key": null, + "watchers": [], + "categories": [ + { + "id": 1, + "name": "Uncategorized", + "status": "ACTIVE", + "is_system": 0, + "created_at": "2021-11-08T10:25:46-08:00", + "updated_at": "2021-11-08T10:25:46-08:00", + "pivot": { + "assignable_id": 6, + "category_id": 1, + "category_type": "ProcessMaker\\Models\\ScreenCategory" + } + } + ] + } + ], + "screen_categories": [], + "scripts": [] +} diff --git a/tests/e2e/specs/SelectListMustache.spec.js b/tests/e2e/specs/SelectListMustache.spec.js new file mode 100644 index 000000000..ff3d257fb --- /dev/null +++ b/tests/e2e/specs/SelectListMustache.spec.js @@ -0,0 +1,176 @@ +describe('select list mustache', () => { + beforeEach(() => { + cy.server(); + cy.visit('/'); + cy.route( + 'POST', + '/api/1.0/requests/data_sources/2', + JSON.stringify({ + 'status': 200, + 'response': { + 'data': [{ + 'id': 1, + 'created_by_id': 2, + 'updated_by_id': 2, + 'created_at': '2021-11-08 10:29:56', + 'updated_at': '2021-11-08 10:29:56', + 'data': { + 'dni': '1234', + 'name': { + 'last': 'Callizaya', + 'first': 'David', + }, + 'id': 1, + }, + 'collection_id': 1, + 'title': '1', + 'created_by': { + 'id': 2, + 'email': 'admin@processmaker.com', + }, + 'updated_by': { + 'id': 2, + 'email': 'admin@processmaker.com', + }, + }, { + 'id': 2, + 'created_by_id': 2, + 'updated_by_id': 2, + 'created_at': '2021-11-08 10:29:56', + 'updated_at': '2021-11-08 10:29:56', + 'data': { + 'dni': '5678', + 'name': { + 'last': 'Loayza', + 'first': 'Dante', + }, + 'id': 2, + }, + 'collection_id': 1, + 'title': '2', + 'created_by': { + 'id': 2, + 'email': 'admin@processmaker.com', + }, + 'updated_by': { + 'id': 2, + 'email': 'admin@processmaker.com', + }, + }], + 'meta': { + 'filter': '', + 'sort_by': '', + 'sort_order': '', + 'count': 2, + 'total_pages': 1, + 'current_page': 1, + 'from': 1, + 'last_page': 1, + 'path': 'http:\/\/192.168.0.103:8089\/api\/1.0\/collections\/1\/records', + 'per_page': 9223372036854775807, + 'to': 2, + 'total': 2, + }, + }, + }) + ).as('executeScript'); + }); + + it('Verify select list mustache + data source', () => { + cy.loadFromJson('select_list_mustache.json', 0); + cy.get('[data-cy=mode-preview]').click(); + cy.get('[data-cy="screen-field-form_select_list_1"]').selectOption('id: 2'); + + // Check the data of the screen + cy.assertPreviewData({ + form_select_list_1: { + 'id': 2, + 'created_by_id': 2, + 'updated_by_id': 2, + 'created_at': '2021-11-08 10:29:56', + 'updated_at': '2021-11-08 10:29:56', + 'data': { + 'dni': '5678', + 'name': { + 'last': 'Loayza', + 'first': 'Dante', + }, + 'id': 2, + }, + 'collection_id': 1, + 'title': '2', + 'created_by': { + 'id': 2, + 'email': 'admin@processmaker.com', + }, + 'updated_by': { + 'id': 2, + 'email': 'admin@processmaker.com', + }, + }, + }); + }); + + it('Verify select list mustache + data source with custom key', () => { + cy.loadFromJson('select_list_mustache_custom_key.json', 0); + cy.get('[data-cy=mode-preview]').click(); + cy.get('[data-cy="screen-field-form_select_list_1"]').selectOption('id: 2'); + + // Check the data of the screen + cy.assertPreviewData({ + form_select_list_1: { + 'dni': '5678', + 'name': { + 'last': 'Loayza', + 'first': 'Dante', + }, + 'id': 2, + }, + }); + }); + + it('Verify select list simple array of options', () => { + cy.loadFromJson('select_list_array_data.json', 0); + cy.get('[data-cy=mode-preview]').click(); + cy.get('[data-cy="screen-field-form_select_list_1"]').selectOption('two'); + + // Check the data of the screen + cy.assertPreviewData({ + form_select_list_1: '2', + }); + }); + + it('Verify select list mustache with request data', () => { + cy.loadFromJson('select_list_mustache_request_data.json', 0); + // Setup Request Data + cy.setPreviewDataInput({ + array: [ + { + 'id': '1', + 'content': 'one', + }, + { + 'id': '2', + 'content': 'two', + }, + ], + }); + cy.get('[data-cy=mode-preview]').click(); + cy.get('[data-cy="screen-field-form_select_list_1"]').selectOption('id: 2 two'); + + // Check the data of the screen + cy.assertPreviewData({ + array: [ + { + 'id': '1', + 'content': 'one', + }, + { + 'id': '2', + 'content': 'two', + }, + ], + form_select_list_1: '2', + }); + }); +}); \ No newline at end of file From 9bf7f1aae6232bac9b684a7699efa5f9561f8a9d Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Mon, 8 Nov 2021 17:59:45 -0400 Subject: [PATCH 2/6] Add missing key option --- src/components/inspector/options-list.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/inspector/options-list.vue b/src/components/inspector/options-list.vue index 72a909f1d..6f6c61469 100644 --- a/src/components/inspector/options-list.vue +++ b/src/components/inspector/options-list.vue @@ -186,7 +186,7 @@ {{ $t("Select 'Single Value' to use parts of the selected object. Select 'Object' to use the entire selected value.") }}
-
+
@@ -196,7 +196,7 @@ - {{ $t('Key name in the selected object to display to the user in the select list. Leave blank to show the entire selected value.') }} + {{ $t('Content to display to the user in the select list.') }}
From 6f4891bffa6e367ef64fe5c9baf898188f493e12 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 9 Nov 2021 06:58:57 -0400 Subject: [PATCH 3/6] Bump vue-form-elements@0.18.4-I --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2679a9c8b..e7b10b45c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2165,9 +2165,9 @@ } }, "@processmaker/vue-form-elements": { - "version": "0.18.4-H", - "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.18.4-H.tgz", - "integrity": "sha512-imuL1cPdPfXEzjz5Qe+uBNpdMxDRYUMGVSx+p/XQSM/2XaBfZvV3gZPKrYCDbw4MPyzhOIGprLcF6AUfU+Wq9g==", + "version": "0.18.4-I", + "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.18.4-I.tgz", + "integrity": "sha512-wed+M//LesygHLbN2gAeefAqJJ3oFjllRAmFcInY94MteL9A8Ow+/zoAFOF4Fx0iAFODvn4acEYi1v9sJrXsCg==", "dev": true, "requires": { "@tinymce/tinymce-vue": "2.0.0", diff --git a/package.json b/package.json index 0cde0cbbe..2bbda842e 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@cypress/code-coverage": "^3.8.1", "@fortawesome/fontawesome-free": "^5.6.1", "@panter/vue-i18next": "^0.15.2", - "@processmaker/vue-form-elements": "0.18.4-H", + "@processmaker/vue-form-elements": "0.18.4-I", "@vue/cli-plugin-babel": "^3.6.0", "@vue/cli-plugin-e2e-cypress": "^4.0.3", "@vue/cli-plugin-eslint": "^3.6.0", From 10e7e54c2a207de3aa11e4e61c86c569bbddb015 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 9 Nov 2021 07:16:04 -0400 Subject: [PATCH 4/6] Fix lint issue --- tests/e2e/specs/SelectListMustache.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/specs/SelectListMustache.spec.js b/tests/e2e/specs/SelectListMustache.spec.js index ff3d257fb..d92241416 100644 --- a/tests/e2e/specs/SelectListMustache.spec.js +++ b/tests/e2e/specs/SelectListMustache.spec.js @@ -66,7 +66,7 @@ describe('select list mustache', () => { 'current_page': 1, 'from': 1, 'last_page': 1, - 'path': 'http:\/\/192.168.0.103:8089\/api\/1.0\/collections\/1\/records', + 'path': '/api/1.0/collections/1/records', 'per_page': 9223372036854775807, 'to': 2, 'total': 2, From 71d06ec406d57e8df57e63db52c03abcc6acac4b Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Mon, 8 Nov 2021 13:18:12 -0400 Subject: [PATCH 5/6] Fix test get --- tests/e2e/specs/LoadComplexData.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/specs/LoadComplexData.spec.js b/tests/e2e/specs/LoadComplexData.spec.js index e57be9199..b65b1cd9e 100644 --- a/tests/e2e/specs/LoadComplexData.spec.js +++ b/tests/e2e/specs/LoadComplexData.spec.js @@ -8,7 +8,7 @@ describe('Validation Rules (Advanced test)', () => { cy.loadFromJson('FPP_PFP_CHAIRS_SCREEN.json', 0); cy.get('[data-cy=mode-preview]').click(); // Open Tab 2 - cy.get('[aria-label="Part Time"]:visible:first').click(); + cy.get('button:contains("Part Time"):visible:first').click(); // Tab 2 contains the title '2. PART TIME PAGE' cy.get('#preview').should('contain.html', '2. PART TIME PAGE'); From bf43daec1e1c5cf6bdfa7d990e72eab5c9004c11 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 9 Nov 2021 14:31:03 -0400 Subject: [PATCH 6/6] Bump vue-form-elements@0.18.4-J --- package-lock.json | 6 +++--- package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index e7b10b45c..4a555add3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2165,9 +2165,9 @@ } }, "@processmaker/vue-form-elements": { - "version": "0.18.4-I", - "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.18.4-I.tgz", - "integrity": "sha512-wed+M//LesygHLbN2gAeefAqJJ3oFjllRAmFcInY94MteL9A8Ow+/zoAFOF4Fx0iAFODvn4acEYi1v9sJrXsCg==", + "version": "0.18.4-J", + "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.18.4-J.tgz", + "integrity": "sha512-NBK0rvGLWvrNoRNdB432Cf1HOTQ3loJI95Ib35k62sbzb/B4M//yTFN6Tki64dL5V9jaqthXtkYUWDWzTZb6aQ==", "dev": true, "requires": { "@tinymce/tinymce-vue": "2.0.0", diff --git a/package.json b/package.json index 2bbda842e..b95d7b1b3 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@cypress/code-coverage": "^3.8.1", "@fortawesome/fontawesome-free": "^5.6.1", "@panter/vue-i18next": "^0.15.2", - "@processmaker/vue-form-elements": "0.18.4-I", + "@processmaker/vue-form-elements": "0.18.4-J", "@vue/cli-plugin-babel": "^3.6.0", "@vue/cli-plugin-e2e-cypress": "^4.0.3", "@vue/cli-plugin-eslint": "^3.6.0", @@ -83,7 +83,7 @@ }, "peerDependencies": { "@panter/vue-i18next": "^0.15.0", - "@processmaker/vue-form-elements": "0.18.4-H", + "@processmaker/vue-form-elements": "0.18.4-J", "i18next": "^15.0.8", "vue": "^2.6.12", "vuex": "^3.1.1"