diff options
author | Phil Hughes <me@iamphill.com> | 2018-06-07 16:47:09 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-06-07 16:47:09 +0300 |
commit | 02a2ca6ae4ab6f2b64ff00f5750a68e9371a4fb7 (patch) | |
tree | 04dd78c71a406dcf667d14c074ccaf8a966edef4 /spec | |
parent | 3094f1c1f2986d82994f3da988c3ae3eb5780c14 (diff) |
Fixes IDE button on merge requests not working with relative URL config
Closes #46438
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/lib/utils/url_utility_spec.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/url_utility_spec.js b/spec/javascripts/lib/utils/url_utility_spec.js new file mode 100644 index 00000000000..8ed4950ee09 --- /dev/null +++ b/spec/javascripts/lib/utils/url_utility_spec.js @@ -0,0 +1,25 @@ +import { webIDEUrl } from '~/lib/utils/url_utility'; + +describe('URL utility', () => { + describe('webIDEUrl', () => { + describe('without relative_url_root', () => { + it('returns IDE path with route', () => { + expect(webIDEUrl('/gitlab-org/gitlab-ce/merge_requests/1')).toBe( + '/-/ide/project/gitlab-org/gitlab-ce/merge_requests/1', + ); + }); + }); + + describe('with relative_url_root', () => { + beforeEach(() => { + gon.relative_url_root = '/gitlab'; + }); + + it('returns IDE path with route', () => { + expect(webIDEUrl('/gitlab/gitlab-org/gitlab-ce/merge_requests/1')).toBe( + '/gitlab/-/ide/project/gitlab-org/gitlab-ce/merge_requests/1', + ); + }); + }); + }); +}); |