Commit 93e35399 authored by marc duez's avatar marc duez

qunit test

parent eb460e77
Pipeline #111338 failed with stages
in 18 seconds
......@@ -21,7 +21,7 @@ QUnit.test("edit", function(assert) {
list.editName(1)
assert.notEqual(list.index[1].div_elem.innerHTML.indexOf("save"), -1, "open edit clone name : Ok")
assert.notEqual(list.index[1].getElement("main").innerHTML.indexOf("save"), -1, "open edit clone name : Ok")
setTimeout( function() {
$("#new_name").val("editName");
......
......@@ -11,8 +11,10 @@ QUnit.test("segmenter", function(assert) {
m.initClones()
var segment = new Segment("segment", m);
assert.equal(segment.first_clone, -1, "segment.first_clone is set to -1 at init")
assert.equal(segment.sequence_order.length, 0, "no clones in segmenter at init")
segment.init()
segment.update()
segment.useSmartUpdateElemStyle = false;
var done = assert.async(15);
var delay = 0;
......@@ -21,7 +23,7 @@ QUnit.test("segmenter", function(assert) {
//select test
m.select(0)
setTimeout( function() {
var div0 = document.getElementById("f0");
var div0 = document.getElementById("seq0").getElementsByClassName("seq-fixed")[0];
assert.notEqual(div0.innerHTML.indexOf("test1"), -1, "select : Ok")
m.select(1)
......@@ -29,23 +31,23 @@ QUnit.test("segmenter", function(assert) {
}, delay+=step);
setTimeout( function() {
var div1 = document.getElementById("f1");
var div1 = document.getElementById("seq1").getElementsByClassName("seq-fixed")[0];;
assert.notEqual(div1.innerHTML.indexOf("test2"), -1, "select : Ok")
assert.equal(segment.first_clone, 0, "segment.first_clone still set to 0 if clones 0 and 1 are selected")
assert.equal(segment.sequence_order[0], 0, "segment.first_clone still set to 0 if clones 0 and 1 are selected")
m.unselect(0)
done()
}, delay+=step);
setTimeout( function() {
assert.equal(segment.first_clone, 1, "segment.first_clone is set to 1 if clones 0 is unselected")
assert.equal(segment.sequence_order[0], 1, "segment.first_clone is set to 1 if clones 0 is unselected")
m.select(2)
done()
}, delay+=step);
setTimeout( function() {
var div2 = document.getElementById("f2");
var div2 = document.getElementById("seq2").getElementsByClassName("seq-fixed")[0];
assert.notEqual(div2.innerHTML.indexOf("test3"), -1, "select : Ok")
m.unselectAll()
......@@ -53,10 +55,10 @@ QUnit.test("segmenter", function(assert) {
}, delay+=step);
setTimeout( function() {
assert.equal(document.getElementById("f0"), null, "unselect : Ok")
assert.equal(document.getElementById("f1"), null, "unselect : Ok")
assert.equal(document.getElementById("f2"), null, "unselect : Ok")
assert.equal(segment.first_clone, -1, "segment.first_clone is set to -1 when no clones are selected")
assert.equal(document.getElementById("seq0").style.display, "none", "unselect : Ok")
assert.equal(document.getElementById("seq1").style.display, "none", "unselect : Ok")
assert.equal(document.getElementById("seq2").style.display, "none", "unselect : Ok")
assert.equal(segment.sequence_order.length, 0, "segment.first_clone is set to -1 when no clones are selected")
m.select(0);
m.select(2);
......@@ -65,9 +67,9 @@ QUnit.test("segmenter", function(assert) {
}, delay+=step);
setTimeout( function() {
var div0 = document.getElementById("f0");
var div0 = document.getElementById("seq0").getElementsByClassName("seq-fixed")[0];
assert.notEqual(div0.innerHTML.indexOf("test1"), -1, "select : Ok")
assert.equal(document.getElementById("f2"), null, "unselect : Ok")
assert.equal(document.getElementById("seq2").style.display, "none" , "unselect : Ok")
m.unselectAll();
done()
......@@ -84,7 +86,7 @@ QUnit.test("segmenter", function(assert) {
// assert.deepEqual(segment.toFasta(), "> test1 // 5.000%\naaaaaaaaaaaaaaaaaaaAG\n","toFasta :Ok")
setTimeout( function() {
assert.equal($("#f0").css("background-color"), "rgb(204, 204, 204)", "focus : Ok")
assert.equal(document.getElementById("seq0").getElementsByClassName("seq-fixed")[0].className.includes("list_focus"), true, "focus : Ok")
m.focusOut()
m.updateElem([0])
......@@ -128,8 +130,8 @@ QUnit.test("segmenter", function(assert) {
var clone1_pos = list_html.search('"seq1"');
var clone2_pos = list_html.search('"seq2"');
// Clone 2 is more abundant than clone 1 more abundant than clone 0
assert.ok(clone2_pos > clone1_pos);
assert.ok(clone1_pos > clone0_pos);
assert.ok(clone2_pos < clone1_pos);
assert.ok(clone1_pos < clone0_pos);
var fasta = segment.toFasta();
assert.ok(fasta.indexOf('> test3') < fasta.indexOf('> test2'));
assert.ok(fasta.indexOf('> test2') < fasta.indexOf('> test1'));
......@@ -150,7 +152,7 @@ QUnit.test("segmenter", function(assert) {
}, delay+=step);
setTimeout( function() {
assert.equal(segment.first_clone, 2, "segment.first_clone is set to 2, even if bigger clone is selected")
assert.equal(segment.sequence_order[0], 2, "segment.first_clone is set to 2, even if bigger clone is selected")
done()
}, delay+=step);
......@@ -162,6 +164,7 @@ QUnit.test("sequence", function(assert) {
m.initClones()
var segment = new Segment("segment", m);
segment.init()
segment.update()
segment.addToSegmenter(4)
seq1 = new Sequence(4, m, segment)
......@@ -195,7 +198,7 @@ QUnit.test("segt", function (assert) {
var segment = new Segment("segment",m)
segment.init();
segment.update()
var done = assert.async(3);
var delay = 0;
......@@ -258,6 +261,7 @@ QUnit.test("segt", function (assert) {
m.initClones();
var segment = new Segment("segment",m);
segment.init();
segment.update();
m.select(2)
segment.addGermlineToSegmenter("IGHD1-1*01","IGH");
assert.equal(segment.sequence["IGHD1-1*01"].seq.join("").toUpperCase(), "GGGCGCCGGGGCAGATTCTGAACAGCCCCGAGTCACGGTGGGTACAACTGGAACGAC")
......
......@@ -51,6 +51,7 @@
<script type="text/javascript" src='../../js/speed_test.js' data-cover></script>
<script type="text/javascript" src='../../js/closeable.js' data-cover></script>
<script type="text/javascript" src='../../js/tokeniser.js' data-cover></script>
<script type="text/javascript" src='../../js/indexedDom.js' data-cover></script>
<script type="text/javascript" src='../../js/form_builder.js' data-cover></script>
<script type="text/javascript" src="./testFiles/data_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