summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-01-20 18:04:15 +0000
committerPhil Hughes <me@iamphill.com>2017-01-21 20:05:02 +0000
commit317ef7b51c680503b01c88b8d8fdb09bd1a515e8 (patch)
treebcc0cab6e4301b9300b4758b18dcfe0d396c492c /spec
parent8198d49801d91510fe11c53ce184cf750bd06c49 (diff)
downloadgitlab-ce-317ef7b51c680503b01c88b8d8fdb09bd1a515e8.tar.gz
Fixed failing JS specs
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/filtered_search/dropdown_utils_spec.js.es620
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/javascripts/filtered_search/dropdown_utils_spec.js.es6 b/spec/javascripts/filtered_search/dropdown_utils_spec.js.es6
index f14583ec7d8..19bd8d53219 100644
--- a/spec/javascripts/filtered_search/dropdown_utils_spec.js.es6
+++ b/spec/javascripts/filtered_search/dropdown_utils_spec.js.es6
@@ -67,20 +67,32 @@
});
describe('filterHint', () => {
+ let input;
+
+ beforeEach(() => {
+ setFixtures(`
+ <input type="text" id="test" />
+ `);
+
+ input = document.getElementById('test');
+ });
+
it('should filter', () => {
- let updatedItem = gl.DropdownUtils.filterHint({
+ input.value = 'l';
+ let updatedItem = gl.DropdownUtils.filterHint(input, {
hint: 'label',
- }, 'l');
+ });
expect(updatedItem.droplab_hidden).toBe(false);
- updatedItem = gl.DropdownUtils.filterHint({
+ input.value = 'o';
+ updatedItem = gl.DropdownUtils.filterHint(input, {
hint: 'label',
}, 'o');
expect(updatedItem.droplab_hidden).toBe(true);
});
it('should return droplab_hidden false when item has no hint', () => {
- const updatedItem = gl.DropdownUtils.filterHint({}, '');
+ const updatedItem = gl.DropdownUtils.filterHint(input, {}, '');
expect(updatedItem.droplab_hidden).toBe(false);
});
});