Open ExtAnimal opened 2 months ago
Forum post
This test will show the bug:
t.iit('haschanges event fired with correct data when adding drag-created event', async t => { t.mockUrl('crudmanager-haschanges-bug', { responseText : JSON.stringify({ success : true, resources : { rows : [{ id : 1, name : 'Resource 1', eventColor : 'red' }] }, events : { rows : [] }, assignments : { rows : [] } }) }); calendar = await getCalendar({ crudManager : { loadUrl : 'crudmanager-haschanges-bug', autoLoad : true, autoSync : false }, date : '2024-01-01T09:00', events : [] }); const { crudManager } = calendar; let changesAccepted = false; crudManager.on({ hasChanges({ source }) { const { added } = source.changes.events; if (added.length === 1 && added[0].name !== 'First') { t.fail('First added event must be passed'); } else { t.pass('First event passed'); } // clear down changed state source.acceptChanges(); changesAccepted = true; }, once : true }); await t.dragBy({ source : '.b-dayview-day-detail.b-calendar-cell[data-date="2024-01-01"]', delta : [0, 50] }); await t.waitFor(() => calendar.features.eventEdit._editor?.containsFocus); await t.type(null, 'First[ENTER]'); // Wait for changes to be committed. // Listener checks that added contains correct data await t.waitFor(() => changesAccepted); crudManager.on({ hasChanges({ source }) { const { added } = source.changes.events; if (added.length === 1 && added[0].name !== 'Second') { t.fail('Previously added event in change set of second add'); } else { t.pass('Second event passed'); } changesAccepted = true; } }); changesAccepted = false; await t.dragBy({ source : '.b-dayview-day-detail.b-calendar-cell[data-date="2024-01-05"]', delta : [0, 50] }); await t.waitFor(() => calendar.features.eventEdit._editor?.containsFocus); await t.type(null, 'Second[ENTER]'); // Wait for changes to be committed // Listener checks that added contains correct data await t.waitFor(() => changesAccepted); });
Forum post
This test will show the bug: