mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-21 17:26:45 +02:00
Merge pull request #4340 from RohanHandore/patch-1
Refactor `cypress/helpers/util.ts`
This commit is contained in:
@@ -52,29 +52,18 @@ export const imgSnapshotTest = (
|
|||||||
api = false,
|
api = false,
|
||||||
validation?: any
|
validation?: any
|
||||||
): void => {
|
): void => {
|
||||||
cy.log(JSON.stringify(_options));
|
const options: CypressMermaidConfig = {
|
||||||
const options: CypressMermaidConfig = Object.assign(_options);
|
..._options,
|
||||||
if (!options.fontFamily) {
|
fontFamily: _options.fontFamily || 'courier',
|
||||||
options.fontFamily = 'courier';
|
// @ts-ignore TODO: Fix type of fontSize
|
||||||
}
|
fontSize: _options.fontSize || '16px',
|
||||||
if (!options.sequence) {
|
sequence: {
|
||||||
options.sequence = {};
|
...(_options.sequence || {}),
|
||||||
}
|
actorFontFamily: 'courier',
|
||||||
if (!options.sequence || (options.sequence && !options.sequence.actorFontFamily)) {
|
noteFontFamily: _options.sequence?.noteFontFamily || 'courier',
|
||||||
options.sequence.actorFontFamily = 'courier';
|
messageFontFamily: 'courier',
|
||||||
}
|
},
|
||||||
if (options.sequence && !options.sequence.noteFontFamily) {
|
};
|
||||||
options.sequence.noteFontFamily = 'courier';
|
|
||||||
}
|
|
||||||
options.sequence.actorFontFamily = 'courier';
|
|
||||||
options.sequence.noteFontFamily = 'courier';
|
|
||||||
options.sequence.messageFontFamily = 'courier';
|
|
||||||
if (options.sequence && !options.sequence.actorFontFamily) {
|
|
||||||
options.sequence.actorFontFamily = 'courier';
|
|
||||||
}
|
|
||||||
if (!options.fontSize) {
|
|
||||||
options.fontSize = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
const url: string = mermaidUrl(graphStr, options, api);
|
const url: string = mermaidUrl(graphStr, options, api);
|
||||||
openURLAndVerifyRendering(url, options, validation);
|
openURLAndVerifyRendering(url, options, validation);
|
||||||
@@ -82,11 +71,10 @@ export const imgSnapshotTest = (
|
|||||||
|
|
||||||
export const urlSnapshotTest = (
|
export const urlSnapshotTest = (
|
||||||
url: string,
|
url: string,
|
||||||
_options: CypressMermaidConfig,
|
options: CypressMermaidConfig,
|
||||||
_api = false,
|
_api = false,
|
||||||
validation?: any
|
validation?: any
|
||||||
): void => {
|
): void => {
|
||||||
const options: CypressMermaidConfig = Object.assign(_options);
|
|
||||||
openURLAndVerifyRendering(url, options, validation);
|
openURLAndVerifyRendering(url, options, validation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user