Commit a0e02b5a authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-c/3951-displaying-all-sub-clones-does-not-work' into 'dev'

Resolve "Displaying all sub-clones does not work"

Closes #3951

See merge request !498
parents 4acbe9eb cb922b6b
Pipeline #98189 passed with stages
in 49 minutes and 19 seconds
......@@ -247,6 +247,7 @@ List.prototype = {
var a_split = document.createElement('a')
a_split.className = "button"
a_split.appendChild(icon('icon-plus', 'Show all subclones'))
a_split.id = "list_split_all"
a_split.onclick = function () {
self.m.split_all(true)
}
......@@ -254,6 +255,7 @@ List.prototype = {
var a_unsplit = document.createElement('a')
a_unsplit.className = "button"
a_unsplit.appendChild(icon('icon-minus', 'Hide all subclones'))
a_unsplit.id = "list_unsplit_all"
a_unsplit.onclick = function () {
self.m.split_all(false)
}
......@@ -423,6 +425,7 @@ List.prototype = {
var span_cluster = document.createElement('span');
span_cluster.setAttribute("cloneID", cloneID);
span_cluster.className = "clusterBox";
span_cluster.id = "clusterBox_"+cloneID;
var firstChild = div_elem.childNodes[0];
div_elem.insertBefore(span_cluster, firstChild);
......@@ -488,9 +491,11 @@ List.prototype = {
if (clone.split) {
span_cluster.onclick = cluster_hide;
span_cluster.appendChild(icon('icon-minus', 'Hide the subclones'));
this.showClusterContent(cloneID, false)
} else {
span_cluster.onclick = cluster_show;
span_cluster.appendChild(icon('icon-plus', 'Show the subclones'));
this.hideClusterContent(cloneID, false)
}
self.div_cluster(document.getElementById("cluster" + cloneID), cloneID);
} else {
......@@ -790,30 +795,60 @@ List.prototype = {
/**
* toggle on the display for a given clone of all clones merged with it
* @param {integer} cloneID -
* Action by direct click on the show button of the list element
* @param {String} div - div name of the show button
* */
showCluster: function (div) {
var cloneID = div.getAttribute("cloneID");
var self = this
this.m.clone(cloneID).split = true
this.showClusterContent(cloneID, true)
},
/**
* toggle on the display for a given clone of all clones merged with it
* @param {integer} cloneID -
* @param {bool} update - Set the content of the update fct. Slow down the refresh if call from the model on multiple clones
* */
showClusterContent: function(cloneID, update){
var self = this
var fct;
if (update == true || update == undefined) {
fct = function () { self.m.updateElem([cloneID]) }
} else if (update == false) {
fct = function(){}
}
$("#cluster" + cloneID)
.show(50, function () {
self.m.updateElem([cloneID])
});
.show(50, fct );
},
/**
* toggle off the display for a given clone of all clones merged with it
* @param {integer} cloneID -
* Action by direct click on the hide button of the list element
* @param {String} div - div name of the hide button
* */
hideCluster: function (div) {
var cloneID = div.getAttribute("cloneID");
var self = this
this.m.clone(cloneID).split = false
this.hideClusterContent(cloneID, true)
},
/**
* toggle off the display for a given clone of all clones merged with it
* @param {integer} cloneID -
* @param {bool} update - Set the content of the update fct. Slow down the refresh if call from the model on multiple clones
* */
hideClusterContent: function(cloneID, update){
var self = this
var fct;
if (update == true || update == undefined) {
fct = function () { self.m.updateElem([cloneID]) }
} else if (update == false) {
fct = function(){}
}
$("#cluster" + cloneID)
.hide(50, function () {
self.m.updateElem([cloneID])
});
.hide(50, fct );
},
/**
......
# coding: utf-8
load 'vidjil_browser.rb'
load 'browser_test.rb'
#browser test suite
class TestCluster < BrowserTest
def setup
super
if not defined? $b
set_browser("/doc/analysis-example2.vidjil", "/doc/analysis-example2.analysis")
if $b.div(id: 'tip-container').present?
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
end
def after_tests
end
def test_00_list_clones
assert ($b.div(:id => 'cluster1').exists? ), '>> cluster1 exist'
assert (not $b.clone_cluster('1').present?), '>> cluster1 is not display'
end
def test_01_cluster_show
$b.clone_info('1')[:cluster].click
assert ($b.clone_cluster('1').present?), '>> cluster1 is display'
end
def test_02_cluster_hide
$b.clone_info('1')[:cluster].click
sleep(1)
assert (not $b.clone_cluster('1').present?), '>> cluster1 is not display'
end
def test_03_cluster_show_all
$b.clone_in_list('1').click
$b.a(:id => 'list_split_all').click
assert ( $b.clone_in_segmenter('1').exists? ), ">> selected clone (clone2) is present into the segmenter"
assert ( $b.clone_in_segmenter('2').exists? ), ">> The second clone of the cluster (clone3) of selected clone is also show"
end
def test_04_cluster_hide_all
$b.a(:id => 'list_unsplit_all').click
assert (not $b.clone_in_segmenter('3').exists? ), ">> The second clone of the clustr is hidden"
end
# Not really a test
def test_zz_close
close_everything
end
end
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