Browse Source

Undo updating component with datacolection tests

pages-datasources
mohamedsalem401 1 year ago
parent
commit
470c451b37
  1. 4
      packages/core/src/data_sources/model/data_collection/ComponentDataCollection.ts
  2. 10
      packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollectionWithDataVariable.ts

4
packages/core/src/data_sources/model/data_collection/ComponentDataCollection.ts

@ -169,9 +169,9 @@ export default class ComponentDataCollection extends ComponentWithCollectionsSta
private rebuildChildrenFromCollection() {
const items = this.getDataSourceItems();
const itemsCount = size(items);
const { totalItems } = this.resolveCollectionConfig(items);
if (itemsCount === this.components().length) {
if (totalItems === this.components().length) {
this.onCollectionsStateMapUpdate(this.collectionsStateMap);
return;
}

10
packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollectionWithDataVariable.ts

@ -255,19 +255,19 @@ describe('Collection variable components', () => {
const component = components.models[0];
const firstChild = component.components().at(0);
const firstGrandchild = firstChild.components().at(0);
const secondChild = () => component.components().at(1);
const secondGrandchild = () => secondChild().components().at(0);
const secondChild = component.components().at(1);
const secondGrandchild = secondChild.components().at(0);
expect(firstGrandchild.getInnerHTML()).toBe('user1');
expect(secondGrandchild().getInnerHTML()).toBe('user2');
expect(secondGrandchild.getInnerHTML()).toBe('user2');
firstRecord.set('user', 'new_user1_value');
expect(firstGrandchild.getInnerHTML()).toBe('new_user1_value');
expect(secondGrandchild().getInnerHTML()).toBe('user2');
expect(secondGrandchild.getInnerHTML()).toBe('user2');
secondRecord.set('user', 'new_user2_value');
expect(firstGrandchild.getInnerHTML()).toBe('new_user1_value');
expect(secondGrandchild().getInnerHTML()).toBe('new_user2_value');
expect(secondGrandchild.getInnerHTML()).toBe('new_user2_value');
});
});
});

Loading…
Cancel
Save