Commit f0e1ee5f authored by Tim Zallmann's avatar Tim Zallmann

Fixes for Tests on file.js and tabs tests

parent 1814fc3f
...@@ -48,9 +48,8 @@ export const setFileActive = ({ commit, state, getters, dispatch }, path) => { ...@@ -48,9 +48,8 @@ export const setFileActive = ({ commit, state, getters, dispatch }, path) => {
export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive = true }) => { export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive = true }) => {
const file = state.entries[path]; const file = state.entries[path];
return new Promise((resolve, reject) => {
commit(types.TOGGLE_LOADING, { entry: file }); commit(types.TOGGLE_LOADING, { entry: file });
service return service
.getFileData(file.url) .getFileData(file.url)
.then(res => { .then(res => {
const pageTitle = decodeURI(normalizeHeaders(res.headers)['PAGE-TITLE']); const pageTitle = decodeURI(normalizeHeaders(res.headers)['PAGE-TITLE']);
...@@ -65,11 +64,9 @@ export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive ...@@ -65,11 +64,9 @@ export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive
if (makeFileActive) dispatch('setFileActive', file.path); if (makeFileActive) dispatch('setFileActive', file.path);
commit(types.TOGGLE_LOADING, { entry: file }); commit(types.TOGGLE_LOADING, { entry: file });
}) })
.catch(err => { .catch(() => {
commit(types.TOGGLE_LOADING, { entry: file }); commit(types.TOGGLE_LOADING, { entry: file });
flash('Error loading file data. Please try again.', 'alert', document, null, false, true); flash('Error loading file data. Please try again.', 'alert', document, null, false, true);
reject(err);
});
}); });
}; };
......
...@@ -17,6 +17,7 @@ describe('RepoTabs', () => { ...@@ -17,6 +17,7 @@ describe('RepoTabs', () => {
files: openedFiles, files: openedFiles,
viewer: 'editor', viewer: 'editor',
hasChanges: false, hasChanges: false,
hasMergeRequest: false,
}); });
openedFiles[0].active = true; openedFiles[0].active = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment