mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
Refactor code
This commit is contained in:
@@ -5,40 +5,20 @@
|
||||
/**
|
||||
* Created by knut on 14-11-23.
|
||||
*/
|
||||
// var rewire = require('rewire');
|
||||
var mermaid = require('./mermaid')
|
||||
// var log = require('./logger').create();
|
||||
|
||||
describe('when using mermaid and ', function () {
|
||||
describe('when detecting chart type ', function () {
|
||||
// var mermaid;
|
||||
// var document;
|
||||
// var window;
|
||||
beforeEach(function () {
|
||||
// var MockBrowser = require('mock-browser').mocks.MockBrowser;
|
||||
// var mock = new MockBrowser();
|
||||
//
|
||||
// delete global.mermaid_config;
|
||||
//
|
||||
/// / and in the run-code inside some object
|
||||
// global.document = mock.getDocument();
|
||||
// global.window = mock.getWindow();
|
||||
|
||||
})
|
||||
|
||||
it('should not start rendering with mermaid_config.startOnLoad set to false', function () {
|
||||
// mermaid = rewire('./mermaid');
|
||||
global.mermaid_config = {startOnLoad: false}
|
||||
|
||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>'
|
||||
spyOn(global.mermaid, 'init')
|
||||
// log.debug(mermaid);
|
||||
mermaid.contentLoaded()
|
||||
expect(global.mermaid.init).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should not start rendering with mermaid.startOnLoad set to false', function () {
|
||||
// mermaid = rewire('./mermaid');
|
||||
global.mermaid.startOnLoad = false
|
||||
global.mermaid_config = {startOnLoad: true}
|
||||
|
||||
@@ -49,7 +29,6 @@ describe('when using mermaid and ', function () {
|
||||
})
|
||||
|
||||
it('should start rendering with both startOnLoad set', function () {
|
||||
// mermaid = rewire('./mermaid');
|
||||
global.mermaid.startOnLoad = true
|
||||
global.mermaid_config = {startOnLoad: true}
|
||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>'
|
||||
@@ -59,7 +38,6 @@ describe('when using mermaid and ', function () {
|
||||
})
|
||||
|
||||
it('should start rendering with mermaid.startOnLoad set and no mermaid_config defined', function () {
|
||||
// mermaid = rewire('./mermaid');
|
||||
global.mermaid.startOnLoad = true
|
||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>'
|
||||
spyOn(global.mermaid, 'init')
|
||||
@@ -68,7 +46,6 @@ describe('when using mermaid and ', function () {
|
||||
})
|
||||
|
||||
it('should start rendering as a default with no changes performed', function () {
|
||||
// mermaid = rewire('./mermaid');
|
||||
document.body.innerHTML = '<div class="mermaid">graph TD;\na;</div>'
|
||||
spyOn(global.mermaid, 'init')
|
||||
mermaid.contentLoaded()
|
||||
@@ -83,12 +60,8 @@ describe('when using mermaid and ', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
global.mermaid_config = {startOnLoad: false}
|
||||
// var MockBrowser = require('mock-browser').mocks.MockBrowser;
|
||||
// var mock = new MockBrowser();
|
||||
flow.parser.yy = graph
|
||||
graph.clear()
|
||||
// global.document = mock.getDocument();
|
||||
// mermaid = rewire('./mermaid');
|
||||
})
|
||||
it('it should handle edges with text', function () {
|
||||
flow.parser.parse('graph TD;A-->|text ex|B;')
|
||||
|
Reference in New Issue
Block a user