Commit 9575288f authored by Arun Kumar Mohan's avatar Arun Kumar Mohan

Refactor showStagedIcon property's behavior to match its name

Previously, the `showStagedIcon` property was doing the opposite
of what its name suggested. It was rendering the staged icon when
`showStagedIcon` was `false` and rendering the regular icon when
it was `true`.
parent c0ff1182
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
v-else-if="showChangedFileIcon" v-else-if="showChangedFileIcon"
:file="file" :file="file"
:show-tooltip="true" :show-tooltip="true"
:show-staged-icon="true" :show-staged-icon="false"
/> />
<new-dropdown <new-dropdown
:type="file.type" :type="file.type"
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
showStagedIcon: { showStagedIcon: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false, default: true,
}, },
size: { size: {
type: Number, type: Number,
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
changedIcon() { changedIcon() {
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26 // False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26
// eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
const suffix = !this.file.changed && this.file.staged && !this.showStagedIcon ? '-solid' : ''; const suffix = !this.file.changed && this.file.staged && this.showStagedIcon ? '-solid' : '';
return `${getCommitIconMap(this.file).icon}${suffix}`; return `${getCommitIconMap(this.file).icon}${suffix}`;
}, },
......
---
title: Refactor showStagedIcon property to reflect the behavior its name represents.
merge_request: 32333
author: Arun Kumar Mohan
type: other
...@@ -106,12 +106,10 @@ describe('Changed file icon', () => { ...@@ -106,12 +106,10 @@ describe('Changed file icon', () => {
expect(findIcon().props('size')).toBe(size); expect(findIcon().props('size')).toBe(size);
}); });
// NOTE: It looks like 'showStagedIcon' behavior is backwards to what the name suggests
// https://gitlab.com/gitlab-org/gitlab-ce/issues/66071
it.each` it.each`
showStagedIcon | iconName | desc showStagedIcon | iconName | desc
${false} | ${'file-modified-solid'} | ${'with showStagedIcon false, renders staged icon'} ${true} | ${'file-modified-solid'} | ${'with showStagedIcon true, renders staged icon'}
${true} | ${'file-modified'} | ${'with showStagedIcon true, renders regular icon'} ${false} | ${'file-modified'} | ${'with showStagedIcon false, renders regular icon'}
`('$desc', ({ showStagedIcon, iconName }) => { `('$desc', ({ showStagedIcon, iconName }) => {
factory({ factory({
file: stagedFile(), file: stagedFile(),
......
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