Commit 0a93c832 authored by Marc Duez's avatar Marc Duez

qunit : debug/add some test for axis/scatterplot

parent 3b2dcb8c
......@@ -74,10 +74,27 @@ test("Axis : ", function() {
//Nlength
axis.custom(function(cloneID) {
var value = m.clone(cloneID)
.getNlength()
if (typeof value != "undefined" && value != 0) return value;
return undefined;
})
m.clone(cloneID).getNlength()
return m.clone(cloneID).getNlength();
},
0,25)
equal(axis.pos(0).toPrecision(3), 0.00, "custom : clone 0 (nlength = 0) position -> 0.00")
equal(axis.pos(1).toPrecision(3), 0.360, "custom : clone 1 (nlength = 9) position -> 0.360")
//gc
axis.custom('GCContent', 0, 1, 'percent')
equal(axis.pos(0).toPrecision(3), 0.0476, "custom (percent) : clone 0 (gc = 1/21) position -> 0.0476")
equal(axis.pos(1).toPrecision(3), 0.944, "custom (percent) : clone 1 (gc = 17/18) position -> 0.944")
deepEqual(axis.labels[0].text, "0.0%", "custom (percent) : check label 0.0%")
//gc + log
axis.custom('GCContent', 0.001, 1, 'percent', true)
equal(axis.pos(0).toPrecision(3), 0.559, "custom (percent+log) : clone 0 (gc = 1/21) position -> 0.559")
equal(axis.pos(1).toPrecision(3), 0.992, "custom (percent+log) : clone 1 (gc = 17/18) position -> 0.992")
deepEqual(axis.labels[0].text, "100%", "custom (percent+log) : check label 100%")
deepEqual(axis.labels[1].text, "10%", "custom (percent+log) : check label 10%")
});
......@@ -36,7 +36,7 @@ json_data = {
},
"clones": [
{
"sequence" : "aaaaaaaaaaaaaaaaaaaaa",
"sequence" : "aaaaaaaaaaaaaaaaaaaag",
"name" : "test1",
"id" : "id1",
"reads" : [10,10,15,15] ,
......@@ -50,7 +50,7 @@ json_data = {
}
},
{
"sequence" : "bbbbbbbbbbbbbbb",
"sequence" : "ccccccccccccccccca",
"name" : "test2",
"id" : "id2",
"reads" : [20,20,10,10] ,
......
test("scatterplot : grid", function() {
var m = new Model(m);
m.parseJsonData(json_data,100)
......@@ -6,7 +7,8 @@ test("scatterplot : grid", function() {
m.initClones()
var sp = new ScatterPlot("visu",m);
sp.init()
equal(sp.returnActiveclones(), 3, "returnActiveClones -> 3");
sp.buildSystemGrid()
......@@ -17,6 +19,21 @@ test("scatterplot : grid", function() {
{"enabled": true,"text": "IGH","x": 0.80,"y": 0.75}]},
"buildSystemGrid()");
//deepEqual(sp.nodes[0], "","")
equal(sp.nodes.length, 4 , "check nodes");
sp.changeSplitMethod("gene_v", "gene_v", "plot");
sp.update()
equal(sp.axisX.pos(1), sp.axisY.pos(1), "check splitMethod V/V /plot : xpos = ypos");
equal(sp.axisX.pos(1), sp.axisY.pos(1), "check splitMethod V/V /plot : xpos = ypos");
equal(document.getElementById("circle1").className.baseVal, "circle", "check splitMethod V/V /plot : check if plot are displayed")
sp.changeSplitMethod("gene_v", "gene_v", "bar");
sp.update()
equal(document.getElementById("bar1").className.baseVal, "", "check splitMethod V/V /plot : check if bar are displayed")
$(document.getElementsByClassName("sp_legend")[0]).d3Click() //click label ighv4
deepEqual(m.getSelected(), [2], "check click label");
});
\ No newline at end of file
......@@ -55,12 +55,23 @@
<script src="../../js/lib/qunit-1.14.0.js"></script>
<script type="text/javascript" src="../../js/lib/qunit-tap.js"></script>
<script>
var tap_output;
qunitTap(QUnit, function() {
if (typeof arguments != "undefined"){
tap_output+=arguments[0]+"\n"
}
});
jQuery.fn.d3Click = function () {
this.each(function (i, e) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
e.dispatchEvent(evt);
});
};
</script>
<script src="./testFiles/dbscan_test.js"></script>
<script src="./testFiles/model_test.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment