|
|
@ -1,6 +1,6 @@ |
|
|
import Editor from '../../../src/editor/model/Editor'; |
|
|
import Editor from '../../../src/editor/model/Editor'; |
|
|
import DataSourceManager from '../../../src/dataSources'; |
|
|
import DataSourceManager from '../../../src/dataSources'; |
|
|
import { DataSourceProps } from '../../../src/dataSources/types'; |
|
|
import { DataSourceProps, DataSourcesEvents } from '../../../src/dataSources/types'; |
|
|
import ComponentWrapper from '../../../src/dom_components/model/ComponentWrapper'; |
|
|
import ComponentWrapper from '../../../src/dom_components/model/ComponentWrapper'; |
|
|
|
|
|
|
|
|
describe('DataSourceManager', () => { |
|
|
describe('DataSourceManager', () => { |
|
|
@ -94,13 +94,24 @@ describe('DataSourceManager', () => { |
|
|
value: 'default', |
|
|
value: 'default', |
|
|
path: 'ds1[id4]name', |
|
|
path: 'ds1[id4]name', |
|
|
})[0]; |
|
|
})[0]; |
|
|
|
|
|
const eventFn = jest.fn(); |
|
|
|
|
|
em.on(`${DataSourcesEvents.path}:ds1.id4.name`, eventFn); |
|
|
const newRecord = ds.addRecord({ id: 'id4', name: 'Name4' }); |
|
|
const newRecord = ds.addRecord({ id: 'id4', name: 'Name4' }); |
|
|
expect(cmpVar.getEl()?.innerHTML).toBe('Name4'); |
|
|
expect(cmpVar.getEl()?.innerHTML).toBe('Name4'); |
|
|
newRecord.set({ name: 'up' }); |
|
|
newRecord.set({ name: 'up' }); |
|
|
expect(cmpVar.getEl()?.innerHTML).toBe('up'); |
|
|
expect(cmpVar.getEl()?.innerHTML).toBe('up'); |
|
|
|
|
|
expect(eventFn).toBeCalledTimes(1); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
test('component is properly updating on data source add', () => {}); |
|
|
test('component is properly updating on data source add', () => { |
|
|
|
|
|
const cmpVar = cmpRoot.append({ |
|
|
|
|
|
type: 'data-variable', |
|
|
|
|
|
value: 'default', |
|
|
|
|
|
path: 'ds1.id1.name', |
|
|
|
|
|
})[0]; |
|
|
|
|
|
const ds = dsm.add(dsTest); |
|
|
|
|
|
expect(cmpVar.getEl()?.innerHTML).toBe('Name1'); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
test('component is properly updating on data source reset', () => {}); |
|
|
test('component is properly updating on data source reset', () => {}); |
|
|
|
|
|
|
|
|
@ -109,5 +120,7 @@ describe('DataSourceManager', () => { |
|
|
test('component is properly updating on record remove', () => {}); |
|
|
test('component is properly updating on record remove', () => {}); |
|
|
|
|
|
|
|
|
test('component is properly updating on record reset', () => {}); |
|
|
test('component is properly updating on record reset', () => {}); |
|
|
|
|
|
|
|
|
|
|
|
test('component is properly updating on its prop changes', () => {}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|