mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
resolves #1490 consistent SVG height and width between diagrams
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* eslint-env jasmine */
|
||||
import utils from './utils';
|
||||
import utils from './utils';
|
||||
|
||||
describe('when assignWithDepth: should merge objects within objects', function() {
|
||||
it('should handle simple, depth:1 types (identity)', function() {
|
||||
@@ -171,7 +171,6 @@ Alice->Bob: hi`;
|
||||
expect(type).toBe('git');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when finding substring in array ', function() {
|
||||
it('should return the array index that contains the substring', function() {
|
||||
const arr = ['stroke:val1', 'fill:val2'];
|
||||
@@ -184,7 +183,6 @@ describe('when finding substring in array ', function() {
|
||||
expect(result).toEqual(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when formatting urls', function() {
|
||||
it('should handle links', function() {
|
||||
const url = 'https://mermaid-js.github.io/mermaid/#/';
|
||||
@@ -242,3 +240,16 @@ describe('when formatting urls', function() {
|
||||
expect(result).toEqual('about:blank');
|
||||
});
|
||||
});
|
||||
describe('when calculating SVG size', function() {
|
||||
it('should return width 100% when useMaxWidth is true', function () {
|
||||
const attrs = utils.calculateSvgSizeAttrs(100, 200, true);
|
||||
expect(attrs.get('height')).toEqual(100);
|
||||
expect(attrs.get('style')).toEqual('max-width: 200px;');
|
||||
expect(attrs.get('width')).toEqual('100%');
|
||||
});
|
||||
it('should return absolute width when useMaxWidth is false', function () {
|
||||
const attrs = utils.calculateSvgSizeAttrs(100, 200, false);
|
||||
expect(attrs.get('height')).toEqual(100);
|
||||
expect(attrs.get('width')).toEqual(200);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user