Closed riceyeh closed 5 years ago
The following example shows form.update() does not consider input function.
const fields = [ 'priority', 'itineraryItems[].hotel.name', 'itineraryItems[].hotel.starRating', ]; const input = { 'priority': p => p === '' ? -1 : Number(p), 'itineraryItems[].hotel.starRating': rate => { return Number(rate) } } class NewForm extends Form { hooks() { return { onInit(form) { form.update({ priority: '1', itineraryItems: [{ hotel: { name: 'Shangri-La Hotel', starRating: '5.0', }, }, { hotel: null, }, { hotel: { name: 'Trump Hotel', starRating: '5.0', }, }], }); }, }; } } const form = new NewForm({ fields, input }, { name: 'Form 998' }); describe.only('number rating', () => { it('', () => { expect(form.$('priority').value).to.be.equal(1) // fails, it is still '1' expect(form.$('itineraryItems.0.hotel.starRating').value).to.be.equal(5) // fails, it is still '5' }) });
:tada: This issue has been resolved in version 2.0.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
The following example shows form.update() does not consider input function.