diff --git a/src/diagrams/sequenceDiagram/sequenceDiagram.spec.js b/src/diagrams/sequenceDiagram/sequenceDiagram.spec.js index 04ba2bbee..4aba15459 100644 --- a/src/diagrams/sequenceDiagram/sequenceDiagram.spec.js +++ b/src/diagrams/sequenceDiagram/sequenceDiagram.spec.js @@ -730,8 +730,6 @@ describe('when rendering a sequenceDiagram', function () { parser.yy = sequenceDb parser.yy.clear() - delete global.mermaid_config - NewD3 = function () { const o = { append: function () { diff --git a/src/mermaid.js b/src/mermaid.js index d141265e1..59cb2580b 100644 --- a/src/mermaid.js +++ b/src/mermaid.js @@ -66,9 +66,6 @@ const init = function () { : nodes instanceof window.Node ? [nodes] : nodes // Last case - sequence config was passed pick next - if (typeof global.mermaid_config !== 'undefined') { - mermaidAPI.initialize(global.mermaid_config) - } logger.debug('Start On Load before: ' + mermaid.startOnLoad) if (typeof mermaid.startOnLoad !== 'undefined') { logger.debug('Start On Load inner: ' + mermaid.startOnLoad) @@ -133,26 +130,12 @@ const initialize = function (config) { */ const contentLoaded = function () { let config - // Check state of start config mermaid namespace - if (typeof global.mermaid_config !== 'undefined') { - if (global.mermaid_config.htmlLabels === false) { - mermaid.htmlLabels = false - } - } if (mermaid.startOnLoad) { - // For backwards compatability reasons also check mermaid_config variable - if (typeof global.mermaid_config !== 'undefined') { - // Check if property startOnLoad is set - if (global.mermaid_config.startOnLoad === true) { - mermaid.init() - } - } else { - // No config found, do check API config - config = mermaidAPI.getConfig() - if (config.startOnLoad) { - mermaid.init() - } + // No config found, do check API config + config = mermaidAPI.getConfig() + if (config.startOnLoad) { + mermaid.init() } } else { if (typeof mermaid.startOnLoad === 'undefined') { diff --git a/src/mermaid.spec.js b/src/mermaid.spec.js index 433ba8863..37e3c5516 100644 --- a/src/mermaid.spec.js +++ b/src/mermaid.spec.js @@ -6,19 +6,8 @@ import flowRenderer from './diagrams/flowchart/flowRenderer' describe('when using mermaid and ', function () { describe('when detecting chart type ', function () { - it('should not start rendering with mermaid_config.startOnLoad set to false', function () { - global.mermaid_config = { startOnLoad: false } - - document.body.innerHTML = '
graph TD;\na;
' - spyOn(mermaid, 'init') - mermaid.contentLoaded() - expect(mermaid.init).not.toHaveBeenCalled() - }) - it('should not start rendering with mermaid.startOnLoad set to false', function () { mermaid.startOnLoad = false - global.mermaid_config = { startOnLoad: true } - document.body.innerHTML = '
graph TD;\na;
' spyOn(mermaid, 'init') mermaid.contentLoaded() @@ -27,14 +16,13 @@ describe('when using mermaid and ', function () { it('should start rendering with both startOnLoad set', function () { mermaid.startOnLoad = true - global.mermaid_config = { startOnLoad: true } document.body.innerHTML = '
graph TD;\na;
' spyOn(mermaid, 'init') mermaid.contentLoaded() expect(mermaid.init).toHaveBeenCalled() }) - it('should start rendering with mermaid.startOnLoad set and no mermaid_config defined', function () { + it('should start rendering with mermaid.startOnLoad', function () { mermaid.startOnLoad = true document.body.innerHTML = '
graph TD;\na;
' spyOn(mermaid, 'init') @@ -52,7 +40,6 @@ describe('when using mermaid and ', function () { describe('when calling addEdges ', function () { beforeEach(function () { - global.mermaid_config = { startOnLoad: false } flowParser.parser.yy = graphDb graphDb.clear() }) diff --git a/src/mermaidAPI.spec.js b/src/mermaidAPI.spec.js index 5ed3cbd5e..51749677c 100644 --- a/src/mermaidAPI.spec.js +++ b/src/mermaidAPI.spec.js @@ -4,7 +4,6 @@ import mermaidAPI from './mermaidAPI' describe('when using mermaidAPI and ', function () { describe('doing initialize ', function () { beforeEach(function () { - delete global.mermaid_config document.body.innerHTML = '' }) diff --git a/todo.md b/todo.md index e6c4e232e..65f24b34c 100644 --- a/todo.md +++ b/todo.md @@ -1,6 +1,5 @@ - Get familar with jison - git graph requires a blank line at the end. why? -- global.mermaid_config - rewrite logger - rewrite less code - Setup code coverage