From 463399b3ef716b1ad0e437961e8b1a33faa4547c Mon Sep 17 00:00:00 2001 From: mohamedsalem401 Date: Fri, 27 Dec 2024 07:54:07 +0200 Subject: [PATCH] Fix style serialization test --- packages/core/src/dom_components/model/Component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/core/src/dom_components/model/Component.ts b/packages/core/src/dom_components/model/Component.ts index 0c6703972..fe46c53c7 100644 --- a/packages/core/src/dom_components/model/Component.ts +++ b/packages/core/src/dom_components/model/Component.ts @@ -958,7 +958,7 @@ export default class Component extends StyleableModel { const event = 'change:traits'; this.off(event, this.initTraits); this.__loadTraits(); - const attrs: { [key: string]: string | DynamicValueDefinition } = {}; + const attrs = { ...this.get('attributes') }; const traits = this.traits; traits.each((trait) => { const name = trait.getName(); @@ -970,7 +970,11 @@ export default class Component extends StyleableModel { if (name && value) attrs[name] = value; } }); - traits.length && this.addAttributes(attrs); + const dynamicAttributes = this.componentDVListener.getDynamicAttributesDefs(); + traits.length && this.setAttributes({ + ...attrs, + ...dynamicAttributes, + }); this.on(event, this.initTraits); changed && em && em.trigger('component:toggled'); return this;