Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
f7b63611
Commit
f7b63611
authored
Dec 14, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jasmine tests for filtered search dropdown manager
parent
d93ccb8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
spec/javascripts/filtered_search/filtered_search_dropdown_manager_spec.js.es6
...tered_search/filtered_search_dropdown_manager_spec.js.es6
+57
-0
No files found.
spec/javascripts/filtered_search/filtered_search_dropdown_manager_spec.js.es6
0 → 100644
View file @
f7b63611
//= require filtered_search/filtered_search_tokenizer
//= require filtered_search/filtered_search_dropdown_manager
(() => {
describe('Filtered Search Dropdown Manager', () => {
describe('addWordToInput', () => {
describe('add word and when lastToken is an empty object', () => {
function getInput() {
return document.querySelector('.filtered-search');
}
beforeEach(() => {
spyOn(gl.FilteredSearchTokenizer, 'processTokens')
.and.callFake(query => ({
lastToken: {}
})
);
const input = document.createElement('input');
input.classList.add('filtered-search');
document.body.appendChild(input);
expect(input.value).toBe('');
});
afterEach(() => {
document.querySelector('.filtered-search').outerHTML = '';
});
it('should add word', () => {
gl.FilteredSearchDropdownManager.addWordToInput('firstWord');
expect(getInput().value).toBe('firstWord');
});
it('should not add space before first word', () => {
gl.FilteredSearchDropdownManager.addWordToInput('firstWord', true);
expect(getInput().value).toBe('firstWord');
});
it('should not add space before second word by default', () => {
gl.FilteredSearchDropdownManager.addWordToInput('firstWord');
expect(getInput().value).toBe('firstWord');
gl.FilteredSearchDropdownManager.addWordToInput('secondWord');
expect(getInput().value).toBe('firstWordsecondWord');
});
it('should add space before new word when addSpace is passed', () => {
expect(getInput().value).toBe('');
gl.FilteredSearchDropdownManager.addWordToInput('firstWord');
expect(getInput().value).toBe('firstWord');
gl.FilteredSearchDropdownManager.addWordToInput('secondWord', true);
expect(getInput().value).toBe('firstWord secondWord');
});
});
});
});
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment