Commit befb8ed9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

generic search by query fix

parent 8cb98b40
......@@ -158,8 +158,8 @@ SearchPanel.prototype.createAliasElement = function(alias, icon) {
SearchPanel.prototype.searchByQuery = function() {
var self = this;
var query = self.getSearchInput().value;
var perfect = self.getSearchPerfectMatch().checked;
var query = this.getControlElement(PanelControlElementType.SEARCH_INPUT).value;
var perfect = this.getControlElement(PanelControlElementType.SEARCH_PERFECT_MATCH_CHECKBOX).checked;
return self.getOverlayDb().searchByQuery(query, perfect);
};
......
......@@ -8,7 +8,6 @@ var Chemical = require('../../../main/js/map/data/Chemical');
var ChemicalPanel = require('../../../main/js/gui/ChemicalPanel');
var PanelControlElementType = require('../../../main/js/gui/PanelControlElementType');
var chai = require('chai');
var assert = chai.assert;
var logger = require('../logger');
......
......@@ -6,6 +6,7 @@ require("../mocha-config.js");
var Alias = require('../../../main/js/map/data/Alias');
var SearchPanel = require('../../../main/js/gui/SearchPanel');
var PanelControlElementType = require('../../../main/js/gui/PanelControlElementType');
var chai = require('chai');
var assert = chai.assert;
......@@ -66,6 +67,25 @@ describe('SearchPanel', function() {
});
});
it('search by query with no results', function() {
var div = helper.createSearchTab();
var map = helper.createCustomMap();
map.getModel().setId(15781);
var searchDbOverlay = helper.createSearchDbOverlay(map);
var panel = new SearchPanel({
element : div,
customMap : map
});
panel.getControlElement(PanelControlElementType.SEARCH_INPUT).value = "s1";
return panel.searchByQuery().then(function() {
assert.equal(logger.getWarnings().length, 0);
assert.ok(div.innerHTML.indexOf("s1") >= 0);
});
});
it('createAliasElement', function() {
var aliasObj = {
symbol : "S1_SYMB",
......
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