Browse Source

revert test

pull/6660/head
IhorKaleniuk666 2 months ago
parent
commit
d56ba64cad
  1. 4
      packages/core/src/dom_components/model/Component.ts
  2. 15
      packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts

4
packages/core/src/dom_components/model/Component.ts

@ -1670,11 +1670,9 @@ export default class Component extends StyleableModel<ComponentProperties> {
} }
} }
// ★ Добавляем "реальный" component id,
// если он отличается от attributes.id
const attrs = this.get('attributes') || {}; const attrs = this.get('attributes') || {};
if (this.ccid && attrs.id && this.ccid !== attrs.id) { if (this.ccid && attrs.id && this.ccid !== attrs.id) {
(obj as any).id = this.ccid; obj.id = this.ccid;
} }
if (this.em.getConfig().avoidDefaults) { if (this.em.getConfig().avoidDefaults) {

15
packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts

@ -105,15 +105,12 @@ describe('Collection component', () => {
expect(cmp.toHTML()).toBe(`<${tagName} id="${cmp.getId()}">${innerHTML}</${tagName}>`); expect(cmp.toHTML()).toBe(`<${tagName} id="${cmp.getId()}">${innerHTML}</${tagName}>`);
expect(cmp.getEl()?.innerHTML).toBe(innerHTML); expect(cmp.getEl()?.innerHTML).toBe(innerHTML);
const json = JSON.parse(JSON.stringify(cmp.toJSON())); expect(JSON.parse(JSON.stringify(cmp.toJSON()))).toEqual({
expect(json).toEqual( tagName: cmp.tagName,
expect.objectContaining({ dataResolver: cmp.get('dataResolver'),
tagName, type: cmp.getType(),
dataResolver: cmp.get('dataResolver'), attributes: cmp.getAttributes(),
type: cmp.getType(), });
attributes: cmp.getAttributes(),
}),
);
}; };
const checkRecordsWithInnerCmp = () => { const checkRecordsWithInnerCmp = () => {

Loading…
Cancel
Save