Commit fd3ef2eb authored by Phil Hughes's avatar Phil Hughes

karma fixes

parent 3c62b51c
...@@ -109,7 +109,7 @@ export const setPageTitle = title => { ...@@ -109,7 +109,7 @@ export const setPageTitle = title => {
}; };
export const commitActionForFile = file => { export const commitActionForFile = file => {
if (file.prevPath !== '') { if (file.prevPath) {
return 'move'; return 'move';
} else if (file.deleted) { } else if (file.deleted) {
return 'delete'; return 'delete';
......
--- ---
title: Enable renaming files and folders in Web IDE title: Enable renaming files and folders in Web IDE
merge_request: merge_request: 20835
author: author:
type: added type: added
...@@ -73,7 +73,7 @@ describe('new dropdown component', () => { ...@@ -73,7 +73,7 @@ describe('new dropdown component', () => {
it('calls delete action', () => { it('calls delete action', () => {
spyOn(vm, 'deleteEntry'); spyOn(vm, 'deleteEntry');
vm.$el.querySelectorAll('.dropdown-menu button')[3].click(); vm.$el.querySelectorAll('.dropdown-menu button')[4].click();
expect(vm.deleteEntry).toHaveBeenCalledWith(''); expect(vm.deleteEntry).toHaveBeenCalledWith('');
}); });
......
...@@ -45,7 +45,7 @@ describe('new file modal component', () => { ...@@ -45,7 +45,7 @@ describe('new file modal component', () => {
it('$emits create', () => { it('$emits create', () => {
spyOn(vm, 'createTempEntry'); spyOn(vm, 'createTempEntry');
vm.createEntryInStore(); vm.submitForm();
expect(vm.createTempEntry).toHaveBeenCalledWith({ expect(vm.createTempEntry).toHaveBeenCalledWith({
name: 'testing', name: 'testing',
......
...@@ -297,6 +297,7 @@ describe('IDE commit module actions', () => { ...@@ -297,6 +297,7 @@ describe('IDE commit module actions', () => {
content: jasmine.anything(), content: jasmine.anything(),
encoding: jasmine.anything(), encoding: jasmine.anything(),
last_commit_id: undefined, last_commit_id: undefined,
previous_path: undefined,
}, },
], ],
start_branch: 'master', start_branch: 'master',
...@@ -323,6 +324,7 @@ describe('IDE commit module actions', () => { ...@@ -323,6 +324,7 @@ describe('IDE commit module actions', () => {
content: jasmine.anything(), content: jasmine.anything(),
encoding: jasmine.anything(), encoding: jasmine.anything(),
last_commit_id: '123456789', last_commit_id: '123456789',
previous_path: undefined,
}, },
], ],
start_branch: undefined, start_branch: undefined,
......
...@@ -112,6 +112,7 @@ describe('Multi-file store utils', () => { ...@@ -112,6 +112,7 @@ describe('Multi-file store utils', () => {
content: 'updated file content', content: 'updated file content',
encoding: 'text', encoding: 'text',
last_commit_id: '123456789', last_commit_id: '123456789',
previous_path: undefined,
}, },
{ {
action: 'create', action: 'create',
...@@ -119,6 +120,7 @@ describe('Multi-file store utils', () => { ...@@ -119,6 +120,7 @@ describe('Multi-file store utils', () => {
content: 'new file content', content: 'new file content',
encoding: 'base64', encoding: 'base64',
last_commit_id: '123456789', last_commit_id: '123456789',
previous_path: undefined,
}, },
{ {
action: 'delete', action: 'delete',
...@@ -126,6 +128,7 @@ describe('Multi-file store utils', () => { ...@@ -126,6 +128,7 @@ describe('Multi-file store utils', () => {
content: '', content: '',
encoding: 'text', encoding: 'text',
last_commit_id: undefined, last_commit_id: undefined,
previous_path: undefined,
}, },
], ],
start_branch: undefined, start_branch: undefined,
...@@ -172,6 +175,7 @@ describe('Multi-file store utils', () => { ...@@ -172,6 +175,7 @@ describe('Multi-file store utils', () => {
content: 'updated file content', content: 'updated file content',
encoding: 'text', encoding: 'text',
last_commit_id: '123456789', last_commit_id: '123456789',
previous_path: undefined,
}, },
{ {
action: 'create', action: 'create',
...@@ -179,6 +183,7 @@ describe('Multi-file store utils', () => { ...@@ -179,6 +183,7 @@ describe('Multi-file store utils', () => {
content: 'new file content', content: 'new file content',
encoding: 'base64', encoding: 'base64',
last_commit_id: '123456789', last_commit_id: '123456789',
previous_path: undefined,
}, },
], ],
start_branch: undefined, start_branch: undefined,
...@@ -195,6 +200,10 @@ describe('Multi-file store utils', () => { ...@@ -195,6 +200,10 @@ describe('Multi-file store utils', () => {
expect(utils.commitActionForFile({ tempFile: true })).toBe('create'); expect(utils.commitActionForFile({ tempFile: true })).toBe('create');
}); });
it('returns move for moved file', () => {
expect(utils.commitActionForFile({ prevPath: 'test' })).toBe('move');
});
it('returns update by default', () => { it('returns update by default', () => {
expect(utils.commitActionForFile({})).toBe('update'); expect(utils.commitActionForFile({})).toBe('update');
}); });
......
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