Commit 95d72814 authored by Kushal Pandya's avatar Kushal Pandya

Import FilteredSearchTokenKeys, update class initialization syntax

parent 327d73ba
...@@ -3,8 +3,8 @@ import * as recentSearchesStoreSrc from '~/filtered_search/stores/recent_searche ...@@ -3,8 +3,8 @@ import * as recentSearchesStoreSrc from '~/filtered_search/stores/recent_searche
import RecentSearchesService from '~/filtered_search/services/recent_searches_service'; import RecentSearchesService from '~/filtered_search/services/recent_searches_service';
import RecentSearchesServiceError from '~/filtered_search/services/recent_searches_service_error'; import RecentSearchesServiceError from '~/filtered_search/services/recent_searches_service_error';
import RecentSearchesRoot from '~/filtered_search/recent_searches_root'; import RecentSearchesRoot from '~/filtered_search/recent_searches_root';
import FilteredSearchTokenKeys from '~/filtered_search/filtered_search_token_keys';
import '~/lib/utils/common_utils'; import '~/lib/utils/common_utils';
import '~/filtered_search/filtered_search_token_keys';
import '~/filtered_search/filtered_search_tokenizer'; import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown_manager'; import '~/filtered_search/filtered_search_dropdown_manager';
import '~/filtered_search/filtered_search_manager'; import '~/filtered_search/filtered_search_manager';
...@@ -14,6 +14,7 @@ describe('Filtered Search Manager', () => { ...@@ -14,6 +14,7 @@ describe('Filtered Search Manager', () => {
let input; let input;
let manager; let manager;
let tokensContainer; let tokensContainer;
const page = 'issues';
const placeholder = 'Search or filter results...'; const placeholder = 'Search or filter results...';
function dispatchBackspaceEvent(element, eventType) { function dispatchBackspaceEvent(element, eventType) {
...@@ -62,7 +63,7 @@ describe('Filtered Search Manager', () => { ...@@ -62,7 +63,7 @@ describe('Filtered Search Manager', () => {
input = document.querySelector('.filtered-search'); input = document.querySelector('.filtered-search');
tokensContainer = document.querySelector('.tokens-container'); tokensContainer = document.querySelector('.tokens-container');
manager = new gl.FilteredSearchManager(); manager = new gl.FilteredSearchManager({ page });
manager.setup(); manager.setup();
}; };
...@@ -80,19 +81,19 @@ describe('Filtered Search Manager', () => { ...@@ -80,19 +81,19 @@ describe('Filtered Search Manager', () => {
}); });
it('should instantiate RecentSearchesStore with isLocalStorageAvailable', () => { it('should instantiate RecentSearchesStore with isLocalStorageAvailable', () => {
manager = new gl.FilteredSearchManager(); manager = new gl.FilteredSearchManager({ page });
expect(RecentSearchesService.isAvailable).toHaveBeenCalled(); expect(RecentSearchesService.isAvailable).toHaveBeenCalled();
expect(recentSearchesStoreSrc.default).toHaveBeenCalledWith({ expect(recentSearchesStoreSrc.default).toHaveBeenCalledWith({
isLocalStorageAvailable, isLocalStorageAvailable,
allowedKeys: gl.FilteredSearchTokenKeys.getKeys(), allowedKeys: FilteredSearchTokenKeys.getKeys(),
}); });
}); });
}); });
describe('setup', () => { describe('setup', () => {
beforeEach(() => { beforeEach(() => {
manager = new gl.FilteredSearchManager(); manager = new gl.FilteredSearchManager({ page });
}); });
it('should not instantiate Flash if an RecentSearchesServiceError is caught', () => { it('should not instantiate Flash if an RecentSearchesServiceError is caught', () => {
......
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