mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-03 20:34:20 +01:00 
			
		
		
		
	feat: support multiple stereotypes in class diagrams
This commit is contained in:
		@@ -661,6 +661,19 @@ class Class10
 | 
			
		||||
      { logLevel: 1, htmlLabels: true, layout: 'elk' }
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('ELK: should render a class with a text label, members and multiple annotations', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
        class C1["Class 1 with text label"] {
 | 
			
		||||
            <<interface>> <<injected>>
 | 
			
		||||
            +member1
 | 
			
		||||
        }
 | 
			
		||||
        C1 -->  C2`,
 | 
			
		||||
      { logLevel: 1, htmlLabels: true, layout: 'elk' }
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('ELK: should render multiple classes with same text labels', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
 
 | 
			
		||||
@@ -661,6 +661,19 @@ class Class10
 | 
			
		||||
      { logLevel: 1, htmlLabels: true, look: 'handDrawn' }
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('HD: should render a class with a text label, membersand  multiple annotations', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
  class C1["Class 1 with text label"] {
 | 
			
		||||
    <<interface>> <<injected>>
 | 
			
		||||
    +member1
 | 
			
		||||
  }
 | 
			
		||||
  C1 -->  C2`,
 | 
			
		||||
      { logLevel: 1, htmlLabels: true, look: 'handDrawn' }
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('HD: should render multiple classes with same text labels', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
 
 | 
			
		||||
@@ -510,6 +510,16 @@ class Class10
 | 
			
		||||
  C1 -->  C2`
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
  it('should render a class with a text label, members and multiple annotations', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
  class C1["Class 1 with text label"] {
 | 
			
		||||
    <<interface>> <<injected>>
 | 
			
		||||
    +member1
 | 
			
		||||
  }
 | 
			
		||||
  C1 -->  C2`
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
  it('should render multiple classes with same text labels', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
 
 | 
			
		||||
@@ -657,6 +657,17 @@ class Class10
 | 
			
		||||
  C1 -->  C2`
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
  it('should render a class with a text label, members and multiple annotations', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
  class C1["Class 1 with text label"] {
 | 
			
		||||
    <<interface>> <<injected>>
 | 
			
		||||
    +member1
 | 
			
		||||
  }
 | 
			
		||||
  C1 -->  C2`
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should render multiple classes with same text labels', () => {
 | 
			
		||||
    imgSnapshotTest(
 | 
			
		||||
      `classDiagram
 | 
			
		||||
 
 | 
			
		||||
@@ -452,6 +452,20 @@ describe('Class diagram', () => {
 | 
			
		||||
      <<Interface>> \`This\nTitle\nHas\nMany\nNewlines\`  
 | 
			
		||||
    `);
 | 
			
		||||
  });
 | 
			
		||||
  it('should render with newlines in title and multiple annotations', () => {
 | 
			
		||||
    imgSnapshotTest(`
 | 
			
		||||
    classDiagram
 | 
			
		||||
      class \`This\nTitle\nHas\nMany\nNewlines\` {
 | 
			
		||||
        +String Also
 | 
			
		||||
        -String Many
 | 
			
		||||
        #int Members
 | 
			
		||||
        +And()
 | 
			
		||||
        -Many()
 | 
			
		||||
        #Methods()
 | 
			
		||||
      }
 | 
			
		||||
      <<Interface>> <<Service>> \`This\nTitle\nHas\nMany\nNewlines\`  
 | 
			
		||||
    `);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should handle newline title in namespace', () => {
 | 
			
		||||
    imgSnapshotTest(`
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user