karma fixes
This commit is contained in:
parent
9badf9e723
commit
feae897552
|
@ -124,25 +124,25 @@ export const scrollToTab = () => {
|
|||
};
|
||||
|
||||
export const stageAllChanges = ({ state, commit, dispatch }) => {
|
||||
const activeFile = state.openFiles[0];
|
||||
const openFile = state.openFiles[0];
|
||||
|
||||
commit(types.SET_LAST_COMMIT_MSG, '');
|
||||
|
||||
state.changedFiles.forEach(file => commit(types.STAGE_CHANGE, file.path));
|
||||
|
||||
dispatch('openPendingTab', {
|
||||
file: state.stagedFiles.find(f => f.path === activeFile.path),
|
||||
file: state.stagedFiles.find(f => f.path === openFile.path),
|
||||
keyPrefix: stageKeys.staged,
|
||||
});
|
||||
};
|
||||
|
||||
export const unstageAllChanges = ({ state, commit, dispatch }) => {
|
||||
const activeFile = state.openFiles[0];
|
||||
const openFile = state.openFiles[0];
|
||||
|
||||
state.stagedFiles.forEach(file => commit(types.UNSTAGE_CHANGE, file.path));
|
||||
|
||||
dispatch('openPendingTab', {
|
||||
file: state.changedFiles.find(f => f.path === activeFile.path),
|
||||
file: state.changedFiles.find(f => f.path === openFile.path),
|
||||
keyPrefix: stageKeys.unstaged,
|
||||
});
|
||||
};
|
||||
|
|
|
@ -305,7 +305,11 @@ describe('Multi-file store actions', () => {
|
|||
|
||||
describe('stageAllChanges', () => {
|
||||
it('adds all files from changedFiles to stagedFiles', done => {
|
||||
store.state.changedFiles.push(file(), file('new'));
|
||||
const openFile = { ...file(), path: 'test' };
|
||||
|
||||
store.state.openFiles.push(openFile);
|
||||
store.state.stagedFiles.push(openFile);
|
||||
store.state.changedFiles.push(openFile, file('new'));
|
||||
|
||||
testAction(
|
||||
stageAllChanges,
|
||||
|
@ -316,7 +320,12 @@ describe('Multi-file store actions', () => {
|
|||
{ type: types.STAGE_CHANGE, payload: store.state.changedFiles[0].path },
|
||||
{ type: types.STAGE_CHANGE, payload: store.state.changedFiles[1].path },
|
||||
],
|
||||
[],
|
||||
[
|
||||
{
|
||||
type: 'openPendingTab',
|
||||
payload: { file: openFile, keyPrefix: 'staged' },
|
||||
},
|
||||
],
|
||||
done,
|
||||
);
|
||||
});
|
||||
|
@ -324,7 +333,11 @@ describe('Multi-file store actions', () => {
|
|||
|
||||
describe('unstageAllChanges', () => {
|
||||
it('removes all files from stagedFiles after unstaging', done => {
|
||||
store.state.stagedFiles.push(file(), file('new'));
|
||||
const openFile = { ...file(), path: 'test' };
|
||||
|
||||
store.state.openFiles.push(openFile);
|
||||
store.state.changedFiles.push(openFile);
|
||||
store.state.stagedFiles.push(openFile, file('new'));
|
||||
|
||||
testAction(
|
||||
unstageAllChanges,
|
||||
|
@ -334,7 +347,12 @@ describe('Multi-file store actions', () => {
|
|||
{ type: types.UNSTAGE_CHANGE, payload: store.state.stagedFiles[0].path },
|
||||
{ type: types.UNSTAGE_CHANGE, payload: store.state.stagedFiles[1].path },
|
||||
],
|
||||
[],
|
||||
[
|
||||
{
|
||||
type: 'openPendingTab',
|
||||
payload: { file: openFile, keyPrefix: 'unstaged' },
|
||||
},
|
||||
],
|
||||
done,
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue