Skip to content

Commit

Permalink
fix(text): restore ternary and add new test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
skhamvon authored and dpellier committed Oct 6, 2023
1 parent 2cf2fe7 commit bab890c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ describe('spec:osds-text', () => {
expect(root?.getAttribute('style')).toBe(styleVar);
});

it('should not set a style variable', async () => {
await setup({ attributes: {
color: "",
hue: ""
} });
expect(root?.getAttribute('style')).toBeNull();
});

describe('attributes', () => {
const config = {
instance: () => instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class OsdsText implements OdsTextAttribute {

render() {
return (
<Host style={{ '--osds-text-color-specific-hue': `var(${odsGenerateColorVariable(this.color!, this.hue!)})` }}>
<Host style={{ '--osds-text-color-specific-hue': this.color && this.hue ? `var(${odsGenerateColorVariable(this.color, this.hue)})` : '' }}>
<slot></slot>
</Host>
);
Expand Down

0 comments on commit bab890c

Please sign in to comment.