Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed May 22, 2020
1 parent da4d7c3 commit c1dc5d4
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 55 deletions.
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"fileServerFolder": "./website"
"fileServerFolder": "./website",
"chromeWebSecurity": false
}
48 changes: 26 additions & 22 deletions cypress/integration/examples.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
describe("Run Examples", () => {
// const examples = [
// "downwardedges",
// "unconstrained",
// "unconstrainedsmallworld",
// "nonoverlapping",
// "smallnonoverlappinggraph",
// "modifyinggraph",
// "onlinebrowse",
// "alignment",
// "smallgroups",
// "browsemovies",
// "sucrosebreakdown",
// "unix",
// "ariel",
// "egonetwork",
// "disconnected_graphs",
// "powergraph",
// "3dLayout",
// "dotpowergraph",
// "gridifiedSmallGroups",
// "3dtree",
// // "cygenegene",
// "pageBoundsConstraints",
// "smallworldwithgroups",
// "brainnetwork2"
// ];
const examples = [
"downwardedges",
"unconstrained",
"unconstrainedsmallworld",
"nonoverlapping",
"smallnonoverlappinggraph",
"modifyinggraph",
"onlinebrowse",
"alignment",
"smallgroups",
"browsemovies",
"sucrosebreakdown",
"unix",
"ariel",
"egonetwork",
"disconnected_graphs",
"powergraph",
"3dLayout",
"dotpowergraph",
"gridifiedSmallGroups",
"3dtree",
"cygenegene",
"pageBoundsConstraints",
"smallworldwithgroups",
"brainnetwork2"
];
examples.forEach((example) => {
it(example, () => cy.visit(`./examples/${example}.html`));
Expand Down
2 changes: 1 addition & 1 deletion website/examples/browsemovies.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>Online Graph Exploration</h1>
<p>Pink nodes are incomplete. Click on them to expand their neighbours.</p>
<script src="../extern/d3v4.js"></script>
<script src="../cola.min.js"></script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="../extern/jquery-2.2.4.min.js"></script>
<script src="tmdbgraph.js"></script>
<button id="fullScreenButton">Full screen</button>
<button id="zoomToFitButton">Zoom to fit (or double click)</button>
Expand Down
2 changes: 1 addition & 1 deletion website/examples/dotpowergraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<body>
<a href="../index.html">cola.js home</a>
<h1>Gridified Layout</h1>
<script src="../extern/d3.v3.js"></script>
<script src="../extern/d3v4.js"></script>
<script src="../cola.min.js"></script>
<script src="../extern/graphlib-dot.min.js"></script>
<script src="dotpowergraph.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions website/examples/dotpowergraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ module dotpowergraph {
}
}
let dragListener = d3.drag()
.on("dragstart", dragStart)
.on("start", dragStart)
.on("drag", drag)
.on("dragend", dragEnd);
.on("end", dragEnd);
node.call(dragListener);
label.call(dragListener);
}
Expand Down
2 changes: 1 addition & 1 deletion website/examples/movies.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</head>
<body>
<a href="../index.html">cola.js home</a>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="../extern/jquery-2.2.4.min.js"></script>
<script>
function tmdbrequest(type, id, content, callback) {
$.ajax("https://api.themoviedb.org/3/" + type + "/" + id + "/" + content + "?api_key=1bba0362f468d50d2ec27acff6d5e05a")
Expand Down
2 changes: 1 addition & 1 deletion website/examples/pageBoundsConstraints.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h1>Layout kept inside bounding box</h1>
<link rel="stylesheet" href="../extern/hljs/styles/github.css">
<script src="../extern/hljs/highlight.pack.js"></script>
<script src="../extern/d3.v3.js"></script>
<script src="../cola.js"></script>
<script src="../cola.min.js"></script>
<script>
var width = 960,
height = 500;
Expand Down
60 changes: 35 additions & 25 deletions website/examples/sucrosebreakdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,32 @@

</style>
</head>
<body onload="parseDunnart()">
<body>
<a href="../index.html">cola.js home</a>
<h1>Metabolic Pathway: Sucrose Breakdown</h1>

<p>
The graph above demonstrates alignment constraints and non-overlapping group and node boundaries. The groups
highlight and keep separate specific functional partitions in the pathway. Four alignment constraints are used
to arrange nodes involved in the cycle around the edges of a rectangle. To biologists, cycles in these types of
pathways are very important because they represent continuous processes. Another alignment is used to straighten
one particular path inside the green group.
</p>
<p>
The image below is drawn by hand by a biologist with data from the <a href="http://www.genome.jp/kegg/pathway.html">Kegg Pathway Database</a>.
Constraints allow us to capture in a live, automatically adjusting layout, the same kinds of drawing conventions that biologists (and others) like to see in textbook drawings
of their networks.
</p>
<img src="sucrosebreakdown-handdrawn.png" width="500px" />
<p>
The SVG diagram below is used as the source for the nodes, edges and constraints used in the CoLa layout above.
It was originally authored in the <a href="http://www.csse.monash.edu.au/~mwybrow/dunnart/">Dunnart constraint-based diagram editor</a>.
Dunnart is great for interactively authoring the constraints and creating a semi-supervised layout, but obviously web-based constraint
layout is easier to deploy! Have a look at the source of this page to see how to extract the graph and constraints from the
Dunnart generated SVG.
</p>
<object id="embeddedsvg" data="graphdata/SucroseBreakdownDicots-flowlayout.svg" type="image/svg+xml" width="500ox" />

<script src="../extern/d3.v3.js"></script>
<script src="../cola.min.js"></script>
<script>
Expand Down Expand Up @@ -81,8 +104,16 @@ <h1>Metabolic Pathway: Sucrose Breakdown</h1>
var linksLayer = vis.append("g");

var graph = {}, nodeLookup = {};


// @type {HTMLImageElement}
const img = document.getElementById("embeddedsvg");
img.addEventListener('load', () => { parseDunnart(); });


function parseDunnart() {
var sbsvg = d3.select(document.getElementById("embeddedsvg").contentDocument).select('svg');
var sbsvg = d3.select(img.contentDocument).select('svg');
const svg = sbsvg.node();
graph.nodes = [];
sbsvg.selectAll('rect.shape').each(function (d, i) {
graph.nodes.push(
Expand All @@ -99,10 +130,10 @@ <h1>Metabolic Pathway: Sucrose Breakdown</h1>
}
);
});
graph.links = sbsvg.selectAll('.connector')[0].map(function (l) {
graph.links = Array.from(svg.querySelectorAll('.connector')).map(function (l) {
return { source: nodeLookup[l.attributes['dunnart:srcID'].value].index, target: nodeLookup[l.attributes['dunnart:dstID'].value].index }
});
graph.groups = sbsvg.selectAll('.cluster')[0].map(function (g) {
graph.groups = Array.from(svg.querySelectorAll('.cluster')).map(function (g) {
return {
leaves: g.attributes['dunnart:contains'].value.split(' ').map(function (i) { return nodeLookup[i].index }),
style: g.attributes['style'].value,
Expand Down Expand Up @@ -233,27 +264,6 @@ <h1>Metabolic Pathway: Sucrose Breakdown</h1>
}
function isIE() { return ((navigator.appName == 'Microsoft Internet Explorer') || ((navigator.appName == 'Netscape') && (new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null))); }
</script>
<p>
The graph above demonstrates alignment constraints and non-overlapping group and node boundaries. The groups
highlight and keep separate specific functional partitions in the pathway. Four alignment constraints are used
to arrange nodes involved in the cycle around the edges of a rectangle. To biologists, cycles in these types of
pathways are very important because they represent continuous processes. Another alignment is used to straighten
one particular path inside the green group.
</p>
<p>
The image below is drawn by hand by a biologist with data from the <a href="http://www.genome.jp/kegg/pathway.html">Kegg Pathway Database</a>.
Constraints allow us to capture in a live, automatically adjusting layout, the same kinds of drawing conventions that biologists (and others) like to see in textbook drawings
of their networks.
</p>
<img src="sucrosebreakdown-handdrawn.png" width="500px" />
<p>
The SVG diagram below is used as the source for the nodes, edges and constraints used in the CoLa layout above.
It was originally authored in the <a href="http://www.csse.monash.edu.au/~mwybrow/dunnart/">Dunnart constraint-based diagram editor</a>.
Dunnart is great for interactively authoring the constraints and creating a semi-supervised layout, but obviously web-based constraint
layout is easier to deploy! Have a look at the source of this page to see how to extract the graph and constraints from the
Dunnart generated SVG.
</p>
<object id="embeddedsvg" data="graphdata/SucroseBreakdownDicots-flowlayout.svg" type="image/svg+xml" width="500ox" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
Expand Down
2 changes: 1 addition & 1 deletion website/examples/unix.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1>Unix Family Tree</h1>
<h2>Directed graph flow layout and shortest-path edge routing</h2>
<script src="../extern/graphlib-dot.min.js"> </script>
<script src="../extern/d3v4.js"></script>
<script src="../cola.js"></script>
<script src="../cola.min.js"></script>
<link rel="stylesheet" href="../extern/hljs/styles/github.css">
<script src="../extern/hljs/highlight.pack.js"></script>
<script>
Expand Down
4 changes: 4 additions & 0 deletions website/extern/jquery-2.2.4.min.js

Large diffs are not rendered by default.

0 comments on commit c1dc5d4

Please sign in to comment.