summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-07-26 18:55:01 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-07-26 18:55:01 +0100
commit18bc8543f38fcc4123a68b23d3c14c786c5141b8 (patch)
treeb2dadcba9d2b3e48c580c19520b152e7e2869f78
parent0fdcb703d1756f12df0bebc8ca6ccfda8659725e (diff)
downloadgitlab-ce-18bc8543f38fcc4123a68b23d3c14c786c5141b8.tar.gz
Fix repo_file_spec
-rw-r--r--app/assets/javascripts/repo/repo_file.vue2
-rw-r--r--spec/javascripts/repo/repo_file_spec.js9
2 files changed, 8 insertions, 3 deletions
diff --git a/app/assets/javascripts/repo/repo_file.vue b/app/assets/javascripts/repo/repo_file.vue
index 59b97235296..0a21538b521 100644
--- a/app/assets/javascripts/repo/repo_file.vue
+++ b/app/assets/javascripts/repo/repo_file.vue
@@ -52,7 +52,7 @@ export default RepoFile;
</td>
<td v-if="!isMini" class="hidden-xs">
- <span>{{timeFormated(file.lastCommitUpdate)}}</span>
+ <span class="commit-update">{{timeFormated(file.lastCommitUpdate)}}</span>
</td>
</tr>
</template>
diff --git a/spec/javascripts/repo/repo_file_spec.js b/spec/javascripts/repo/repo_file_spec.js
index 49ccd812015..dad13c3fe2d 100644
--- a/spec/javascripts/repo/repo_file_spec.js
+++ b/spec/javascripts/repo/repo_file_spec.js
@@ -2,12 +2,13 @@ import Vue from 'vue';
import repoFile from '~/repo/repo_file.vue';
describe('RepoFile', () => {
+ const updated = 'updated';
const file = {
icon: 'icon',
url: 'url',
name: 'name',
lastCommitMessage: 'message',
- lastCommitUpdate: 'update',
+ lastCommitUpdate: Date.now(),
level: 10,
};
const activeFile = {
@@ -22,6 +23,10 @@ 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,
@@ -35,7 +40,7 @@ describe('RepoFile', () => {
expect(name.href).toMatch(`/${file.url}`);
expect(name.textContent).toEqual(file.name);
expect(vm.$el.querySelector('.commit-message').textContent).toBe(file.lastCommitMessage);
- expect(vm.$el.querySelector('.commit-update').textContent).toBe(file.lastCommitUpdate);
+ expect(vm.$el.querySelector('.commit-update').textContent).toBe(updated);
});
it('does render if hasFiles is true and is loading tree', () => {