Commit f26e5def authored by Miranda Fluharty's avatar Miranda Fluharty Committed by Phil Hughes

Hide code quality annotation space when feature flag is disabled

parent af493f8b
...@@ -3,6 +3,7 @@ import { mapGetters, mapState, mapActions } from 'vuex'; ...@@ -3,6 +3,7 @@ import { mapGetters, mapState, mapActions } from 'vuex';
import DraftNote from '~/batch_comments/components/draft_note.vue'; import DraftNote from '~/batch_comments/components/draft_note.vue';
import draftCommentsMixin from '~/diffs/mixins/draft_comments'; import draftCommentsMixin from '~/diffs/mixins/draft_comments';
import { getCommentedLines } from '~/notes/components/multiline_comment_utils'; import { getCommentedLines } from '~/notes/components/multiline_comment_utils';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import DiffCommentCell from './diff_comment_cell.vue'; import DiffCommentCell from './diff_comment_cell.vue';
import DiffExpansionCell from './diff_expansion_cell.vue'; import DiffExpansionCell from './diff_expansion_cell.vue';
import DiffRow from './diff_row.vue'; import DiffRow from './diff_row.vue';
...@@ -14,7 +15,7 @@ export default { ...@@ -14,7 +15,7 @@ export default {
DiffCommentCell, DiffCommentCell,
DraftNote, DraftNote,
}, },
mixins: [draftCommentsMixin], mixins: [draftCommentsMixin, glFeatureFlagsMixin()],
props: { props: {
diffFile: { diffFile: {
type: Object, type: Object,
...@@ -58,7 +59,10 @@ export default { ...@@ -58,7 +59,10 @@ export default {
); );
}, },
hasCodequalityChanges() { hasCodequalityChanges() {
return this.codequalityDiff?.files?.[this.diffFile.file_path]?.length > 0; return (
this.glFeatures.codequalityMrDiffAnnotations &&
this.codequalityDiff?.files?.[this.diffFile.file_path]?.length > 0
);
}, },
}, },
methods: { methods: {
......
...@@ -8,7 +8,7 @@ import createDiffsStore from '~/diffs/store/modules'; ...@@ -8,7 +8,7 @@ import createDiffsStore from '~/diffs/store/modules';
const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable)); const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable));
function createComponent({ withCodequality = true }) { function createComponent({ withCodequality = true, provide = {} }) {
const diffFile = getReadableFile(); const diffFile = getReadableFile();
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -44,6 +44,7 @@ function createComponent({ withCodequality = true }) { ...@@ -44,6 +44,7 @@ function createComponent({ withCodequality = true }) {
diffFile, diffFile,
diffLines: [], diffLines: [],
}, },
provide,
}); });
return { return {
...@@ -60,9 +61,12 @@ describe('EE DiffView', () => { ...@@ -60,9 +61,12 @@ describe('EE DiffView', () => {
wrapper.destroy(); wrapper.destroy();
}); });
describe('when there is diff data for the file', () => { describe('when there is diff data for the file and the feature flag is enabled', () => {
beforeEach(() => { beforeEach(() => {
({ wrapper } = createComponent({ withCodequality: true })); ({ wrapper } = createComponent({
withCodequality: true,
provide: { glFeatures: { codequalityMrDiffAnnotations: true } },
}));
}); });
it('has the with-codequality class', () => { it('has the with-codequality class', () => {
...@@ -70,6 +74,19 @@ describe('EE DiffView', () => { ...@@ -70,6 +74,19 @@ describe('EE DiffView', () => {
}); });
}); });
describe('when there is diff data for the file and the feature flag is disabled', () => {
beforeEach(() => {
({ wrapper } = createComponent({
withCodequality: true,
provide: { glFeatures: { codequalityMrDiffAnnotations: false } },
}));
});
it('does not have the with-codequality class', () => {
expect(wrapper.classes('with-codequality')).toBe(false);
});
});
describe('when there is no diff data for the file', () => { describe('when there is no diff data for the file', () => {
beforeEach(() => { beforeEach(() => {
({ wrapper } = createComponent({ withCodequality: false })); ({ wrapper } = createComponent({ withCodequality: false }));
......
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