Browse Source

Fix unstylable

updates-for-styles
Artur Arseniev 1 year ago
parent
commit
ecede2f119
  1. 3
      packages/core/src/style_manager/model/Property.ts
  2. 18
      packages/core/test/specs/style_manager/model/Sectors.ts

3
packages/core/src/style_manager/model/Property.ts

@ -567,7 +567,8 @@ export default class Property<T extends PropertyPropsCustom = PropertyPropsCusto
const id = this.getId(); const id = this.getId();
const property = this.getName(); const property = this.getName();
const { requires, requiresParent, toRequire, unstylable, isVisible } = this.attributes; const { requires, requiresParent, toRequire, isVisible } = this.attributes;
const unstylable = trg.get('unstylable');
const stylableReq = trg.get('stylable-require'); const stylableReq = trg.get('stylable-require');
let stylable = trg.get('stylable'); let stylable = trg.get('stylable');

18
packages/core/test/specs/style_manager/model/Sectors.ts

@ -86,5 +86,23 @@ describe('Sectors', () => {
expect(prop.isVisible()).toBe(isVisible); expect(prop.isVisible()).toBe(isVisible);
}); });
}); });
test('Property with isVisible', () => {
const cmp = domc.addComponent({ tagName: 'span' });
em.setSelected(cmp);
s2.getProperty('color')?.set({
isVisible: ({ component }) => component?.tagName !== 'span',
});
sm.__upSel();
[s1, s2].forEach((sector) => expect(sector.isVisible()).toBe(true));
s2.getProperties().forEach((prop) => {
const isVisible = prop.getName() !== 'color';
expect(prop.isVisible()).toBe(isVisible);
});
});
}); });
}); });

Loading…
Cancel
Save