Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/pages/projects/find_file/ref_switcher/ref_switcher_utils_spec.js')
-rw-r--r--spec/frontend/pages/projects/find_file/ref_switcher/ref_switcher_utils_spec.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/frontend/pages/projects/find_file/ref_switcher/ref_switcher_utils_spec.js b/spec/frontend/pages/projects/find_file/ref_switcher/ref_switcher_utils_spec.js
index ef2e5d779d8..62eae19ce4c 100644
--- a/spec/frontend/pages/projects/find_file/ref_switcher/ref_switcher_utils_spec.js
+++ b/spec/frontend/pages/projects/find_file/ref_switcher/ref_switcher_utils_spec.js
@@ -10,7 +10,7 @@ describe('generateRefDestinationPath', () => {
${`${projectRootPath}/-/find_file/flightjs/Flight`} | ${`http://test.host/${projectRootPath}/-/find_file/${selectedRef}`}
${`${projectRootPath}/-/find_file/test/test1?test=something`} | ${`http://test.host/${projectRootPath}/-/find_file/${selectedRef}?test=something`}
${`${projectRootPath}/-/find_file/simpletest?test=something&test=it`} | ${`http://test.host/${projectRootPath}/-/find_file/${selectedRef}?test=something&test=it`}
- ${`${projectRootPath}/-/find_file/some_random_char?test=something&test[]=it&test[]=is`} | ${`http://test.host/${projectRootPath}/-/find_file/${selectedRef}?test=something&test[]=it&test[]=is`}
+ ${`${projectRootPath}/-/find_file/some_random_char?test=something&test[]=it&test[]=is`} | ${`http://test.host/${projectRootPath}/-/find_file/${selectedRef}?test=something&test%5B%5D=it&test%5B%5D=is`}
`('generates the correct destination path for $currentPath', ({ currentPath, result }) => {
setWindowLocation(currentPath);
expect(generateRefDestinationPath(selectedRef, '/-/find_file')).toBe(result);
@@ -36,4 +36,11 @@ describe('generateRefDestinationPath', () => {
`http://test.host/${projectRootPath}/-/find_file/flightjs/Flight`,
);
});
+
+ it('removes ref_type from the destination url if ref is neither a branch or tag', () => {
+ setWindowLocation(`${projectRootPath}/-/find_file/somebranch?ref_type=heads`);
+ expect(generateRefDestinationPath('8e90e533', '/-/find_file')).toBe(
+ `http://test.host/${projectRootPath}/-/find_file/8e90e533`,
+ );
+ });
});