it('updates store with new branch name', done => {
   store
     .dispatch('commit/updateBranchName', 'branch-name')
     .then(() => {
       expect(store.state.commit.newBranchName).toBe('branch-name');
     })
     .then(done)
     .catch(done.fail);
 });
 it('updates store with new commit action', done => {
   store
     .dispatch('commit/updateCommitAction', '1')
     .then(() => {
       expect(store.state.commit.commitAction).toBe('1');
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #3
0
 it('emits event to dispose model', done => {
   store
     .dispatch('removePendingTab', f)
     .then(() => {
       expect(eventHub.$emit).toHaveBeenCalledWith(`editor.update.model.dispose.${f.key}`);
     })
     .then(done)
     .catch(done.fail);
 });
 it('updates store with new commit message', done => {
   store
     .dispatch('commit/updateCommitMessage', 'testing')
     .then(() => {
       expect(store.state.commit.commitMessage).toBe('testing');
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #5
0
 it('updates viewer state', done => {
   store
     .dispatch('updateViewer', 'diff')
     .then(() => {
       expect(store.state.viewer).toBe('diff');
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #6
0
 it('makes file pending in openFiles', done => {
   store
     .dispatch('openPendingTab', { file: f, keyPrefix: 'pending' })
     .then(() => {
       expect(store.state.openFiles[0].pending).toBe(true);
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #7
0
 it('returns true when opened', done => {
   store
     .dispatch('openPendingTab', { file: f, keyPrefix: 'pending' })
     .then(added => {
       expect(added).toBe(true);
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #8
0
 it('discards changes in file', done => {
   store
     .dispatch('discardAllChanges')
     .then(() => {
       expect(store.state.openFiles.changed).toBeFalsy();
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #9
0
 it('commits initial data', done => {
   store
     .dispatch('setInitialData', { canCommit: true })
     .then(() => {
       expect(store.state.canCommit).toBeTruthy();
       done();
     })
     .catch(done.fail);
 });
Beispiel #10
0
      it('calls getRawFileData service method', done => {
        store
          .dispatch('getRawFileData', { path: tmpFile.path })
          .then(() => {
            expect(service.getRawFileData).toHaveBeenCalledWith(tmpFile);

            done();
          })
          .catch(done.fail);
      });
Beispiel #11
0
      it('sets the file as active', done => {
        store
          .dispatch('getFileData', { path: localFile.path })
          .then(() => {
            expect(localFile.active).toBeTruthy();

            done();
          })
          .catch(done.fail);
      });
Beispiel #12
0
      it('sets the file data', done => {
        store
          .dispatch('getFileData', { path: localFile.path })
          .then(() => {
            expect(localFile.blamePath).toBe('blame_path');

            done();
          })
          .catch(done.fail);
      });
Beispiel #13
0
      it('calls the service', done => {
        store
          .dispatch('getFileData', { path: localFile.path })
          .then(() => {
            expect(service.getFileData).toHaveBeenCalledWith(`${gl.TEST_HOST}/getFileDataURL`);

            done();
          })
          .catch(done.fail);
      });
Beispiel #14
0
    it('sets the file active', done => {
      store
        .dispatch('setFileActive', localFile.path)
        .then(() => {
          expect(localFile.active).toBeTruthy();

          done();
        })
        .catch(done.fail);
    });
Beispiel #15
0
    it('calls scrollToTab', done => {
      store
        .dispatch('setFileActive', localFile.path)
        .then(() => {
          expect(scrollToTabSpy).toHaveBeenCalled();

          done();
        })
        .catch(done.fail);
    });
Beispiel #16
0
      it('does not parse returned JSON', done => {
        store
          .dispatch('getRawFileData', { path: tmpFile.path })
          .then(() => {
            expect(tmpFile.raw).toEqual('{"test":"123"}');

            done();
          })
          .catch(done.fail);
      });
Beispiel #17
0
    it('closes all open files', done => {
      store
        .dispatch('closeAllFiles')
        .then(() => {
          expect(store.state.openFiles.length).toBe(0);

          done();
        })
        .catch(done.fail);
    });
Beispiel #18
0
 it('removes all files from changedFiles state', done => {
   store
     .dispatch('discardAllChanges')
     .then(() => {
       expect(store.state.changedFiles.length).toBe(0);
       expect(store.state.openFiles.length).toBe(1);
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #19
0
      it('updates file raw data', done => {
        store
          .dispatch('getRawFileData', { path: tmpFile.path })
          .then(() => {
            expect(tmpFile.raw).toBe('raw');

            done();
          })
          .catch(done.fail);
      });
Beispiel #20
0
      it('sets the file not as active if we pass makeFileActive false', done => {
        store
          .dispatch('getFileData', { path: localFile.path, makeFileActive: false })
          .then(() => {
            expect(localFile.active).toBeFalsy();

            done();
          })
          .catch(done.fail);
      });
Beispiel #21
0
      it('sets document title', done => {
        store
          .dispatch('getFileData', { path: localFile.path })
          .then(() => {
            expect(document.title).toBe('testing getFileData');

            done();
          })
          .catch(done.fail);
      });
Beispiel #22
0
    it('emits eventHub event to dispose cached model', done => {
      store
        .dispatch('discardFileChanges', tmpFile.path)
        .then(() => {
          expect(eventHub.$emit).toHaveBeenCalled();

          done();
        })
        .catch(done.fail);
    });
Beispiel #23
0
    it('removes file from changedFiles array', done => {
      store
        .dispatch('discardFileChanges', tmpFile.path)
        .then(() => {
          expect(store.state.changedFiles.length).toBe(0);

          done();
        })
        .catch(done.fail);
    });
Beispiel #24
0
    it('resets file content', done => {
      store
        .dispatch('discardFileChanges', tmpFile.path)
        .then(() => {
          expect(tmpFile.content).not.toBe('testing');

          done();
        })
        .catch(done.fail);
    });
 it('updates commit message with short_id', done => {
   store
     .dispatch('commit/setLastCommitMessage', { short_id: '123' })
     .then(() => {
       expect(store.state.lastCommitMsg).toContain(
         'Your changes have been committed. Commit <a href="http://testing/commit/123" class="commit-sha">123</a>',
       );
     })
     .then(done)
     .catch(done.fail);
 });
Beispiel #26
0
    it('removes pending file from open files', done => {
      store.state.openFiles.push(f);

      store
        .dispatch('removePendingTab', f)
        .then(() => {
          expect(store.state.openFiles.length).toBe(0);
        })
        .then(done)
        .catch(done.fail);
    });
Beispiel #27
0
    it('pushes router URL when added', done => {
      store.state.currentBranchId = 'master';

      store
        .dispatch('openPendingTab', { file: f, keyPrefix: 'pending' })
        .then(() => {
          expect(router.push).toHaveBeenCalledWith('/project/123/tree/master/');
        })
        .then(done)
        .catch(done.fail);
    });
    it('resets commit message to blank', done => {
      store.state.commit.commitMessage = 'testing';

      store
        .dispatch('commit/discardDraft')
        .then(() => {
          expect(store.state.commit.commitMessage).not.toBe('testing');
        })
        .then(done)
        .catch(done.fail);
    });
Beispiel #29
0
      it('adds the file to open files', done => {
        store
          .dispatch('getFileData', { path: localFile.path })
          .then(() => {
            expect(store.state.openFiles.length).toBe(1);
            expect(store.state.openFiles[0].name).toBe(localFile.name);

            done();
          })
          .catch(done.fail);
      });
Beispiel #30
0
    it('closes open files', done => {
      store
        .dispatch('closeFile', localFile)
        .then(() => {
          expect(localFile.opened).toBeFalsy();
          expect(localFile.active).toBeFalsy();
          expect(store.state.openFiles.length).toBe(0);

          done();
        })
        .catch(done.fail);
    });