mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-03 20:34:20 +01:00 
			
		
		
		
	Merge branch 'develop' into bug/#4497_unable-to-cherrypick-merge-commit
This commit is contained in:
		@@ -729,6 +729,18 @@ A ~~~ B
 | 
			
		||||
      {}
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('5064: Should render when subgraph child has links to outside node and subgraph', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `flowchart TB
 | 
			
		||||
    Out --> In
 | 
			
		||||
    subgraph Sub
 | 
			
		||||
      In
 | 
			
		||||
    end
 | 
			
		||||
    Sub --> In`
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  describe('Markdown strings flowchart (#4220)', () => {
 | 
			
		||||
    describe('html labels', () => {
 | 
			
		||||
      it('With styling and classes', () => {
 | 
			
		||||
@@ -874,4 +886,93 @@ end
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
  describe('Subgraph title margins', () => {
 | 
			
		||||
    it('Should render subgraphs with title margins set (LR)', () => {
 | 
			
		||||
      imgSnapshotTest(
 | 
			
		||||
        `flowchart LR
 | 
			
		||||
 | 
			
		||||
          subgraph TOP
 | 
			
		||||
              direction TB
 | 
			
		||||
              subgraph B1
 | 
			
		||||
                  direction RL
 | 
			
		||||
                  i1 -->f1
 | 
			
		||||
              end
 | 
			
		||||
              subgraph B2
 | 
			
		||||
                  direction BT
 | 
			
		||||
                  i2 -->f2
 | 
			
		||||
              end
 | 
			
		||||
          end
 | 
			
		||||
          A --> TOP --> B
 | 
			
		||||
          B1 --> B2
 | 
			
		||||
        `,
 | 
			
		||||
        { flowchart: { subGraphTitleMargin: { top: 10, bottom: 5 } } }
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    it('Should render subgraphs with title margins set (TD)', () => {
 | 
			
		||||
      imgSnapshotTest(
 | 
			
		||||
        `flowchart TD
 | 
			
		||||
 | 
			
		||||
          subgraph TOP
 | 
			
		||||
              direction LR
 | 
			
		||||
              subgraph B1
 | 
			
		||||
                  direction RL
 | 
			
		||||
                  i1 -->f1
 | 
			
		||||
              end
 | 
			
		||||
              subgraph B2
 | 
			
		||||
                  direction BT
 | 
			
		||||
                  i2 -->f2
 | 
			
		||||
              end
 | 
			
		||||
          end
 | 
			
		||||
          A --> TOP --> B
 | 
			
		||||
          B1 --> B2
 | 
			
		||||
        `,
 | 
			
		||||
        { flowchart: { subGraphTitleMargin: { top: 8, bottom: 16 } } }
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    it('Should render subgraphs with title margins set (LR) and htmlLabels set to false', () => {
 | 
			
		||||
      imgSnapshotTest(
 | 
			
		||||
        `flowchart LR
 | 
			
		||||
 | 
			
		||||
          subgraph TOP
 | 
			
		||||
              direction TB
 | 
			
		||||
              subgraph B1
 | 
			
		||||
                  direction RL
 | 
			
		||||
                  i1 -->f1
 | 
			
		||||
              end
 | 
			
		||||
              subgraph B2
 | 
			
		||||
                  direction BT
 | 
			
		||||
                  i2 -->f2
 | 
			
		||||
              end
 | 
			
		||||
          end
 | 
			
		||||
          A --> TOP --> B
 | 
			
		||||
          B1 --> B2
 | 
			
		||||
        `,
 | 
			
		||||
        {
 | 
			
		||||
          htmlLabels: false,
 | 
			
		||||
          flowchart: { htmlLabels: false, subGraphTitleMargin: { top: 10, bottom: 5 } },
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    it('Should render subgraphs with title margins and edge labels', () => {
 | 
			
		||||
      imgSnapshotTest(
 | 
			
		||||
        `flowchart LR
 | 
			
		||||
 | 
			
		||||
          subgraph TOP
 | 
			
		||||
              direction TB
 | 
			
		||||
              subgraph B1
 | 
			
		||||
                  direction RL
 | 
			
		||||
                  i1 --lb1-->f1
 | 
			
		||||
              end
 | 
			
		||||
              subgraph B2
 | 
			
		||||
                  direction BT
 | 
			
		||||
                  i2 --lb2-->f2
 | 
			
		||||
              end
 | 
			
		||||
          end
 | 
			
		||||
          A --lb3--> TOP --lb4--> B
 | 
			
		||||
          B1 --lb5--> B2
 | 
			
		||||
        `,
 | 
			
		||||
        { flowchart: { subGraphTitleMargin: { top: 10, bottom: 5 } } }
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ describe('pie chart', () => {
 | 
			
		||||
      const style = svg.attr('style');
 | 
			
		||||
      expect(style).to.match(/^max-width: [\d.]+px;$/);
 | 
			
		||||
      const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
 | 
			
		||||
      expect(maxWidthValue).to.eq(984);
 | 
			
		||||
      expect(maxWidthValue).to.be.within(590, 600); // depends on installed fonts: 596.2 on my PC, 597.5 on CI
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
@@ -59,7 +59,7 @@ describe('pie chart', () => {
 | 
			
		||||
    );
 | 
			
		||||
    cy.get('svg').should((svg) => {
 | 
			
		||||
      const width = parseFloat(svg.attr('width'));
 | 
			
		||||
      expect(width).to.eq(984);
 | 
			
		||||
      expect(width).to.be.within(590, 600); // depends on installed fonts: 596.2 on my PC, 597.5 on CI
 | 
			
		||||
      expect(svg).to.not.have.attr('style');
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user