summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Kumar Mohan <arunmohandm@gmail.com>2019-08-28 05:20:30 -0500
committerArun Kumar Mohan <arunmohandm@gmail.com>2019-08-30 17:08:16 -0500
commit9575288f6259e37726c61451478b9c7d5a73b843 (patch)
treedf4183f84bcafb9b1353865ceaeae0cf5a9ce845
parentc0ff11820228acbc27369e99db9bbf9a80a8405b (diff)
downloadgitlab-ce-9575288f6259e37726c61451478b9c7d5a73b843.tar.gz
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`.
-rw-r--r--app/assets/javascripts/ide/components/file_row_extra.vue2
-rw-r--r--app/assets/javascripts/vue_shared/components/changed_file_icon.vue4
-rw-r--r--changelogs/unreleased/refactor-showStagedIcon.yml5
-rw-r--r--spec/frontend/vue_shared/components/changed_file_icon_spec.js6
4 files changed, 10 insertions, 7 deletions
diff --git a/app/assets/javascripts/ide/components/file_row_extra.vue b/app/assets/javascripts/ide/components/file_row_extra.vue
index 7254c50a568..48be97c8952 100644
--- a/app/assets/javascripts/ide/components/file_row_extra.vue
+++ b/app/assets/javascripts/ide/components/file_row_extra.vue
@@ -86,7 +86,7 @@ export default {
v-else-if="showChangedFileIcon"
:file="file"
:show-tooltip="true"
- :show-staged-icon="true"
+ :show-staged-icon="false"
/>
<new-dropdown
:type="file.type"
diff --git a/app/assets/javascripts/vue_shared/components/changed_file_icon.vue b/app/assets/javascripts/vue_shared/components/changed_file_icon.vue
index beb2ac09992..a97538d813a 100644
--- a/app/assets/javascripts/vue_shared/components/changed_file_icon.vue
+++ b/app/assets/javascripts/vue_shared/components/changed_file_icon.vue
@@ -24,7 +24,7 @@ export default {
showStagedIcon: {
type: Boolean,
required: false,
- default: false,
+ default: true,
},
size: {
type: Number,
@@ -41,7 +41,7 @@ export default {
changedIcon() {
// 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
- 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}`;
},
diff --git a/changelogs/unreleased/refactor-showStagedIcon.yml b/changelogs/unreleased/refactor-showStagedIcon.yml
new file mode 100644
index 00000000000..94c58c4dc45
--- /dev/null
+++ b/changelogs/unreleased/refactor-showStagedIcon.yml
@@ -0,0 +1,5 @@
+---
+title: Refactor showStagedIcon property to reflect the behavior its name represents.
+merge_request: 32333
+author: Arun Kumar Mohan
+type: other
diff --git a/spec/frontend/vue_shared/components/changed_file_icon_spec.js b/spec/frontend/vue_shared/components/changed_file_icon_spec.js
index 806602877ef..d0586f9e63f 100644
--- a/spec/frontend/vue_shared/components/changed_file_icon_spec.js
+++ b/spec/frontend/vue_shared/components/changed_file_icon_spec.js
@@ -106,12 +106,10 @@ describe('Changed file icon', () => {
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`
showStagedIcon | iconName | desc
- ${false} | ${'file-modified-solid'} | ${'with showStagedIcon false, renders staged icon'}
- ${true} | ${'file-modified'} | ${'with showStagedIcon true, renders regular icon'}
+ ${true} | ${'file-modified-solid'} | ${'with showStagedIcon true, renders staged icon'}
+ ${false} | ${'file-modified'} | ${'with showStagedIcon false, renders regular icon'}
`('$desc', ({ showStagedIcon, iconName }) => {
factory({
file: stagedFile(),