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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
cfe83509
Commit
cfe83509
authored
Jan 20, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix autocomplete initial undefined state
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/26775
parent
b60de9c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
3 deletions
+38
-3
app/assets/javascripts/gfm_auto_complete.js.es6
app/assets/javascripts/gfm_auto_complete.js.es6
+8
-3
changelogs/unreleased/26775-fix-auto-complete-initial-loading.yml
...gs/unreleased/26775-fix-auto-complete-initial-loading.yml
+4
-0
spec/javascripts/gfm_auto_complete_spec.js.es6
spec/javascripts/gfm_auto_complete_spec.js.es6
+26
-0
No files found.
app/assets/javascripts/gfm_auto_complete.js.es6
View file @
cfe83509
...
...
@@ -367,9 +367,14 @@
return $input.trigger('keyup');
},
isLoading(data) {
if (!data || !data.length) return false;
if (Array.isArray(data)) data = data[0];
return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0];
var dataToInspect = data;
if (data && data.length > 0) {
dataToInspect = data[0];
}
var loadingState = this.defaultLoadingData[0];
return dataToInspect &&
(dataToInspect === loadingState || dataToInspect.name === loadingState);
}
};
}).call(this);
changelogs/unreleased/26775-fix-auto-complete-initial-loading.yml
0 → 100644
View file @
cfe83509
---
title
:
Fix autocomplete initial undefined state
merge_request
:
author
:
spec/javascripts/gfm_auto_complete_spec.js.es6
View file @
cfe83509
...
...
@@ -62,4 +62,30 @@ describe('GfmAutoComplete', function () {
});
});
});
describe('isLoading', function () {
it('should be true with loading data object item', function () {
expect(GfmAutoComplete.isLoading({ name: 'loading' })).toBe(true);
});
it('should be true with loading data array', function () {
expect(GfmAutoComplete.isLoading(['loading'])).toBe(true);
});
it('should be true with loading data object array', function () {
expect(GfmAutoComplete.isLoading([{ name: 'loading' }])).toBe(true);
});
it('should be false with actual array data', function () {
expect(GfmAutoComplete.isLoading([
{ title: 'Foo' },
{ title: 'Bar' },
{ title: 'Qux' },
])).toBe(false);
});
it('should be false with actual data item', function () {
expect(GfmAutoComplete.isLoading({ title: 'Foo' })).toBe(false);
});
});
});
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