Skip to content

Commit ae6b726

Browse files
authored
Merge pull request #24 from formly-js/incorrect-keys
fixing incorrect key error from #23
2 parents 093ce9f + 07b8e2c commit ae6b726

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/FormlyForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
const self = this;
66
children = this.fields.map( function(field){
77
return h('formly-field', {
8-
key: `formly_{field.key}`,
8+
key: `formly_${field.key}`,
99
ref: field.key,
1010
props: {
1111
model: self.model,

test/unit/specs/FormlyForm.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,16 @@ describe('FormlyForm', () => {
6464
]
6565
};
6666

67-
createForm('<formly-form :form="form" :model="model" :fields="fields"></formly-form>', data);
67+
createForm('<formly-form ref="form" :form="form" :model="model" :fields="fields"></formly-form>', data);
6868

6969
//check the elements have been created
7070

7171
expect(vm.$el.tagName).to.equal('FIELDSET');
7272
expect(vm.$el.querySelectorAll('.formly-field')).to.be.length(2);
7373

7474
//check their data
75-
75+
expect(vm.$refs.form.$refs.fname.$vnode.key).to.equal('formly_fname');
76+
expect(vm.$refs.form.$refs.lname.$vnode.key).to.equal('formly_lname')
7677
expect(vm.$el.querySelector('#lname_model').textContent).to.contain('smith');
7778
expect(JSON.parse(vm.$el.querySelector('#fname_field').textContent)).to.deep.equal(data.fields[0]);
7879
expect(JSON.parse(vm.$el.querySelector('#lname_field').textContent)).to.deep.equal(data.fields[1]);

0 commit comments

Comments
 (0)