Skip to content
Snippets Groups Projects
Commit 83e55f27 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

creating genetic div with no data doesn't throw an error

parent c33a50a5
No related branches found
No related tags found
1 merge request!18Resolve "When showing window for overlay that doesn't have data there is an error"
......@@ -270,7 +270,7 @@ AliasInfoWindow.prototype.createGenomicDiv = function() {
return Promise.each(
self.layoutAliases,
function(data) {
if (data !== null && data.getType() === LayoutAlias.GENETIC_VARIANT) {
if (data !== null && data !== undefined && data.getType() === LayoutAlias.GENETIC_VARIANT) {
geneticInformation = true;
return Promise.each(data.getGeneVariants(), function(variant) {
return self.getCustomMap().getReferenceGenome(variant.getReferenceGenomeType(),
......@@ -318,7 +318,7 @@ AliasInfoWindow.prototype.createGenomicDiv = function() {
}
return Promise.each(self.layoutAliases, function(data, i) {
globalGeneVariants[i] = [];
if (data !== null && data.getType() === LayoutAlias.GENETIC_VARIANT) {
if (data !== null && data !== undefined && data.getType() === LayoutAlias.GENETIC_VARIANT) {
var geneVariants = data.getGeneVariants();
for (var j = 0; j < geneVariants.length; j++) {
var variant = geneVariants[j];
......
......@@ -164,6 +164,32 @@ describe('AliasInfoWindow', function() {
});
it("createGeneticsDiv with no genetic data", function() {
var map;
var win;
var aliasId = 329173;
return ServerConnector.getProject().then(function(project) {
map = helper.createCustomMap(project);
var overlay = new LayoutData(18077, "xxx");
return overlay.init();
}).then(function() {
return map.getModel().getAliasById(aliasId);
}).then(function(alias) {
win = new AliasInfoWindow(alias, map);
return win.init();
}).then(function() {
win.layoutAliases = [ undefined ];
return win.createGenomicDiv();
}).then(function(div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") === -1);
win.destroy();
});
});
it("createGeneticsDivForUnknownOrganism", function() {
var map;
var overlay;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment