Merge branch '64784-re-name-regression' into 'master'
Fix regression in re-naming files Closes #64784 See merge request gitlab-org/gitlab-ce!30941
This commit is contained in:
commit
4c30b0a1cf
2 changed files with 45 additions and 4 deletions
|
@ -43,10 +43,14 @@ export default {
|
|||
|
||||
[stateEntry, stagedFile, openFile, changedFile].forEach(f => {
|
||||
if (f) {
|
||||
Object.assign(f, convertObjectPropsToCamelCase(data, { dropKeys: ['raw', 'baseRaw'] }), {
|
||||
raw: (stateEntry && stateEntry.raw) || null,
|
||||
baseRaw: null,
|
||||
});
|
||||
Object.assign(
|
||||
f,
|
||||
convertObjectPropsToCamelCase(data, { dropKeys: ['path', 'name', 'raw', 'baseRaw'] }),
|
||||
{
|
||||
raw: (stateEntry && stateEntry.raw) || null,
|
||||
baseRaw: null,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -103,6 +103,43 @@ describe('IDE store file mutations', () => {
|
|||
expect(localState.openFiles[0].rawPath).toEqual(rawPath);
|
||||
expect(localFile.rawPath).toEqual(rawPath);
|
||||
});
|
||||
|
||||
it('does not mutate certain props on the file', () => {
|
||||
const path = 'New Path';
|
||||
const name = 'New Name';
|
||||
localFile.path = path;
|
||||
localFile.name = name;
|
||||
|
||||
localState.stagedFiles = [localFile];
|
||||
localState.changedFiles = [localFile];
|
||||
localState.openFiles = [localFile];
|
||||
|
||||
mutations.SET_FILE_DATA(localState, {
|
||||
data: {
|
||||
path: 'Old Path',
|
||||
name: 'Old Name',
|
||||
raw: 'Old Raw',
|
||||
base_raw: 'Old Base Raw',
|
||||
},
|
||||
file: localFile,
|
||||
});
|
||||
|
||||
[
|
||||
localState.stagedFiles[0],
|
||||
localState.changedFiles[0],
|
||||
localState.openFiles[0],
|
||||
localFile,
|
||||
].forEach(f => {
|
||||
expect(f).toEqual(
|
||||
jasmine.objectContaining({
|
||||
path,
|
||||
name,
|
||||
raw: null,
|
||||
baseRaw: null,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('SET_FILE_RAW_DATA', () => {
|
||||
|
|
Loading…
Reference in a new issue