diff options
author | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-09 20:03:09 +0200 |
---|---|---|
committer | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-17 06:57:29 +0200 |
commit | 6f5723a169b5d400c136dbd844fc54c68e5f8563 (patch) | |
tree | e7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/filtered_search | |
parent | 28d412e5b2b8499fba22e8fabb1d44f44449228e (diff) | |
download | gitlab-ce-6f5723a169b5d400c136dbd844fc54c68e5f8563.tar.gz |
enable jasmine/new-line-before-expect
Diffstat (limited to 'spec/javascripts/filtered_search')
8 files changed, 80 insertions, 0 deletions
diff --git a/spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js b/spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js index 9d670afe206..23a03558b38 100644 --- a/spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js +++ b/spec/javascripts/filtered_search/components/recent_searches_dropdown_content_spec.js @@ -47,6 +47,7 @@ describe('RecentSearchesDropdownContent', () => { expect(el.querySelector('.dropdown-info-note')).toBeDefined(); const items = el.querySelectorAll('.filtered-search-history-dropdown-item'); + expect(items.length).toEqual(propsDataWithoutItems.items.length); }); }); @@ -65,11 +66,13 @@ describe('RecentSearchesDropdownContent', () => { it('should render recent search items', () => { const items = el.querySelectorAll('.filtered-search-history-dropdown-item'); + expect(items.length).toEqual(propsDataWithItems.items.length); expect(trimMarkupWhitespace(items[0].querySelector('.filtered-search-history-dropdown-search-token').textContent)).toEqual('foo'); const item1Tokens = items[1].querySelectorAll('.filtered-search-history-dropdown-token'); + expect(item1Tokens.length).toEqual(2); expect(item1Tokens[0].querySelector('.name').textContent).toEqual('author:'); expect(item1Tokens[0].querySelector('.value').textContent).toEqual('@root'); @@ -132,12 +135,14 @@ describe('RecentSearchesDropdownContent', () => { it('with items', () => { vm = createComponent(propsDataWithItems); const { hasItems } = vm; + expect(hasItems).toEqual(true); }); it('with no items', () => { vm = createComponent(propsDataWithoutItems); const { hasItems } = vm; + expect(hasItems).toEqual(false); }); }); @@ -161,6 +166,7 @@ describe('RecentSearchesDropdownContent', () => { it('emits event', () => { expect(onRecentSearchesItemSelectedSpy).not.toHaveBeenCalled(); vm.onItemActivated('something'); + expect(onRecentSearchesItemSelectedSpy).toHaveBeenCalledWith('something'); }); }); @@ -182,6 +188,7 @@ describe('RecentSearchesDropdownContent', () => { it('emits event', () => { expect(onRequestClearRecentSearchesSpy).not.toHaveBeenCalled(); vm.onRequestClearRecentSearches({ stopPropagation: () => {} }); + expect(onRequestClearRecentSearchesSpy).toHaveBeenCalled(); }); }); diff --git a/spec/javascripts/filtered_search/dropdown_user_spec.js b/spec/javascripts/filtered_search/dropdown_user_spec.js index b48b1456eff..9f4e8ab6234 100644 --- a/spec/javascripts/filtered_search/dropdown_user_spec.js +++ b/spec/javascripts/filtered_search/dropdown_user_spec.js @@ -92,6 +92,7 @@ describe('Dropdown User', () => { it('hides the current user from dropdown', () => { const currentUserElement = findCurrentUserElement(); + expect(currentUserElement).not.toBe(null); dropdown.hideCurrentUser(); @@ -102,6 +103,7 @@ describe('Dropdown User', () => { it('does nothing if no user is logged in', () => { const currentUserElement = findCurrentUserElement(); currentUserElement.parentNode.removeChild(currentUserElement); + expect(findCurrentUserElement()).toBe(null); dropdown.hideCurrentUser(); diff --git a/spec/javascripts/filtered_search/dropdown_utils_spec.js b/spec/javascripts/filtered_search/dropdown_utils_spec.js index 3dc8089cd83..52b54973047 100644 --- a/spec/javascripts/filtered_search/dropdown_utils_spec.js +++ b/spec/javascripts/filtered_search/dropdown_utils_spec.js @@ -10,24 +10,29 @@ describe('Dropdown Utils', () => { describe('getEscapedText', () => { it('should return same word when it has no space', () => { const escaped = DropdownUtils.getEscapedText('textWithoutSpace'); + expect(escaped).toBe('textWithoutSpace'); }); it('should escape with double quotes', () => { let escaped = DropdownUtils.getEscapedText('text with space'); + expect(escaped).toBe('"text with space"'); escaped = DropdownUtils.getEscapedText('won\'t fix'); + expect(escaped).toBe('"won\'t fix"'); }); it('should escape with single quotes', () => { const escaped = DropdownUtils.getEscapedText('won"t fix'); + expect(escaped).toBe('\'won"t fix\''); }); it('should escape with single quotes by default', () => { const escaped = DropdownUtils.getEscapedText('won"t\' fix'); + expect(escaped).toBe('\'won"t\' fix\''); }); }); @@ -50,6 +55,7 @@ describe('Dropdown Utils', () => { input.value = 'roo'; const updatedItem = DropdownUtils.filterWithSymbol('@', input, item); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -57,6 +63,7 @@ describe('Dropdown Utils', () => { input.value = '@roo'; const updatedItem = DropdownUtils.filterWithSymbol('@', input, item); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -69,6 +76,7 @@ describe('Dropdown Utils', () => { input.value = '"'; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -76,6 +84,7 @@ describe('Dropdown Utils', () => { input.value = '~"'; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -83,6 +92,7 @@ describe('Dropdown Utils', () => { input.value = '"community con'; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -90,6 +100,7 @@ describe('Dropdown Utils', () => { input.value = '~"community con'; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -97,6 +108,7 @@ describe('Dropdown Utils', () => { input.value = '\''; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -104,6 +116,7 @@ describe('Dropdown Utils', () => { input.value = '~\''; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -111,6 +124,7 @@ describe('Dropdown Utils', () => { input.value = '\'community con'; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -118,6 +132,7 @@ describe('Dropdown Utils', () => { input.value = '~\'community con'; const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem); + expect(updatedItem.droplab_hidden).toBe(false); }); }); @@ -152,17 +167,20 @@ describe('Dropdown Utils', () => { let updatedItem = DropdownUtils.filterHint(config(), { hint: 'label', }); + expect(updatedItem.droplab_hidden).toBe(false); input.value = 'o'; updatedItem = DropdownUtils.filterHint(config(), { hint: 'label', }); + expect(updatedItem.droplab_hidden).toBe(true); }); it('should return droplab_hidden false when item has no hint', () => { const updatedItem = DropdownUtils.filterHint(config(), {}, ''); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -172,6 +190,7 @@ describe('Dropdown Utils', () => { hint: 'label', type: 'array', }); + expect(updatedItem.droplab_hidden).toBe(false); }); @@ -180,12 +199,14 @@ describe('Dropdown Utils', () => { let updatedItem = DropdownUtils.filterHint(config(), { hint: 'milestone', }); + expect(updatedItem.droplab_hidden).toBe(true); updatedItem = DropdownUtils.filterHint(config(), { hint: 'milestone', type: 'string', }); + expect(updatedItem.droplab_hidden).toBe(true); }); }); @@ -205,6 +226,7 @@ describe('Dropdown Utils', () => { }; const updated = DropdownUtils.mergeDuplicateLabels(dataMap, newLabel); + expect(updated[newLabel.title]).toEqual(newLabel); }); @@ -215,6 +237,7 @@ describe('Dropdown Utils', () => { }; const updated = DropdownUtils.mergeDuplicateLabels(dataMap, duplicate); + expect(updated.label.multipleColors).toEqual([dataMap.label.color, duplicate.color]); }); }); @@ -222,21 +245,25 @@ describe('Dropdown Utils', () => { describe('duplicateLabelColor', () => { it('should linear-gradient 2 colors', () => { const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000']); + expect(gradient).toEqual('linear-gradient(#FFFFFF 0%, #FFFFFF 50%, #000000 50%, #000000 100%)'); }); it('should linear-gradient 3 colors', () => { const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000', '#333333']); + expect(gradient).toEqual('linear-gradient(#FFFFFF 0%, #FFFFFF 33%, #000000 33%, #000000 66%, #333333 66%, #333333 100%)'); }); it('should linear-gradient 4 colors', () => { const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000', '#333333', '#DDDDDD']); + expect(gradient).toEqual('linear-gradient(#FFFFFF 0%, #FFFFFF 25%, #000000 25%, #000000 50%, #333333 50%, #333333 75%, #DDDDDD 75%, #DDDDDD 100%)'); }); it('should not linear-gradient more than 4 colors', () => { const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000', '#333333', '#DDDDDD', '#EEEEEE']); + expect(gradient.indexOf('#EEEEEE')).toBe(-1); }); }); @@ -244,6 +271,7 @@ describe('Dropdown Utils', () => { describe('duplicateLabelPreprocessing', () => { it('should set preprocessed to true', () => { const results = DropdownUtils.duplicateLabelPreprocessing([]); + expect(results.preprocessed).toEqual(true); }); @@ -298,6 +326,7 @@ describe('Dropdown Utils', () => { }; DropdownUtils.setDataValueIfSelected(null, selected); + expect(FilteredSearchDropdownManager.addWordToInput.calls.count()).toEqual(1); }); @@ -308,6 +337,7 @@ describe('Dropdown Utils', () => { }; const result = DropdownUtils.setDataValueIfSelected(null, selected); + expect(result).toBe(true); }); @@ -317,6 +347,7 @@ describe('Dropdown Utils', () => { }; const result = DropdownUtils.setDataValueIfSelected(null, selected); + expect(result).toBe(false); }); }); diff --git a/spec/javascripts/filtered_search/filtered_search_manager_spec.js b/spec/javascripts/filtered_search/filtered_search_manager_spec.js index a03d5a31b41..5a985e97a34 100644 --- a/spec/javascripts/filtered_search/filtered_search_manager_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_manager_spec.js @@ -134,6 +134,7 @@ describe('Filtered Search Manager', function () { }; manager.searchState(e); + expect(FilteredSearchManager.prototype.search).not.toHaveBeenCalled(); }); @@ -149,6 +150,7 @@ describe('Filtered Search Manager', function () { }; manager.searchState(e); + expect(FilteredSearchManager.prototype.search).toHaveBeenCalledWith('opened'); }); }); @@ -304,6 +306,7 @@ describe('Filtered Search Manager', function () { ); tokensContainer.querySelector('.js-visual-token .remove-token').click(); + expect(tokensContainer.querySelector('.js-visual-token')).toEqual(null); }); @@ -437,11 +440,13 @@ describe('Filtered Search Manager', function () { it('toggles on focus', () => { input.focus(); + expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(true); }); it('toggles on blur', () => { input.blur(); + expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(false); }); }); diff --git a/spec/javascripts/filtered_search/filtered_search_token_keys_spec.js b/spec/javascripts/filtered_search/filtered_search_token_keys_spec.js index cf7789a1d57..20264caa5c4 100644 --- a/spec/javascripts/filtered_search/filtered_search_token_keys_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_token_keys_spec.js @@ -51,11 +51,13 @@ describe('Filtered Search Token Keys', () => { describe('searchByKey', () => { it('should return null when key not found', () => { const tokenKey = new FilteredSearchTokenKeys(tokenKeys).searchByKey('notakey'); + expect(tokenKey).toBeNull(); }); it('should return tokenKey when found by key', () => { const result = new FilteredSearchTokenKeys(tokenKeys).searchByKey(tokenKeys[0].key); + expect(result).toEqual(tokenKeys[0]); }); }); @@ -63,11 +65,13 @@ describe('Filtered Search Token Keys', () => { describe('searchBySymbol', () => { it('should return null when symbol not found', () => { const tokenKey = new FilteredSearchTokenKeys(tokenKeys).searchBySymbol('notasymbol'); + expect(tokenKey).toBeNull(); }); it('should return tokenKey when found by symbol', () => { const result = new FilteredSearchTokenKeys(tokenKeys).searchBySymbol(tokenKeys[0].symbol); + expect(result).toEqual(tokenKeys[0]); }); }); @@ -75,16 +79,19 @@ describe('Filtered Search Token Keys', () => { describe('searchByKeyParam', () => { it('should return null when key param not found', () => { const tokenKey = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam('notakeyparam'); + expect(tokenKey).toBeNull(); }); it('should return tokenKey when found by key param', () => { const result = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`); + expect(result).toEqual(tokenKeys[0]); }); it('should return alternative tokenKey when found by key param', () => { const result = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`); + expect(result).toEqual(tokenKeys[0]); }); }); @@ -92,12 +99,14 @@ describe('Filtered Search Token Keys', () => { describe('searchByConditionUrl', () => { it('should return null when condition url not found', () => { const condition = new FilteredSearchTokenKeys([], [], conditions).searchByConditionUrl(null); + expect(condition).toBeNull(); }); it('should return condition when found by url', () => { const result = new FilteredSearchTokenKeys([], [], conditions) .searchByConditionUrl(conditions[0].url); + expect(result).toBe(conditions[0]); }); }); @@ -106,12 +115,14 @@ describe('Filtered Search Token Keys', () => { it('should return null when condition tokenKey and value not found', () => { const condition = new FilteredSearchTokenKeys([], [], conditions) .searchByConditionKeyValue(null, null); + expect(condition).toBeNull(); }); it('should return condition when found by tokenKey and value', () => { const result = new FilteredSearchTokenKeys([], [], conditions) .searchByConditionKeyValue(conditions[0].tokenKey, conditions[0].value); + expect(result).toEqual(conditions[0]); }); }); diff --git a/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js b/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js index 4f9f546cbb5..d8eb75ec000 100644 --- a/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js @@ -7,6 +7,7 @@ describe('Filtered Search Tokenizer', () => { describe('processTokens', () => { it('returns for input containing only search value', () => { const results = FilteredSearchTokenizer.processTokens('searchTerm', allowedKeys); + expect(results.searchToken).toBe('searchTerm'); expect(results.tokens.length).toBe(0); expect(results.lastToken).toBe(results.searchToken); @@ -15,6 +16,7 @@ describe('Filtered Search Tokenizer', () => { it('returns for input containing only tokens', () => { const results = FilteredSearchTokenizer .processTokens('author:@root label:~"Very Important" milestone:%v1.0 assignee:none', allowedKeys); + expect(results.searchToken).toBe(''); expect(results.tokens.length).toBe(4); expect(results.tokens[3]).toBe(results.lastToken); @@ -39,6 +41,7 @@ describe('Filtered Search Tokenizer', () => { it('returns for input starting with search value and ending with tokens', () => { const results = FilteredSearchTokenizer .processTokens('searchTerm anotherSearchTerm milestone:none', allowedKeys); + expect(results.searchToken).toBe('searchTerm anotherSearchTerm'); expect(results.tokens.length).toBe(1); expect(results.tokens[0]).toBe(results.lastToken); @@ -83,6 +86,7 @@ describe('Filtered Search Tokenizer', () => { it('returns for input containing search value in between tokens', () => { const results = FilteredSearchTokenizer .processTokens('author:@root searchTerm assignee:none anotherSearchTerm label:~Doing', allowedKeys); + expect(results.searchToken).toBe('searchTerm anotherSearchTerm'); expect(results.tokens.length).toBe(3); expect(results.tokens[2]).toBe(results.lastToken); @@ -102,6 +106,7 @@ describe('Filtered Search Tokenizer', () => { it('returns search value for invalid tokens', () => { const results = FilteredSearchTokenizer.processTokens('fake:token', allowedKeys); + expect(results.lastToken).toBe('fake:token'); expect(results.searchToken).toBe('fake:token'); expect(results.tokens.length).toEqual(0); @@ -109,6 +114,7 @@ describe('Filtered Search Tokenizer', () => { it('returns search value and token for mix of valid and invalid tokens', () => { const results = FilteredSearchTokenizer.processTokens('label:real fake:token', allowedKeys); + expect(results.tokens.length).toEqual(1); expect(results.tokens[0].key).toBe('label'); expect(results.tokens[0].value).toBe('real'); @@ -119,12 +125,14 @@ describe('Filtered Search Tokenizer', () => { it('returns search value for invalid symbols', () => { const results = FilteredSearchTokenizer.processTokens('std::includes', allowedKeys); + expect(results.lastToken).toBe('std::includes'); expect(results.searchToken).toBe('std::includes'); }); it('removes duplicated values', () => { const results = FilteredSearchTokenizer.processTokens('label:~foo label:~foo', allowedKeys); + expect(results.tokens.length).toBe(1); expect(results.tokens[0].key).toBe('label'); expect(results.tokens[0].value).toBe('foo'); diff --git a/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js b/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js index 53a6d1d62b0..b1fb474e755 100644 --- a/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js @@ -131,6 +131,7 @@ describe('Filtered Search Visual Tokens', () => { describe('getEndpointWithQueryParams', () => { it('returns `endpoint` string as is when second param `endpointQueryParams` is undefined, null or empty string', () => { const endpoint = 'foo/bar/labels.json'; + expect(subject.getEndpointWithQueryParams(endpoint)).toBe(endpoint); expect(subject.getEndpointWithQueryParams(endpoint, null)).toBe(endpoint); expect(subject.getEndpointWithQueryParams(endpoint, '')).toBe(endpoint); @@ -161,6 +162,7 @@ describe('Filtered Search Visual Tokens', () => { `); const selected = tokensContainer.querySelector('.js-visual-token .selected'); + expect(selected.classList.contains('selected')).toEqual(true); subject.unselectTokens(); @@ -675,6 +677,7 @@ describe('Filtered Search Visual Tokens', () => { subject.moveInputToTheRight(); const token = tokensContainer.children[1]; + expect(token.querySelector('.value').innerText).toEqual('~bug'); }); }); @@ -712,6 +715,7 @@ describe('Filtered Search Visual Tokens', () => { expect(tokenValueElement.innerText).toBe(tokenValue); expect(updateUserTokenAppearanceSpy.calls.count()).toBe(1); const expectedArgs = [tokenValueContainer, tokenValueElement, tokenValue]; + expect(updateUserTokenAppearanceSpy.calls.argsFor(0)).toEqual(expectedArgs); expect(updateLabelTokenColorSpy.calls.count()).toBe(0); }); @@ -727,6 +731,7 @@ describe('Filtered Search Visual Tokens', () => { expect(tokenValueElement.innerText).toBe(tokenValue); expect(updateLabelTokenColorSpy.calls.count()).toBe(1); const expectedArgs = [tokenValueContainer, tokenValue]; + expect(updateLabelTokenColorSpy.calls.argsFor(0)).toEqual(expectedArgs); expect(updateUserTokenAppearanceSpy.calls.count()).toBe(0); }); @@ -814,6 +819,7 @@ describe('Filtered Search Visual Tokens', () => { expect(tokenValueContainer.dataset.originalValue).toBe(tokenValue); expect(tokenValueElement.innerText.trim()).toBe(dummyUser.name); const avatar = tokenValueElement.querySelector('img.avatar'); + expect(avatar.src).toBe(dummyUser.avatar_url); expect(avatar.alt).toBe(''); }) @@ -837,6 +843,7 @@ describe('Filtered Search Visual Tokens', () => { .then(() => { expect(tokenValueElement.innerText.trim()).toBe(dummyUser.name); tokenValueElement.querySelector('.avatar').remove(); + expect(tokenValueElement.innerHTML.trim()).toBe(_.escape(dummyUser.name)); }) .then(done) @@ -854,23 +861,27 @@ describe('Filtered Search Visual Tokens', () => { it('should set backgroundColor', () => { const originalBackgroundColor = bugLabelToken.style.backgroundColor; const token = subject.setTokenStyle(bugLabelToken, 'blue', 'white'); + expect(token.style.backgroundColor).toEqual('blue'); expect(token.style.backgroundColor).not.toEqual(originalBackgroundColor); }); it('should not set backgroundColor when it is a linear-gradient', () => { const token = subject.setTokenStyle(bugLabelToken, 'linear-gradient(135deg, red, blue)', 'white'); + expect(token.style.backgroundColor).toEqual(bugLabelToken.style.backgroundColor); }); it('should set textColor', () => { const token = subject.setTokenStyle(bugLabelToken, 'white', 'black'); + expect(token.style.color).toEqual('black'); expect(token.style.color).not.toEqual(originalTextColor); }); it('should add inverted class when textColor is #FFFFFF', () => { const token = subject.setTokenStyle(bugLabelToken, 'black', '#FFFFFF'); + expect(token.style.color).toEqual('rgb(255, 255, 255)'); expect(token.style.color).not.toEqual(originalTextColor); expect(token.querySelector('.remove-token').classList.contains('inverted')).toEqual(true); @@ -894,14 +905,17 @@ describe('Filtered Search Visual Tokens', () => { describe('not preprocessed before', () => { it('returns preprocessed labels', () => { let labels = []; + expect(labels.preprocessed).not.toEqual(true); labels = FilteredSearchVisualTokens.preprocessLabel(endpoint, labels); + expect(labels.preprocessed).toEqual(true); }); it('overrides AjaxCache with preprocessed results', () => { spyOn(AjaxCache, 'override').and.callFake(() => {}); FilteredSearchVisualTokens.preprocessLabel(endpoint, []); + expect(AjaxCache.override.calls.count()).toEqual(1); }); }); @@ -982,6 +996,7 @@ describe('Filtered Search Visual Tokens', () => { const { tokenValueContainer, tokenValueElement } = findElements(missingLabelToken); const tokenValue = tokenValueElement.innerText; const matchingLabel = findLabel(tokenValue); + expect(matchingLabel).toBe(undefined); subject.updateLabelTokenColor(tokenValueContainer, tokenValue) diff --git a/spec/javascripts/filtered_search/services/recent_searches_service_spec.js b/spec/javascripts/filtered_search/services/recent_searches_service_spec.js index c293c0afa97..e8cb69aba7f 100644 --- a/spec/javascripts/filtered_search/services/recent_searches_service_spec.js +++ b/spec/javascripts/filtered_search/services/recent_searches_service_spec.js @@ -92,6 +92,7 @@ describe('RecentSearchesService', () => { const items = ['foo', 'bar']; service.save(items); const newLocalStorageValue = window.localStorage.getItem(service.localStorageKey); + expect(JSON.parse(newLocalStorageValue)).toEqual(items); }); }); |