mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-11 00:26:08 +01:00
* Fix #36515 * Fix #23076 * Remove unnecessary `mermaid.parse` * Fix data race when using `data-render-done` * Remove unnecessary `Promise.all` * Fix duplicate `load` event and duplicate SVG node rendering * Remove unnecessary `IntersectionObserver` * Add `bindFunctions` call, the old comment seems not true
60 lines
1.1 KiB
TypeScript
60 lines
1.1 KiB
TypeScript
import {sourceNeedsElk} from './mermaid.ts';
|
|
import {dedent} from '../utils/testhelper.ts';
|
|
|
|
test('MermaidConfigLayoutCheck', () => {
|
|
expect(sourceNeedsElk(dedent(`
|
|
flowchart TB
|
|
elk --> B
|
|
`))).toEqual(false);
|
|
|
|
expect(sourceNeedsElk(dedent(`
|
|
---
|
|
config:
|
|
layout : elk
|
|
---
|
|
flowchart TB
|
|
A --> B
|
|
`))).toEqual(true);
|
|
|
|
expect(sourceNeedsElk(dedent(`
|
|
---
|
|
config:
|
|
layout: elk.layered
|
|
---
|
|
flowchart TB
|
|
A --> B
|
|
`))).toEqual(true);
|
|
|
|
expect(sourceNeedsElk(`
|
|
%%{ init : { "flowchart": { "defaultRenderer": "elk" } } }%%
|
|
flowchart TB
|
|
A --> B
|
|
`)).toEqual(true);
|
|
|
|
expect(sourceNeedsElk(dedent(`
|
|
---
|
|
config:
|
|
layout: 123
|
|
---
|
|
%%{ init : { "class": { "defaultRenderer": "elk.any" } } }%%
|
|
flowchart TB
|
|
A --> B
|
|
`))).toEqual(true);
|
|
|
|
expect(sourceNeedsElk(`
|
|
%%{init:{
|
|
"layout" : "elk.layered"
|
|
}}%%
|
|
flowchart TB
|
|
A --> B
|
|
`)).toEqual(true);
|
|
|
|
expect(sourceNeedsElk(`
|
|
%%{ initialize: {
|
|
'layout' : 'elk.layered'
|
|
}}%%
|
|
flowchart TB
|
|
A --> B
|
|
`)).toEqual(true);
|
|
});
|