From 3023690990c1fc9f78296470720c74d3d4498d03 Mon Sep 17 00:00:00 2001 From: skhamvon Date: Tue, 3 Oct 2023 10:02:34 +0200 Subject: [PATCH 1/3] fix(text): add missing test line for coverage --- .../text/src/components/osds-text/osds-text.spec.ts | 6 ++++++ .../components/text/src/components/osds-text/osds-text.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/components/text/src/components/osds-text/osds-text.spec.ts b/packages/components/text/src/components/osds-text/osds-text.spec.ts index ad1c4beffa..15485b2319 100644 --- a/packages/components/text/src/components/osds-text/osds-text.spec.ts +++ b/packages/components/text/src/components/osds-text/osds-text.spec.ts @@ -40,6 +40,12 @@ describe('spec:osds-text', () => { expect(textSlot).toBeTruthy(); }); + it('should have set a style variable', async () => { + const styleVar = '--osds-text-color-specific-hue: var(--ods-color-default-500);'; + await setup({ attributes: {} }); + expect(root?.getAttribute('style')).toBe(styleVar); + }); + describe('attributes', () => { const config = { instance: () => instance, diff --git a/packages/components/text/src/components/osds-text/osds-text.tsx b/packages/components/text/src/components/osds-text/osds-text.tsx index 86ec9879da..b6f7504f03 100644 --- a/packages/components/text/src/components/osds-text/osds-text.tsx +++ b/packages/components/text/src/components/osds-text/osds-text.tsx @@ -37,7 +37,7 @@ export class OsdsText implements OdsTextAttribute { return ( From bfa4b0690d3f4ccf49eca3ac1d970ae08b54ccd1 Mon Sep 17 00:00:00 2001 From: skhamvon Date: Wed, 4 Oct 2023 11:05:17 +0200 Subject: [PATCH 2/3] fix(text): remove destructuring object --- .../components/text/src/components/osds-text/osds-text.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/components/text/src/components/osds-text/osds-text.tsx b/packages/components/text/src/components/osds-text/osds-text.tsx index b6f7504f03..9b05be9b11 100644 --- a/packages/components/text/src/components/osds-text/osds-text.tsx +++ b/packages/components/text/src/components/osds-text/osds-text.tsx @@ -35,11 +35,7 @@ export class OsdsText implements OdsTextAttribute { render() { return ( - + ); From 62e66d7c2954a6f37a197776003ae4c7cd4dbf52 Mon Sep 17 00:00:00 2001 From: skhamvon Date: Thu, 5 Oct 2023 11:28:01 +0200 Subject: [PATCH 3/3] fix(text): restore ternary and add new test for it --- .../text/src/components/osds-text/osds-text.spec.ts | 8 ++++++++ .../text/src/components/osds-text/osds-text.tsx | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/components/text/src/components/osds-text/osds-text.spec.ts b/packages/components/text/src/components/osds-text/osds-text.spec.ts index 15485b2319..44c9e20956 100644 --- a/packages/components/text/src/components/osds-text/osds-text.spec.ts +++ b/packages/components/text/src/components/osds-text/osds-text.spec.ts @@ -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, diff --git a/packages/components/text/src/components/osds-text/osds-text.tsx b/packages/components/text/src/components/osds-text/osds-text.tsx index 9b05be9b11..b8fbc6c9c5 100644 --- a/packages/components/text/src/components/osds-text/osds-text.tsx +++ b/packages/components/text/src/components/osds-text/osds-text.tsx @@ -35,7 +35,7 @@ export class OsdsText implements OdsTextAttribute { render() { return ( - + );