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

Merge branch '65-clear-button-function-incomplete' into 'master'

Resolve "'Clear' button function incomplete"

Closes #65

See merge request !39
parents 2c44d0ec 75e55eb3
No related branches found
No related tags found
1 merge request!39Resolve "'Clear' button function incomplete"
......@@ -57,6 +57,10 @@ AbstractPanel.prototype._createEventHandlers = function() {
return self.refreshSearchResults();
});
self.getOverlayDb().addListener("onClear", function() {
searchInput.value = "";
});
};
AbstractPanel.prototype._initializeGui = function() {
......
......@@ -479,10 +479,12 @@ Panel.prototype.onresize = function() {
if (size !== 100000) {
$(".pre-scrollable", self.getElement()).each(function(index, element) {
$(element).css('max-height', size);
$(element).css('height', size);
});
}
if ($(self.getElement()).hasClass("pre-scrollable") && $(self.getElement()).is(":visible")) {
$(self.getElement()).css('max-height', size);
$(self.getElement()).css('height', size);
}
};
......
......@@ -31,6 +31,7 @@ function AbstractDbOverlay(params) {
this._elementsByQuery = [];
this._elementsByQuery[""] = [];
this.registerListenerType('onSearch');
this.registerListenerType('onClear');
this.registerListenerType('onTargetVisibilityChange');
this.setQueries([]);
......@@ -178,7 +179,10 @@ AbstractDbOverlay.prototype.searchByEncodedQuery = function(originalQuery, fitBo
};
AbstractDbOverlay.prototype.clear = function() {
return this.searchByQuery("");
var self = this;
return self.searchByQuery("").then(function() {
return self.callListeners('onClear');
});
};
/**
......
......@@ -165,6 +165,7 @@ describe('SearchPanel', function() {
assert.ok(panel.createReactionElement(reaction).innerHTML.indexOf(reactionType) >= 0);
});
});
describe('createAliasElement', function() {
it('full name in desc', function() {
var map = helper.createCustomMap();
......@@ -184,4 +185,21 @@ describe('SearchPanel', function() {
});
});
describe('clear', function() {
it('input text', function() {
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
var panel = new SearchPanel({
element : testDiv,
customMap : map
});
$(".typeahead", testDiv)[0].value = "some input";
return map.clearDbOverlays().then(function (){
assert.equal("",$(":input", testDiv)[0].value);
});
});
});
});
[]
\ No newline at end of file
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