diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-09-29 13:43:39 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-09-29 13:43:39 +0200 |
commit | ef22b0dc813b9e1579ac4f25de2eaf8bf66a8236 (patch) | |
tree | 5f4a3af4478808ff9fb628ea1c99e233caaa8674 /spec/javascripts/repo/components | |
parent | 705a840d2e78bdb506575b0dc66677ae2fcad95e (diff) | |
download | gitlab-ce-ef22b0dc813b9e1579ac4f25de2eaf8bf66a8236.tar.gz |
Title has now its own testdm-json-page-title
Diffstat (limited to 'spec/javascripts/repo/components')
-rw-r--r-- | spec/javascripts/repo/components/repo_file_spec.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/javascripts/repo/components/repo_file_spec.js b/spec/javascripts/repo/components/repo_file_spec.js index c25e63b6dfc..f15633bd8b9 100644 --- a/spec/javascripts/repo/components/repo_file_spec.js +++ b/spec/javascripts/repo/components/repo_file_spec.js @@ -8,14 +8,17 @@ describe('RepoFile', () => { icon: 'icon', url: 'url', name: 'name', - pageTitle: 'pageTitle', lastCommitMessage: 'message', lastCommitUpdate: Date.now(), level: 10, }; const activeFile = { - url: 'activeUrl', pageTitle: 'pageTitle', + url: 'url', + }; + const otherFile = { + html: '<p class="file-content">html</p>', + pageTitle: 'otherpageTitle', }; function createComponent(propsData) { @@ -31,7 +34,6 @@ describe('RepoFile', () => { }); it('renders link, icon, name and last commit details', () => { - RepoStore.setActiveFiles(activeFile); const vm = createComponent({ file, activeFile, @@ -44,7 +46,6 @@ describe('RepoFile', () => { expect(name.title).toEqual(file.url); expect(name.href).toMatch(`/${file.url}`); expect(name.textContent.trim()).toEqual(file.name); - expect(document.title.trim()).toEqual(activeFile.pageTitle); expect(vm.$el.querySelector('.commit-message').textContent.trim()).toBe(file.lastCommitMessage); expect(vm.$el.querySelector('.commit-update').textContent.trim()).toBe(updated); expect(fileIcon.classList.contains(file.icon)).toBeTruthy(); @@ -65,6 +66,12 @@ describe('RepoFile', () => { expect(vm.$el.querySelector('.fa-spin.fa-spinner')).toBeFalsy(); }); + it('sets the document title correctly', () => { + RepoStore.setActiveFiles(otherFile); + + expect(document.title.trim()).toEqual(otherFile.pageTitle); + }); + it('renders a spinner if the file is loading', () => { file.loading = true; const vm = createComponent({ |