diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-10-03 12:32:47 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-10-04 18:27:56 +0300 |
commit | a0d238066eb7d88a1ad136dab7c56fc63993b7d2 (patch) | |
tree | 68935f60acc27cbdb158d33580ad23da6fcf19ff /spec/javascripts | |
parent | 25186c7aee7f0c25bd3c8fbaab353742d54afdf2 (diff) |
Fixed RepoFile Test
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/repo/components/repo_file_spec.js | 16 | ||||
-rw-r--r-- | spec/javascripts/repo/components/repo_sidebar_spec.js | 4 |
2 files changed, 11 insertions, 9 deletions
diff --git a/spec/javascripts/repo/components/repo_file_spec.js b/spec/javascripts/repo/components/repo_file_spec.js index f15633bd8b9..620b604f404 100644 --- a/spec/javascripts/repo/components/repo_file_spec.js +++ b/spec/javascripts/repo/components/repo_file_spec.js @@ -29,15 +29,17 @@ describe('RepoFile', () => { }).$mount(); } - beforeEach(() => { - spyOn(repoFile.mixins[0].methods, 'timeFormated').and.returnValue(updated); - }); - it('renders link, icon, name and last commit details', () => { - const vm = createComponent({ - file, - activeFile, + const RepoFile = Vue.extend(repoFile); + const vm = new RepoFile({ + propsData: { + file, + activeFile, + }, }); + spyOn(vm, 'timeFormated').and.returnValue(updated); + vm.$mount(); + const name = vm.$el.querySelector('.repo-file-name'); const fileIcon = vm.$el.querySelector('.file-icon'); diff --git a/spec/javascripts/repo/components/repo_sidebar_spec.js b/spec/javascripts/repo/components/repo_sidebar_spec.js index 07ad995479a..5a81c6e611f 100644 --- a/spec/javascripts/repo/components/repo_sidebar_spec.js +++ b/spec/javascripts/repo/components/repo_sidebar_spec.js @@ -80,7 +80,7 @@ describe('RepoSidebar', () => { }; RepoStore.files = [file1]; RepoStore.isRoot = true; - const vm = createComponent(); + vm = createComponent(); vm.fileClicked(file1); @@ -95,7 +95,7 @@ describe('RepoSidebar', () => { spyOn(Helper, 'getFileFromPath').and.returnValue(file); spyOn(RepoStore, 'setActiveFiles'); - const vm = createComponent(); + vm = createComponent(); vm.fileClicked(file); expect(RepoStore.setActiveFiles).toHaveBeenCalledWith(file); |