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

common code extracted

parent 9fa5afc5
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!496Resolve "Inform about exceeding max number of search results"
......@@ -15,7 +15,7 @@ var assert = chai.assert;
var logger = require('../../logger');
describe('GenericSearchPanel', function () {
/**t
/**
*
* @param {CustomMap} [map]
* @returns {GenericSearchPanel}
......@@ -29,7 +29,8 @@ describe('GenericSearchPanel', function () {
return new GenericSearchPanel({
element: testDiv,
customMap: map
customMap: map,
configuration: helper.getConfiguration()
});
};
......@@ -39,7 +40,8 @@ describe('GenericSearchPanel', function () {
new GenericSearchPanel({
element: testDiv,
customMap: map
customMap: map,
configuration: helper.getConfiguration()
});
assert.equal(logger.getWarnings().length, 0);
});
......@@ -52,12 +54,9 @@ describe('GenericSearchPanel', function () {
var map = helper.createCustomMap();
map.getModel().setId(15781);
var searchDbOverlay = helper.createSearchDbOverlay(map);
new GenericSearchPanel({
element: testDiv,
customMap: map
});
createPanel(map);
var searchDbOverlay = map.getOverlayByName("search");
var searchParams = {
modelId: map.getModel().getId(),
......@@ -76,12 +75,8 @@ describe('GenericSearchPanel', function () {
it('on searchResults changed 2', function () {
var map = helper.createCustomMap();
map.getModel().setId(15781);
var searchDbOverlay = helper.createSearchDbOverlay(map);
new GenericSearchPanel({
element: testDiv,
customMap: map
});
createPanel(map);
var searchDbOverlay = map.getOverlayByName("search");
return searchDbOverlay.searchByQuery("s1", false).then(function () {
assert.equal(logger.getWarnings().length, 0);
......@@ -92,12 +87,7 @@ describe('GenericSearchPanel', function () {
it('search by query with no results', function () {
var map = helper.createCustomMap();
map.getModel().setId(15781);
helper.createSearchDbOverlay(map);
var panel = new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
panel.getControlElement(PanelControlElementType.SEARCH_INPUT).value = "s1";
......@@ -113,12 +103,7 @@ describe('GenericSearchPanel', function () {
it('visible', function () {
helper.getConfiguration().getOption(ConfigurationType.SHOW_REACTION_TYPE).setValue("true");
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
var panel = new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
var reaction = helper.createReaction(map);
var reactionType = "XX TYPE";
reaction.setType(reactionType);
......@@ -131,12 +116,7 @@ describe('GenericSearchPanel', function () {
it('invisible', function () {
helper.getConfiguration().getOption(ConfigurationType.SHOW_REACTION_TYPE).setValue("true");
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
var panel = new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
var reaction = helper.createReaction(map);
var reactionType = "XX TYPE";
reaction.setType(reactionType);
......@@ -154,7 +134,6 @@ describe('GenericSearchPanel', function () {
describe('createAliasElement', function () {
it('default', function () {
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
var aliasObj = {
symbol: "S1_SYMBOL",
......@@ -178,10 +157,7 @@ describe('GenericSearchPanel', function () {
var alias = new Alias(aliasObj);
var panel = new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
return panel.createAliasElement(alias).then(function (aliasDiv) {
assert.ok(aliasDiv.innerHTML);
......@@ -197,12 +173,7 @@ describe('GenericSearchPanel', function () {
};
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
var panel = new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
var alias = helper.createAlias(map);
alias.setFullName("xxx");
......@@ -216,12 +187,7 @@ describe('GenericSearchPanel', function () {
it('invisible', function () {
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
var panel = new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
var alias = helper.createAlias(map);
alias.setFullName("");
......@@ -236,12 +202,7 @@ describe('GenericSearchPanel', function () {
describe('clear', function () {
it('input text', function () {
var map = helper.createCustomMap();
helper.createSearchDbOverlay(map);
new GenericSearchPanel({
element: testDiv,
customMap: map
});
var panel = createPanel(map);
$(".typeahead", testDiv)[0].value = "some input";
return map.clearDbOverlays().then(function () {
......
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