File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<fieldset >
3
+ <template v-if =" ! customLayout " >
3
4
<formly-field v-for =" field in form | formlyFields" :form.sync =" form" :key =" field" ></formly-field >
5
+ </template >
6
+ <slot ></slot >
4
7
</fieldset >
5
8
</template >
6
9
7
10
<script >
8
11
export default {
9
- props: [' form' ],
12
+ props: [' form' , ' customLayout ' ],
10
13
created (){
11
14
// make sure that the 'value' is always set
12
15
Object .keys (this .form ).forEach ((key ) => {
Original file line number Diff line number Diff line change @@ -132,5 +132,27 @@ describe('FormlyForm', () => {
132
132
done ( ) ;
133
133
} ) ;
134
134
} ) ;
135
+
136
+ it ( 'should allow a manual display' , ( ) => {
137
+
138
+ Vue . component ( 'formly-field' , {
139
+ props : [ 'form' , 'key' ] ,
140
+ template : '<div class="testing"></div>'
141
+ } ) ;
142
+
143
+ let data = {
144
+ form : {
145
+ fname : {
146
+ type : 'test'
147
+ }
148
+ }
149
+ } ;
150
+
151
+ createForm ( '<formly-form :form="form" :custom-layout="true"><div id="outside_loop"><formly-field></formly-field></div></formly-form>' , data ) ;
152
+
153
+ expect ( vm . $el . querySelectorAll ( '.testing' ) ) . to . be . length ( 1 ) ;
154
+ expect ( vm . $el . querySelectorAll ( 'fieldset #outside_loop .testing' ) ) . to . be . length ( 1 ) ;
155
+
156
+ } ) ;
135
157
136
158
} ) ;
You can’t perform that action at this time.
0 commit comments