diff --git a/packages/core/src/dom_components/model/Component.ts b/packages/core/src/dom_components/model/Component.ts index ffbb1c006..fdc7c8c69 100644 --- a/packages/core/src/dom_components/model/Component.ts +++ b/packages/core/src/dom_components/model/Component.ts @@ -1670,11 +1670,9 @@ export default class Component extends StyleableModel { } } - // ★ Добавляем "реальный" component id, - // если он отличается от attributes.id const attrs = this.get('attributes') || {}; if (this.ccid && attrs.id && this.ccid !== attrs.id) { - (obj as any).id = this.ccid; + obj.id = this.ccid; } if (this.em.getConfig().avoidDefaults) { diff --git a/packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts b/packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts index 04a671300..d9a033291 100644 --- a/packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts +++ b/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}`); expect(cmp.getEl()?.innerHTML).toBe(innerHTML); - const json = JSON.parse(JSON.stringify(cmp.toJSON())); - expect(json).toEqual( - expect.objectContaining({ - tagName, - dataResolver: cmp.get('dataResolver'), - type: cmp.getType(), - attributes: cmp.getAttributes(), - }), - ); + expect(JSON.parse(JSON.stringify(cmp.toJSON()))).toEqual({ + tagName: cmp.tagName, + dataResolver: cmp.get('dataResolver'), + type: cmp.getType(), + attributes: cmp.getAttributes(), + }); }; const checkRecordsWithInnerCmp = () => {