summaryrefslogtreecommitdiff
path: root/spec/frontend/repository
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 09:09:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 09:09:06 +0000
commit7e8278c0f46cf6058efad5afd0aef177977bd663 (patch)
tree7ac46710921145bb782bcb208ea896e1548b168b /spec/frontend/repository
parentbbf6581214128ae12a6ff32f66a0d03ee57a2e91 (diff)
downloadgitlab-ce-7e8278c0f46cf6058efad5afd0aef177977bd663.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/repository')
-rw-r--r--spec/frontend/repository/utils/title_spec.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/frontend/repository/utils/title_spec.js b/spec/frontend/repository/utils/title_spec.js
index 63035933424..a1213c13be8 100644
--- a/spec/frontend/repository/utils/title_spec.js
+++ b/spec/frontend/repository/utils/title_spec.js
@@ -1,4 +1,4 @@
-import { setTitle } from '~/repository/utils/title';
+import { setTitle, updateRefPortionOfTitle } from '~/repository/utils/title';
describe('setTitle', () => {
it.each`
@@ -13,3 +13,26 @@ describe('setTitle', () => {
expect(document.title).toEqual(`${title} · master · GitLab Org / GitLab · GitLab`);
});
});
+
+describe('updateRefPortionOfTitle', () => {
+ const sha = 'abc';
+ const testCases = [
+ [
+ 'updates the title with the SHA',
+ { title: 'part 1 · part 2 · part 3' },
+ 'part 1 · abc · part 3',
+ ],
+ ["makes no change if there's no title", { foo: null }, undefined],
+ [
+ "makes no change if the title doesn't split predictably",
+ { title: 'part 1 - part 2 - part 3' },
+ 'part 1 - part 2 - part 3',
+ ],
+ ];
+
+ it.each(testCases)('%s', (desc, doc, title) => {
+ updateRefPortionOfTitle(sha, doc);
+
+ expect(doc.title).toEqual(title);
+ });
+});