summaryrefslogtreecommitdiff
path: root/spec/javascripts/ide/components
diff options
context:
space:
mode:
authorAndré Luís <me@andr3.net>2018-05-07 17:42:56 +0000
committerPhil Hughes <me@iamphill.com>2018-05-07 17:42:56 +0000
commitb7f3d7470b41292aa484cf2dd821ff91086efe96 (patch)
tree6602c223b5b0100ec678cb295ea29f62570124a2 /spec/javascripts/ide/components
parent68b71df67f18f9b57a613610849b619361df246e (diff)
downloadgitlab-ce-b7f3d7470b41292aa484cf2dd821ff91086efe96.tar.gz
Resolve "Clean up bottom status bar Web IDE"
Diffstat (limited to 'spec/javascripts/ide/components')
-rw-r--r--spec/javascripts/ide/components/ide_status_bar_spec.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/javascripts/ide/components/ide_status_bar_spec.js b/spec/javascripts/ide/components/ide_status_bar_spec.js
new file mode 100644
index 00000000000..770dca9cb0f
--- /dev/null
+++ b/spec/javascripts/ide/components/ide_status_bar_spec.js
@@ -0,0 +1,63 @@
+import Vue from 'vue';
+import store from '~/ide/stores';
+import ideStatusBar from '~/ide/components/ide_status_bar.vue';
+import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
+import { resetStore } from '../helpers';
+import { projectData } from '../mock_data';
+
+describe('ideStatusBar', () => {
+ let vm;
+
+ beforeEach(() => {
+ const Component = Vue.extend(ideStatusBar);
+
+ store.state.currentProjectId = 'abcproject';
+ store.state.projects.abcproject = projectData;
+
+ vm = createComponentWithStore(Component, store).$mount();
+ });
+
+ afterEach(() => {
+ vm.$destroy();
+
+ resetStore(vm.$store);
+ });
+
+ it('renders the statusbar', () => {
+ expect(vm.$el.className).toBe('ide-status-bar');
+ });
+
+ describe('mounted', () => {
+ it('triggers a setInterval', () => {
+ expect(vm.intervalId).not.toBe(null);
+ });
+ });
+
+ describe('commitAgeUpdate', () => {
+ beforeEach(function() {
+ jasmine.clock().install();
+ spyOn(vm, 'commitAgeUpdate').and.callFake(() => {});
+ vm.startTimer();
+ });
+
+ afterEach(function() {
+ jasmine.clock().uninstall();
+ });
+
+ it('gets called every second', () => {
+ expect(vm.commitAgeUpdate).not.toHaveBeenCalled();
+
+ jasmine.clock().tick(1100);
+ expect(vm.commitAgeUpdate.calls.count()).toEqual(1);
+
+ jasmine.clock().tick(1000);
+ expect(vm.commitAgeUpdate.calls.count()).toEqual(2);
+ });
+ });
+
+ describe('getCommitPath', () => {
+ it('returns the path to the commit details', () => {
+ expect(vm.getCommitPath('abc123de')).toBe('/commit/abc123de');
+ });
+ });
+});