Commit b685ac52 authored by Samantha Ming's avatar Samantha Ming

Address reviewer comment

Switch to use FeatureFlag mixin
parent 6835cfd8
......@@ -2,6 +2,7 @@
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
import WebIdeLink from '~/vue_shared/components/web_ide_link.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
i18n: {
......@@ -12,6 +13,7 @@ export default {
GlButton,
WebIdeLink,
},
mixins: [glFeatureFlagsMixin()],
props: {
editPath: {
type: String,
......@@ -22,17 +24,12 @@ export default {
required: true,
},
},
computed: {
isFeatureEnabled() {
return Boolean(gon.features?.consolidatedEditButton);
},
},
};
</script>
<template>
<web-ide-link
v-if="isFeatureEnabled"
v-if="glFeatures.consolidatedEditButton"
class="gl-mr-3"
:edit-url="editPath"
:web-ide-url="webIdePath"
......
......@@ -11,12 +11,17 @@ const DEFAULT_PROPS = {
describe('BlobHeaderEdit component', () => {
let wrapper;
const createComponent = (props = {}) => {
const createComponent = (consolidatedEditButton = false, props = {}) => {
wrapper = shallowMount(BlobHeaderEdit, {
propsData: {
...DEFAULT_PROPS,
...props,
},
provide: {
glFeatures: {
consolidatedEditButton,
},
},
});
};
......@@ -64,11 +69,7 @@ describe('BlobHeaderEdit component', () => {
});
it('renders WebIdeLink component', () => {
window.gon.features = {
consolidatedEditButton: true,
};
createComponent();
createComponent(true);
const { editPath: editUrl, webIdePath: webIdeUrl } = DEFAULT_PROPS;
......
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