Commit 633f6566 authored by Mikaël Salson's avatar Mikaël Salson

js/model.js, tests: Main clone of cluster may not be the first

It is the first when clones are ordered by size. It may happen that this is not the case.
However the index of the cluster gives the cloneID that is the main clone of the cluster.

Added a test for that case.

See #2837.
parent 1169a893
......@@ -972,13 +972,13 @@ changeAlleleNotation: function(alleleNotation) {
seq = this.clusters[i][j]
var subclone = this.clone(seq);
subclone.disable();
if (j > 0 && subclone.isSelected())
if (seq != i && subclone.isSelected())
// Unselect all subclones
this.unselect(seq);
}
this.clone(i).enable(this.top)
} else {
var main_clone = this.clone(this.clusters[i][0]);
var main_clone = this.clone(i);
for (var k = 0; k < this.clusters[i].length; k++) {
seq = this.clusters[i][k]
var clone = this.clone(seq);
......
......@@ -269,6 +269,39 @@ class TestMultilocus < BrowserTest
assert ($b.clone_in_segmenter(clone_id).exists?), "Clone %s is not in segmenter" % clone_id
end
def test_17_select_clustered
$b.clone_in_scatterplot('1').click
$b.clone_in_scatterplot('37').click(:control)
$b.clone_in_scatterplot('90').click(:control)
$b.merge.click
assert ($b.clone_in_scatterplot('90').exists?), "Main clone of the cluster should be clone 90"
assert ($b.clone_in_scatterplot('90', :class => "circle_select").exists?), "Clone should be selected"
$b.clone_info('90')[:cluster].click
assert ( $b.clone_in_scatterplot('1', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('1', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('1').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
assert ( $b.clone_in_scatterplot('37', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('37', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('37').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
assert ( $b.clone_in_scatterplot('90', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('90', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('90').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
$b.clone_in_cluster('90', '1')[:delete].click
$b.clone_in_cluster('90', '37')[:delete].click
$b.unselect
assert ($b.clone_in_scatterplot('1').exists?)
assert ($b.clone_in_scatterplot('37').exists?)
assert ($b.clone_in_scatterplot('90').exists?)
end
def TODO_test_14_edit_tag
......
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