mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-04 12:54:08 +01:00 
			
		
		
		
	Fix for amp and adjusted tests
This commit is contained in:
		@@ -126,7 +126,7 @@ aliasSets.forEach((aliasSet) => {
 | 
			
		||||
    it(`All ${aliasSet.join(',')} should render same shape`, () => {
 | 
			
		||||
      let flowchartCode = `flowchart \n`;
 | 
			
		||||
      aliasSet.forEach((alias, index) => {
 | 
			
		||||
        flowchartCode += ` n${index}@{ shape: ${alias}, label: "${alias}" }@\n`;
 | 
			
		||||
        flowchartCode += ` n${index}@{ shape: ${alias}, label: "${alias}" }\n`;
 | 
			
		||||
      });
 | 
			
		||||
      imgSnapshotTest(flowchartCode);
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (form) {
 | 
			
		||||
              flowchartCode += `, form: '${form}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
          });
 | 
			
		||||
 | 
			
		||||
@@ -29,7 +29,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (pos) {
 | 
			
		||||
              flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
          });
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +42,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (pos) {
 | 
			
		||||
              flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
          });
 | 
			
		||||
 | 
			
		||||
@@ -55,7 +55,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (pos) {
 | 
			
		||||
              flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
          });
 | 
			
		||||
 | 
			
		||||
@@ -68,7 +68,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (pos) {
 | 
			
		||||
              flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, {
 | 
			
		||||
              look,
 | 
			
		||||
              htmlLabels: false,
 | 
			
		||||
@@ -85,7 +85,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (pos) {
 | 
			
		||||
              flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            flowchartCode += `  style nAA fill:#f9f,stroke:#333,stroke-width:4px \n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
          });
 | 
			
		||||
@@ -100,7 +100,7 @@ looks.forEach((look) => {
 | 
			
		||||
            if (pos) {
 | 
			
		||||
              flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
            }
 | 
			
		||||
            flowchartCode += ` }@\n`;
 | 
			
		||||
            flowchartCode += ` }\n`;
 | 
			
		||||
            flowchartCode += `  nAA:::customClazz\n`;
 | 
			
		||||
            imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
          });
 | 
			
		||||
@@ -115,7 +115,7 @@ describe('Test iconShape with different h', () => {
 | 
			
		||||
    let flowchartCode = `flowchart TB\n`;
 | 
			
		||||
    const icon = 'fa:bell';
 | 
			
		||||
    const iconHeight = 64;
 | 
			
		||||
    flowchartCode += `  nA --> nAA@{ icon: '${icon}', label: 'icon with different h', h: ${iconHeight} }@\n`;
 | 
			
		||||
    flowchartCode += `  nA --> nAA@{ icon: '${icon}', label: 'icon with different h', h: ${iconHeight} }\n`;
 | 
			
		||||
    imgSnapshotTest(flowchartCode);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ looks.forEach((look) => {
 | 
			
		||||
      describe(`Test imageShape in ${look} look and dir ${direction} with label position ${pos ? pos : 'not defined'}`, () => {
 | 
			
		||||
        it(`without label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          flowchartCode += `  nA --> A@{ img: 'https://cdn.pixabay.com/photo/2020/02/22/18/49/paper-4871356_1280.jpg', w: '100', h: '100' }@\n`;
 | 
			
		||||
          flowchartCode += `  nA --> A@{ img: 'https://cdn.pixabay.com/photo/2020/02/22/18/49/paper-4871356_1280.jpg', w: '100', h: '100' }\n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@@ -22,7 +22,7 @@ looks.forEach((look) => {
 | 
			
		||||
          if (pos) {
 | 
			
		||||
            flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
          }
 | 
			
		||||
          flowchartCode += ` }@\n`;
 | 
			
		||||
          flowchartCode += ` }\n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@@ -34,7 +34,7 @@ looks.forEach((look) => {
 | 
			
		||||
          if (pos) {
 | 
			
		||||
            flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
          }
 | 
			
		||||
          flowchartCode += ` }@\n`;
 | 
			
		||||
          flowchartCode += ` }\n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@@ -46,7 +46,7 @@ looks.forEach((look) => {
 | 
			
		||||
          if (pos) {
 | 
			
		||||
            flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
          }
 | 
			
		||||
          flowchartCode += ` }@\n`;
 | 
			
		||||
          flowchartCode += ` }\n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look, htmlLabels: true });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@@ -58,7 +58,7 @@ looks.forEach((look) => {
 | 
			
		||||
          if (pos) {
 | 
			
		||||
            flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
          }
 | 
			
		||||
          flowchartCode += ` }@\n`;
 | 
			
		||||
          flowchartCode += ` }\n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, {
 | 
			
		||||
            look,
 | 
			
		||||
            htmlLabels: false,
 | 
			
		||||
@@ -74,7 +74,7 @@ looks.forEach((look) => {
 | 
			
		||||
          if (pos) {
 | 
			
		||||
            flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
          }
 | 
			
		||||
          flowchartCode += ` }@\n`;
 | 
			
		||||
          flowchartCode += ` }\n`;
 | 
			
		||||
          flowchartCode += `  style A fill:#f9f,stroke:#333,stroke-width:4px \n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -88,7 +88,7 @@ looks.forEach((look) => {
 | 
			
		||||
          if (pos) {
 | 
			
		||||
            flowchartCode += `, pos: '${pos}'`;
 | 
			
		||||
          }
 | 
			
		||||
          flowchartCode += ` }@\n`;
 | 
			
		||||
          flowchartCode += ` }\n`;
 | 
			
		||||
          flowchartCode += `  A:::customClazz\n`;
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`without label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape} }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape} }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -67,7 +67,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -75,7 +75,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`connect all shapes with each other`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index}${index}@{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index}${index}{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          for (let i = 0; i < newShapesSet.length; i++) {
 | 
			
		||||
            for (let j = i + 1; j < newShapesSet.length; j++) {
 | 
			
		||||
@@ -88,7 +88,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with very long label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is a very very very very very long long long label for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape}, label: 'This is a very very very very very long long long label for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -96,7 +96,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with markdown htmlLabels:true`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -104,7 +104,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with markdown htmlLabels:false`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, {
 | 
			
		||||
            look,
 | 
			
		||||
@@ -116,7 +116,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with styles`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'new ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape}, label: 'new ${newShape} shape' }\n`;
 | 
			
		||||
            flowchartCode += `  style n${index}${index} fill:#f9f,stroke:#333,stroke-width:4px \n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
@@ -126,7 +126,7 @@ looks.forEach((look) => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          flowchartCode += `  classDef customClazz fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5\n`;
 | 
			
		||||
          newShapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'new ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}{ shape: ${newShape}, label: 'new ${newShape} shape' }\n`;
 | 
			
		||||
            flowchartCode += `  n${index}${index}:::customClazz\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`without label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape} }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape} }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -31,7 +31,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -39,7 +39,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`connect all shapes with each other`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index}${index}@{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index}${index}@{ shape: ${newShape}, label: 'This is a label for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          for (let i = 0; i < shapesSet.length; i++) {
 | 
			
		||||
            for (let j = i + 1; j < shapesSet.length; j++) {
 | 
			
		||||
@@ -52,7 +52,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with very long label`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is a very very very very very long long long label for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is a very very very very very long long long label for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -60,7 +60,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with markdown htmlLabels:true`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
        });
 | 
			
		||||
@@ -68,7 +68,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with markdown htmlLabels:false`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'This is **bold** </br>and <strong>strong</strong> for ${newShape} shape' }\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, {
 | 
			
		||||
            look,
 | 
			
		||||
@@ -80,7 +80,7 @@ looks.forEach((look) => {
 | 
			
		||||
        it(`with styles`, () => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'new ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'new ${newShape} shape' }\n`;
 | 
			
		||||
            flowchartCode += `  style n${index}${index} fill:#f9f,stroke:#333,stroke-width:4px \n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
@@ -90,7 +90,7 @@ looks.forEach((look) => {
 | 
			
		||||
          let flowchartCode = `flowchart ${direction}\n`;
 | 
			
		||||
          flowchartCode += `  classDef customClazz fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5\n`;
 | 
			
		||||
          shapesSet.forEach((newShape, index) => {
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'new ${newShape} shape' }@\n`;
 | 
			
		||||
            flowchartCode += `  n${index} --> n${index}${index}@{ shape: ${newShape}, label: 'new ${newShape} shape' }\n`;
 | 
			
		||||
            flowchartCode += `  n${index}${index}:::customClazz\n`;
 | 
			
		||||
          });
 | 
			
		||||
          imgSnapshotTest(flowchartCode, { look });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user