File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ import tape from "./tape.js" ;
2
+ import jsdom from "./jsdom.js" ;
3
+ import * as d3 from "d3-selection" ;
4
+ import * as d3_graphviz from "d3-graphviz" ;
5
+
6
+ tape ( "Simple rendering an SVG from graphviz DOT using default export" , function ( test ) {
7
+ var window = global . window = jsdom ( '<div id="graph"></div>' ) ;
8
+ var document = global . document = window . document ;
9
+ var graphviz = d3_graphviz . graphviz ( "#graph" )
10
+ . renderDot ( 'digraph {a -> b;}' , checkGraph ) ;
11
+
12
+ function checkGraph ( ) {
13
+ test . equal ( d3 . selectAll ( '.node' ) . size ( ) , 2 , 'Number of nodes' ) ;
14
+ test . equal ( d3 . selectAll ( '.edge' ) . size ( ) , 1 , 'Number of edges' ) ;
15
+ test . equal ( d3 . selectAll ( 'ellipse' ) . size ( ) , 2 , 'Number of ellipses' ) ;
16
+ test . equal ( d3 . selectAll ( 'polygon' ) . size ( ) , 2 , 'Number of polygons' ) ;
17
+ test . equal ( d3 . selectAll ( 'path' ) . size ( ) , 1 , 'Number of paths' ) ;
18
+
19
+ test . end ( ) ;
20
+ }
21
+ } ) ;
You can’t perform that action at this time.
0 commit comments