collab/mermaid/cypress/integration/rendering/flowchart-icon.spec.jsblame
View source
6dd74de1import { imgSnapshotTest } from '../../helpers/util.ts';
6dd74de2
6dd74de3const themes = ['default', 'forest', 'dark', 'base', 'neutral'];
6dd74de4
6dd74de5describe('when rendering flowchart with icons', () => {
6dd74de6 for (const theme of themes) {
6dd74de7 it(`should render icons from fontawesome library on theme ${theme}`, () => {
6dd74de8 imgSnapshotTest(
6dd74de9 `flowchart TD
6dd74de10 A("fab:fa-twitter Twitter") --> B("fab:fa-facebook Facebook")
6dd74de11 B --> C("fa:fa-coffee Coffee")
6dd74de12 C --> D("fa:fa-car Car")
6dd74de13 D --> E("fab:fa-github GitHub")
6dd74de14 `,
6dd74de15 { theme }
6dd74de16 );
6dd74de17 });
6dd74de18
6dd74de19 it(`should render registered icons on theme ${theme}`, () => {
6dd74de20 imgSnapshotTest(
6dd74de21 `flowchart TD
6dd74de22 A("fa:fa-bell Bell")
6dd74de23 `,
6dd74de24 { theme }
6dd74de25 );
6dd74de26 });
6dd74de27 }
6dd74de28
6dd74de29 /**
6dd74de30 * Test for GitHub issue #7185
6dd74de31 * SVG Logos have unintended opacity being applied when they use rect elements
6dd74de32 *
6dd74de33 */
6dd74de34 describe('iconShape with rect elements (issue #7185)', () => {
6dd74de35 it('should render single AWS icon with rect elements without unintended opacity', () => {
6dd74de36 imgSnapshotTest(
6dd74de37 `flowchart TB
6dd74de38 Cloudwatch@{ icon: "aws:arch-amazon-cloudwatch" }
6dd74de39 `,
6dd74de40 {}
6dd74de41 );
6dd74de42 });
6dd74de43
6dd74de44 it('should render multiple AWS icons with rect elements in a flowchart', () => {
6dd74de45 imgSnapshotTest(
6dd74de46 `flowchart TB
6dd74de47 Cloudwatch@{ icon: "aws:arch-amazon-cloudwatch" }
6dd74de48 Cloudfront@{ icon: "aws:arch-amazon-route-53" }
6dd74de49 Route53@{ icon: "aws:arch-amazon-eks-cloud" }
6dd74de50 Cloudwatch --> Cloudfront
6dd74de51 Cloudfront --> Route53
6dd74de52 `,
6dd74de53 {}
6dd74de54 );
6dd74de55 });
6dd74de56
6dd74de57 it('should render AWS icons with labels and rect elements', () => {
6dd74de58 imgSnapshotTest(
6dd74de59 `flowchart TB
6dd74de60 Cloudwatch@{ icon: "aws:arch-amazon-cloudwatch", label: "CloudWatch" }
6dd74de61 Route53@{ icon: "aws:arch-amazon-route-53", label: "Route 53" }
6dd74de62 EKS@{ icon: "aws:arch-amazon-eks-cloud", label: "EKS Cloud" }
6dd74de63 Cloudwatch --> Route53
6dd74de64 Route53 --> EKS
6dd74de65 `,
6dd74de66 {}
6dd74de67 );
6dd74de68 });
6dd74de69 });
6dd74de70});