From d3308232e8f51e2082e258b8992ba19e17418600 Mon Sep 17 00:00:00 2001 From: saurabhg772244 Date: Mon, 7 Oct 2024 16:11:31 +0530 Subject: [PATCH] updated test case for icon shape --- cypress/integration/rendering/iconShape.spec.ts | 17 +++++++++++++++++ cypress/platform/viewer.js | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/cypress/integration/rendering/iconShape.spec.ts b/cypress/integration/rendering/iconShape.spec.ts index 389e2d94d..e35ad860c 100644 --- a/cypress/integration/rendering/iconShape.spec.ts +++ b/cypress/integration/rendering/iconShape.spec.ts @@ -124,3 +124,20 @@ describe('Test iconShape with different h', () => { imgSnapshotTest(flowchartCode); }); }); + +describe('Test colored iconShape', () => { + it('with no styles', () => { + let flowchartCode = `flowchart TB\n`; + const icon = 'logos:aws'; + flowchartCode += ` nA --> nAA@{ icon: '${icon}', form: 'square', label: 'icon with color' }\n`; + imgSnapshotTest(flowchartCode); + }); + + it('with styles', () => { + let flowchartCode = `flowchart TB\n`; + const icon = 'logos:aws'; + flowchartCode += ` nA --> nAA@{ icon: '${icon}', form: 'square', label: 'icon with color' }\n`; + flowchartCode += ` style nAA fill:#f9f,stroke:#333,stroke-width:4px \n`; + imgSnapshotTest(flowchartCode); + }); +}); diff --git a/cypress/platform/viewer.js b/cypress/platform/viewer.js index 2882be130..58d317589 100644 --- a/cypress/platform/viewer.js +++ b/cypress/platform/viewer.js @@ -61,11 +61,26 @@ const contentLoaded = async function () { width: 512, height: 512, }; + const staticAwsLogoIconPack = { + prefix: 'logos', + icons: { + aws: { + body: '', + height: 153, + }, + }, + width: 256, + height: 256, + }; mermaid.registerIconPacks([ { name: 'fa', loader: () => staticBellIconPack, }, + { + name: 'logos', + loader: () => staticAwsLogoIconPack, + }, ]); await mermaid.run(); }