diff --git a/frontend-js/src/test/js/gui/leftPanel/GenericSearchPanel-test.js b/frontend-js/src/test/js/gui/leftPanel/GenericSearchPanel-test.js index 34200db33ff6af90d16155a5885a8c3db1855862..bf5a311991c2e1da854ddf82ec5636ddb4b604fb 100644 --- a/frontend-js/src/test/js/gui/leftPanel/GenericSearchPanel-test.js +++ b/frontend-js/src/test/js/gui/leftPanel/GenericSearchPanel-test.js @@ -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 () {