Replace require with import

This commit is contained in:
Tyler Long
2017-09-10 21:23:04 +08:00
parent c9442653e9
commit a7d79baf00
36 changed files with 693 additions and 838 deletions

View File

@@ -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')
})
})