diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 21:06:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 21:06:05 +0300 |
commit | 2ed368929ab5094fec5da8038f723463596a80cf (patch) | |
tree | aec98d50349b0e9a490db0099253b801b2d1a9ea /spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js | |
parent | f1a5755898e865428c923587402fd965b601c4ea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js b/spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js new file mode 100644 index 00000000000..6ecc330b5af --- /dev/null +++ b/spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js @@ -0,0 +1,42 @@ +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import GlFeatureFlags from '~/vue_shared/gl_feature_flags_plugin'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; + +const localVue = createLocalVue(); + +describe('GitLab Feature Flags Plugin', () => { + beforeEach(() => { + window.gon = { + features: { + aFeature: true, + bFeature: false, + }, + }; + + localVue.use(GlFeatureFlags); + }); + + it('should provide glFeatures to components', () => { + const component = { + template: `<span></span>`, + inject: ['glFeatures'], + }; + const wrapper = shallowMount(component, { localVue }); + expect(wrapper.vm.glFeatures).toEqual({ + aFeature: true, + bFeature: false, + }); + }); + + it('should integrate with the glFeatureMixin', () => { + const component = { + template: `<span></span>`, + mixins: [glFeatureFlagsMixin()], + }; + const wrapper = shallowMount(component, { localVue }); + expect(wrapper.vm.glFeatures).toEqual({ + aFeature: true, + bFeature: false, + }); + }); +}); |