mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-03 20:34:20 +01:00 
			
		
		
		
	Merge branch 'develop' into timeline
* develop: (45 commits) Showcase section to the docs - keepings docs up to date (#4055) bugfix: add missing d3 curves to flowchart and docs fix(deps): update dependency dagre-d3-es to v7.0.8 build(pre-commit): cache eslint in pre-commit build(lint): cache eslint with strategy content Update cypress/integration/rendering/sequencediagram.spec.js feat(er): allow leading underscore for attributes name ci(lint): show nice error on lint failure chore: add moment to dependencies Update docs Update mindmap.md chore: remove moment-mini docs(readme-ch): fix twitter link build(lint): cache prettier on `pnpm run lint` fix: moment-mini default exporter docs(readme): update broken twitter badge test(er): improve tests on multiple key constraints Fixes Typo, remove console.log doc(er): add documentation on multiple key constraints feat(er): allow multiple constraints on attributes ...
This commit is contained in:
		@@ -3,6 +3,42 @@
 | 
			
		||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
 | 
			
		||||
 | 
			
		||||
context('Sequence diagram', () => {
 | 
			
		||||
  it('should render a sequence diagram with boxes', () => {
 | 
			
		||||
    renderGraph(
 | 
			
		||||
      `
 | 
			
		||||
    sequenceDiagram
 | 
			
		||||
      box LightGrey Alice and Bob
 | 
			
		||||
      participant Alice
 | 
			
		||||
      participant Bob
 | 
			
		||||
      end
 | 
			
		||||
      participant John as John<br/>Second Line
 | 
			
		||||
      Alice ->> Bob: Hello Bob, how are you?
 | 
			
		||||
      Bob-->>John: How about you John?
 | 
			
		||||
      Bob--x Alice: I am good thanks!
 | 
			
		||||
      Bob-x John: I am good thanks!
 | 
			
		||||
      Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.
 | 
			
		||||
      Bob-->Alice: Checking with John...
 | 
			
		||||
      alt either this
 | 
			
		||||
        Alice->>John: Yes
 | 
			
		||||
        else or this
 | 
			
		||||
        Alice->>John: No
 | 
			
		||||
        else or this will happen
 | 
			
		||||
        Alice->John: Maybe
 | 
			
		||||
      end
 | 
			
		||||
      par this happens in parallel
 | 
			
		||||
      Alice -->> Bob: Parallel message 1
 | 
			
		||||
      and
 | 
			
		||||
      Alice -->> John: Parallel message 2
 | 
			
		||||
      end
 | 
			
		||||
    `,
 | 
			
		||||
      { sequence: { useMaxWidth: false } }
 | 
			
		||||
    );
 | 
			
		||||
    cy.get('svg').should((svg) => {
 | 
			
		||||
      const width = parseFloat(svg.attr('width'));
 | 
			
		||||
      expect(width).to.be.within(830 * 0.95, 830 * 1.05);
 | 
			
		||||
      expect(svg).to.not.have.attr('style');
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
  it('should render a simple sequence diagram', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user