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

empty fields are not created

parent 302248ba
No related branches found
No related tags found
1 merge request!5Frontend refactor
......@@ -189,16 +189,16 @@ SearchPanel.prototype.createReactionElement = function(reaction) {
}
div.appendChild(createNewLine(3));
div.appendChild(createParamLine("Symbol: ", reaction.getSymbol()));
div.appendChild(createParamLine("Abbreviation: ", reaction.getAbbreviation()));
div.appendChild(createParamLine("Formula: ", reaction.getFormula()));
div.appendChild(createParamLine("Mechanical Confidence Score: ", reaction.getMechanicalConfidenceScore()));
div.appendChild(createParamLine("Lower Bound: ", reaction.getLowerBound()));
div.appendChild(createParamLine("Upper Bound: ", reaction.getUpperBound()));
div.appendChild(createParamLine("Gene Protein Reaction: ", reaction.getGeneProteinReaction()));
div.appendChild(createParamLine("Subsystem: ", reaction.getSubsystem()));
div.appendChild(this.createParamLine("Symbol: ", reaction.getSymbol()));
div.appendChild(this.createParamLine("Abbreviation: ", reaction.getAbbreviation()));
div.appendChild(this.createParamLine("Formula: ", reaction.getFormula()));
div.appendChild(this.createParamLine("Mechanical Confidence Score: ", reaction.getMechanicalConfidenceScore()));
div.appendChild(this.createParamLine("Lower Bound: ", reaction.getLowerBound()));
div.appendChild(this.createParamLine("Upper Bound: ", reaction.getUpperBound()));
div.appendChild(this.createParamLine("Gene Protein Reaction: ", reaction.getGeneProteinReaction()));
div.appendChild(this.createParamLine("Subsystem: ", reaction.getSubsystem()));
div.appendChild(createArrayParamLine("Synonyms: ", reaction.getSynonyms()));
div.appendChild(createParamLine("Description: ", reaction.getDescription()));
div.appendChild(this.createParamLine("Description: ", reaction.getDescription()));
div.appendChild(createReactantsLine(reaction.getReactants()));
div.appendChild(createProductsLine(reaction.getProducts()));
div.appendChild(createModifiersLine(reaction.getModifiers()));
......@@ -215,9 +215,11 @@ function createLabel(value) {
return result;
};
function createLabelText(value) {
SearchPanel.prototype.createLabelText = function(value) {
var result = document.createElement("span");
result.innerHTML = value;
if (value !== undefined) {
result.innerHTML = value;
}
return result;
};
......@@ -235,11 +237,11 @@ function createNewLine(count) {
return result;
};
function createParamLine(label, value) {
SearchPanel.prototype.createParamLine = function(label, value) {
var result = document.createElement("div");
if (value !== undefined) {
result.appendChild(createLabel(label));
result.appendChild(createLabelText(value));
result.appendChild(this.createLabelText(value));
result.appendChild(createNewLine());
}
return result;
......@@ -249,7 +251,7 @@ function createArrayParamLine(label, value) {
var result = document.createElement("div");
if (value !== undefined && value.length > 0) {
result.appendChild(createLabel(label));
result.appendChild(createLabelText(value.join(",")));
result.appendChild(this.createLabelText(value.join(",")));
result.appendChild(createNewLine());
}
return result;
......@@ -365,23 +367,23 @@ SearchPanel.prototype.createAliasElement = function(alias) {
var div = document.createElement("div");
td.appendChild(div);
div.appendChild(createParamLine(alias.getType() + ": ", alias.getName()));
div.appendChild(this.createParamLine(alias.getType() + ": ", alias.getName()));
if (alias.getModelId() != self.getMap().getId()) {
div.appendChild(self.createSubMapLink(alias));
}
div.appendChild(createNewLine(3));
div.appendChild(createParamLine("Full name: ", alias.getFullName()));
div.appendChild(createParamLine("Symbol: ", alias.getSymbol()));
div.appendChild(createParamLine("Abbreviation: ", alias.getAbbreviation()));
div.appendChild(createParamLine("Formula: ", alias.getFormula()));
div.appendChild(this.createParamLine("Full name: ", alias.getFullName()));
div.appendChild(this.createParamLine("Symbol: ", alias.getSymbol()));
div.appendChild(this.createParamLine("Abbreviation: ", alias.getAbbreviation()));
div.appendChild(this.createParamLine("Formula: ", alias.getFormula()));
div.appendChild(createArrayParamLine("Former symbols: ", alias.getFormerSymbols()));
div.appendChild(createPostTranslationalModifications("Posttranslational modifications: ", alias
.getOther('posttranslationalModifications')));
div.appendChild(createParamLine("Charge: ", alias.getCharge()));
div.appendChild(createParamLine("Synonyms: ", alias.getSynonyms()));
div.appendChild(createLabelText(alias.getDescription()));
div.appendChild(this.createParamLine("Charge: ", alias.getCharge()));
div.appendChild(this.createParamLine("Synonyms: ", alias.getSynonyms()));
div.appendChild(this.createLabelText(alias.getDescription()));
div.appendChild(createCandidates("Candidates: ", alias.getOther('dataMining')));
div.appendChild(createChebiTree("Chebi ontology: ", alias.getOther('chebiTree')));
div.appendChild(createAnnotations("Annotations: ", alias.getReferences()));
......
......@@ -100,4 +100,19 @@ describe('SearchPanel', function() {
assert.ok(aliasDiv.innerHTML);
});
it('createLabelText for indefined', function() {
var div = helper.createSearchTab();
var map = helper.createCustomMap();
var searchDbOverlay = helper.createSearchDbOverlay(map);
var panel = new SearchPanel({
element : div,
customMap : map
});
var res = panel.createLabelText();
assert.notOk(res.innerHTML);
});
});
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