Commit b685ac52 authored by Samantha Ming's avatar Samantha Ming

Address reviewer comment

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