Merge branch 'refactor/showStagedIcon' into 'master'

Refactor showStagedIcon property's behavior to match its name

Closes #66071

See merge request gitlab-org/gitlab-ce!32333
This commit is contained in:
Paul Slaughter 2019-09-01 02:58:31 +00:00
commit bfed409d37
4 changed files with 10 additions and 7 deletions

View file

@ -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"

View file

@ -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}`;
},

View file

@ -0,0 +1,5 @@
---
title: Refactor showStagedIcon property to reflect the behavior its name represents.
merge_request: 32333
author: Arun Kumar Mohan
type: other

View file

@ -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(),