more layout engines
This commit is contained in:
@ -4,6 +4,7 @@ import { Color } from '../lib';
|
||||
test ('serialize', (t) => {
|
||||
const wh = Color.white;
|
||||
const tr = Color.transparent;
|
||||
|
||||
t.is (wh.toString (), '#ffffff');
|
||||
t.is (tr.toString (), '#00000000');
|
||||
});
|
||||
|
@ -3,16 +3,20 @@ import { Edge, Color, EdgeStyles } from '../lib';
|
||||
|
||||
test ('serialize', (t) => {
|
||||
const e = new Edge ('foo', 'bar', false);
|
||||
|
||||
e.color = Color.white;
|
||||
e.style = EdgeStyles.dashed;
|
||||
const serialized = e.toString ();
|
||||
|
||||
t.is (serialized, 'foo -- bar [style="dashed",color="#ffffff"]');
|
||||
});
|
||||
|
||||
test ('serialize directional', (t) => {
|
||||
const e = new Edge ('foo', 'bar', true);
|
||||
|
||||
e.color = Color.white;
|
||||
e.style = EdgeStyles.dashed;
|
||||
const serialized = e.toString ();
|
||||
|
||||
t.is (serialized, 'foo -> bar [style="dashed",color="#ffffff"]');
|
||||
});
|
||||
|
@ -11,16 +11,19 @@ const serialized_table = `bar_foo [label=<<table>
|
||||
|
||||
test ('serialize simple', (t) => {
|
||||
const g = new Node ('foo', 'bar', 'baz');
|
||||
|
||||
g.color = Color.green;
|
||||
g.style = NodeStyles.dashed;
|
||||
|
||||
const serialized = g.toString ();
|
||||
|
||||
t.is (g.full_name, 'bar_foo');
|
||||
t.is (serialized, serialized_simple);
|
||||
});
|
||||
|
||||
test ('serialize table', (t) => {
|
||||
const g = new Node ('foo', 'bar', 'baz');
|
||||
|
||||
g.color = Color.green;
|
||||
g.style = NodeStyles.invisible;
|
||||
|
||||
@ -44,6 +47,7 @@ test ('serialize table', (t) => {
|
||||
g.is_table = true;
|
||||
|
||||
const serialized = g.toString ();
|
||||
|
||||
t.is (g.full_name, 'bar_foo');
|
||||
t.is (serialized, serialized_table);
|
||||
});
|
||||
@ -51,6 +55,7 @@ test ('serialize table', (t) => {
|
||||
test ('adhere to naming convention', (t) => {
|
||||
t.throws (() => {
|
||||
const n = new Node ('invalid.name', 'parent');
|
||||
|
||||
return n.toString ();
|
||||
}, { message: 'invalid name specified' });
|
||||
});
|
||||
|
Reference in New Issue
Block a user