File tree Expand file tree Collapse file tree
templates/building-block/custom-form-field Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @sap-ux/fe-fpm-writer " : patch
3+ ---
4+
5+ fix(fpm-writer): custom form field view.xml update
Original file line number Diff line number Diff line change 1- <% if (! config? . hasAggregation) { % > << %- macrosNamespace % > : fields>< % } %>
2- <<% - config? . aggregationNamespace %> :FormElement
1+ <<% - config? . aggregationNamespace %> :FormElement
32 <% if (data. formElementKey) { % > key= " <%- data.formElementKey %>" < % } %>
43 label="<% - data. label %> "
54 <% if (data. id) { % > id= " <%- data.id %>" < % } %>
65 <% if (data. metaPath) { % > metaPath= " <%- data.metaPath %>" < % } %>
76 <% if (data. contextPath) { % > contextPath= " <%- data.contextPath %>" < % } %>
87 <% if (data. position? . anchor) { % > anchor= " <%- data.position.anchor %>" < % } %>
98 <% if (data. position? . placement) { % > placement= " <%- data.position.placement %>" < % } %> >
10- <<% - macrosNamespace %> :fields>
9+ <<% - config ? . aggregationNamespace %> :fields>
1110 <core : Fragment fragmentName =" <%- data.embededFragment.ns %>.<%- data.embededFragment.name %>" type =" XML" />
12- </<% - macrosNamespace %> :fields>
11+ </<% - config ? . aggregationNamespace %> :fields>
1312</<% - config? . aggregationNamespace %> :FormElement>
14- <% if (! config? . hasAggregation) { % >< / < %- macrosNamespace % > : fields>< % } %>
Original file line number Diff line number Diff line change @@ -767,18 +767,16 @@ exports[`Building Blocks CustomFormField building block generate CustomFormField
767767</mvc:View>"
768768`;
769769
770- exports[`Building Blocks CustomFormField building block generate CustomFormField without macros:fields - creates aggregation : generate-custom-form-field-without-fields 1`] = `
770+ exports[`Building Blocks CustomFormField building block generate CustomFormField without macros:fields - inserts FormElement directly into Form : generate-custom-form-field-without-fields 1`] = `
771771" <mvc:View xmlns:core=\\" sap.ui.core\\" xmlns:mvc=\\"sap.ui.core.mvc\\" xmlns =\\"sap.m\\" xmlns:html=\\"http://www.w3.org/1999/xhtml\\" controllerName =\\"com.test.myApp.ext.main.Main\\" xmlns:macros=\\"sap.fe.macros\\">
772772 <Page title =\\"Main\\">
773773 <content>
774774 <macros:Form id =\\"myForm\\" metaPath =\\"@com.sap.vocabularies.UI.v1.FieldGroup#General\\">
775- <macros:fields>
776- <macros:FormElement label =\\"Custom Form Field 2\\" id =\\"testCustomFormField2\\" anchor =\\"DataField::AnotherProperty\\" placement =\\"Before\\">
777- <macros:fields>
778- <core:Fragment fragmentName =\\"my.test.App.ext.fragment.CustomFormField2\\" type =\\"XML\\"/>
779- </macros:fields>
780- </macros:FormElement>
781- </macros:fields>
775+ <macros:FormElement label =\\"Custom Form Field 2\\" id =\\"testCustomFormField2\\" anchor =\\"DataField::AnotherProperty\\" placement =\\"Before\\">
776+ <macros:fields>
777+ <core:Fragment fragmentName =\\"my.test.App.ext.fragment.CustomFormField2\\" type =\\"XML\\"/>
778+ </macros:fields>
779+ </macros:FormElement>
782780 </macros:Form>
783781 </content>
784782 </Page>
Original file line number Diff line number Diff line change @@ -3065,7 +3065,7 @@ describe('Building Blocks', () => {
30653065 await writeFilesForDebugging ( fs ) ;
30663066 } ) ;
30673067
3068- test ( 'generate CustomFormField without macros:fields - creates aggregation ' , async ( ) => {
3068+ test ( 'generate CustomFormField without macros:fields - inserts FormElement directly into Form ' , async ( ) => {
30693069 const basePath = join ( testAppPath , 'generate-custom-form-field-without-fields' ) ;
30703070 const aggregationPath = `/mvc:View/*[local-name()='Page']/*[local-name()='content']/macros:Form` ;
30713071 const customFormFieldData : CustomFormField = {
@@ -3105,9 +3105,8 @@ describe('Building Blocks', () => {
31053105
31063106 const viewContent = fs . read ( join ( basePath , xmlViewFilePath ) ) ;
31073107 expect ( viewContent ) . toMatchSnapshot ( 'generate-custom-form-field-without-fields' ) ;
3108- expect ( viewContent ) . toContain ( '<macros:fields>' ) ;
3109- expect ( viewContent ) . toMatch ( / < m a c r o s : f i e l d s > [ \s \S ] * F o r m E l e m e n t [ \s \S ] * < \/ m a c r o s : f i e l d s > / ) ;
3110- expect ( viewContent ) . toContain ( 'FormElement' ) ;
3108+ expect ( viewContent ) . not . toMatch ( / < m a c r o s : f i e l d s > [ \s \S ] * < m a c r o s : F o r m E l e m e n t / ) ;
3109+ expect ( viewContent ) . toContain ( '<macros:FormElement' ) ;
31113110 expect ( viewContent ) . toContain ( 'Custom Form Field 2' ) ;
31123111 expect ( viewContent ) . toContain ( 'anchor="DataField::AnotherProperty"' ) ;
31133112 expect ( viewContent ) . toContain ( 'placement="Before"' ) ;
You can’t perform that action at this time.
0 commit comments