diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-01-08 04:09:42 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-01-08 04:09:42 +0300 |
commit | 710f2ec50c49d1e773acc20058ed584f1402de33 (patch) | |
tree | 32315f3a4c92d2ea6debacb6406a1aa650f9fe3e /spec | |
parent | 1924a13ee27a442124009b8aae8a46c606a94acd (diff) | |
parent | 12b3a203228cef5946f1c8dc740ba739b1aed797 (diff) |
Merge branch 'ce-5606-issues-and-mr-autocomplete-in-epics' into 'master'
CE backport of gitlab-ee!8936
See merge request gitlab-org/gitlab-ce!23976
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/gfm_auto_complete_spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/gfm_auto_complete_spec.js b/spec/javascripts/gfm_auto_complete_spec.js index 6f414c8ccf1..a14031f43ed 100644 --- a/spec/javascripts/gfm_auto_complete_spec.js +++ b/spec/javascripts/gfm_auto_complete_spec.js @@ -205,4 +205,40 @@ describe('GfmAutoComplete', function() { expect(GfmAutoComplete.isLoading({ title: 'Foo' })).toBe(false); }); }); + + describe('Issues.insertTemplateFunction', function() { + it('should return default template', function() { + expect(GfmAutoComplete.Issues.insertTemplateFunction({ id: 5, title: 'Some Issue' })).toBe( + '${atwho-at}${id}', // eslint-disable-line no-template-curly-in-string + ); + }); + + it('should return reference when reference is set', function() { + expect( + GfmAutoComplete.Issues.insertTemplateFunction({ + id: 5, + title: 'Some Issue', + reference: 'grp/proj#5', + }), + ).toBe('grp/proj#5'); + }); + }); + + describe('Issues.templateFunction', function() { + it('should return html with id and title', function() { + expect(GfmAutoComplete.Issues.templateFunction({ id: 5, title: 'Some Issue' })).toBe( + '<li><small>5</small> Some Issue</li>', + ); + }); + + it('should replace id with reference if reference is set', function() { + expect( + GfmAutoComplete.Issues.templateFunction({ + id: 5, + title: 'Some Issue', + reference: 'grp/proj#5', + }), + ).toBe('<li><small>grp/proj#5</small> Some Issue</li>'); + }); + }); }); |