| 1 | import { imgSnapshotTest } from '../../helpers/util.ts'; |
| 2 | |
| 3 | const themes = ['default', 'forest', 'dark', 'base', 'neutral']; |
| 4 | |
| 5 | describe('when rendering flowchart with icons', () => { |
| 6 | for (const theme of themes) { |
| 7 | it(`should render icons from fontawesome library on theme ${theme}`, () => { |
| 8 | imgSnapshotTest( |
| 9 | `flowchart TD |
| 10 | A("fab:fa-twitter Twitter") --> B("fab:fa-facebook Facebook") |
| 11 | B --> C("fa:fa-coffee Coffee") |
| 12 | C --> D("fa:fa-car Car") |
| 13 | D --> E("fab:fa-github GitHub") |
| 14 | `, |
| 15 | { theme } |
| 16 | ); |
| 17 | }); |
| 18 | |
| 19 | it(`should render registered icons on theme ${theme}`, () => { |
| 20 | imgSnapshotTest( |
| 21 | `flowchart TD |
| 22 | A("fa:fa-bell Bell") |
| 23 | `, |
| 24 | { theme } |
| 25 | ); |
| 26 | }); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Test for GitHub issue #7185 |
| 31 | * SVG Logos have unintended opacity being applied when they use rect elements |
| 32 | * |
| 33 | */ |
| 34 | describe('iconShape with rect elements (issue #7185)', () => { |
| 35 | it('should render single AWS icon with rect elements without unintended opacity', () => { |
| 36 | imgSnapshotTest( |
| 37 | `flowchart TB |
| 38 | Cloudwatch@{ icon: "aws:arch-amazon-cloudwatch" } |
| 39 | `, |
| 40 | {} |
| 41 | ); |
| 42 | }); |
| 43 | |
| 44 | it('should render multiple AWS icons with rect elements in a flowchart', () => { |
| 45 | imgSnapshotTest( |
| 46 | `flowchart TB |
| 47 | Cloudwatch@{ icon: "aws:arch-amazon-cloudwatch" } |
| 48 | Cloudfront@{ icon: "aws:arch-amazon-route-53" } |
| 49 | Route53@{ icon: "aws:arch-amazon-eks-cloud" } |
| 50 | Cloudwatch --> Cloudfront |
| 51 | Cloudfront --> Route53 |
| 52 | `, |
| 53 | {} |
| 54 | ); |
| 55 | }); |
| 56 | |
| 57 | it('should render AWS icons with labels and rect elements', () => { |
| 58 | imgSnapshotTest( |
| 59 | `flowchart TB |
| 60 | Cloudwatch@{ icon: "aws:arch-amazon-cloudwatch", label: "CloudWatch" } |
| 61 | Route53@{ icon: "aws:arch-amazon-route-53", label: "Route 53" } |
| 62 | EKS@{ icon: "aws:arch-amazon-eks-cloud", label: "EKS Cloud" } |
| 63 | Cloudwatch --> Route53 |
| 64 | Route53 --> EKS |
| 65 | `, |
| 66 | {} |
| 67 | ); |
| 68 | }); |
| 69 | }); |
| 70 | }); |
| 71 | |