mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 07:49:43 +02:00
Replace require with import
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import graph from '../graphDb'
|
||||
import graphDb from '../graphDb'
|
||||
import flow from './flow'
|
||||
|
||||
describe('when parsing ', function () {
|
||||
beforeEach(function () {
|
||||
flow.parser.yy = require('../graphDb')
|
||||
flow.parser.yy = graphDb
|
||||
flow.parser.yy.clear()
|
||||
})
|
||||
|
||||
@@ -469,42 +469,42 @@ describe('when parsing ', function () {
|
||||
|
||||
describe('it should handle interaction, ', function () {
|
||||
it('it should be possible to use click to a callback', function () {
|
||||
spyOn(graph, 'setClickEvent')
|
||||
spyOn(graphDb, 'setClickEvent')
|
||||
var res = flow.parser.parse('graph TD\nA-->B\nclick A callback')
|
||||
|
||||
var vert = flow.parser.yy.getVertices()
|
||||
var edges = flow.parser.yy.getEdges()
|
||||
|
||||
expect(graph.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined, undefined)
|
||||
expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined, undefined)
|
||||
})
|
||||
|
||||
it('it should be possible to use click to a callback with toolip', function () {
|
||||
spyOn(graph, 'setClickEvent')
|
||||
spyOn(graphDb, 'setClickEvent')
|
||||
var res = flow.parser.parse('graph TD\nA-->B\nclick A callback "tooltip"')
|
||||
|
||||
var vert = flow.parser.yy.getVertices()
|
||||
var edges = flow.parser.yy.getEdges()
|
||||
|
||||
expect(graph.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined, 'tooltip')
|
||||
expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined, 'tooltip')
|
||||
})
|
||||
|
||||
it('should handle interaction - click to a link', function () {
|
||||
spyOn(graph, 'setClickEvent')
|
||||
spyOn(graphDb, 'setClickEvent')
|
||||
var res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html"')
|
||||
|
||||
var vert = flow.parser.yy.getVertices()
|
||||
var edges = flow.parser.yy.getEdges()
|
||||
|
||||
expect(graph.setClickEvent).toHaveBeenCalledWith('A', undefined, 'click.html', undefined)
|
||||
expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', undefined, 'click.html', undefined)
|
||||
})
|
||||
it('should handle interaction - click to a link with tooltip', function () {
|
||||
spyOn(graph, 'setClickEvent')
|
||||
spyOn(graphDb, 'setClickEvent')
|
||||
var res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html" "tooltip"')
|
||||
|
||||
var vert = flow.parser.yy.getVertices()
|
||||
var edges = flow.parser.yy.getEdges()
|
||||
|
||||
expect(graph.setClickEvent).toHaveBeenCalledWith('A', undefined, 'click.html', 'tooltip')
|
||||
expect(graphDb.setClickEvent).toHaveBeenCalledWith('A', undefined, 'click.html', 'tooltip')
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user