diff options
Diffstat (limited to 'spec/frontend/feature_flags/components')
4 files changed, 12 insertions, 89 deletions
diff --git a/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js b/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js index 67f4bee766b..06b9385b112 100644 --- a/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js +++ b/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js @@ -1,7 +1,6 @@ import { shallowMount } from '@vue/test-utils'; -import { GlModal, GlSprintf } from '@gitlab/ui'; +import { GlModal, GlSprintf, GlAlert } from '@gitlab/ui'; import Component from '~/feature_flags/components/configure_feature_flags_modal.vue'; -import Callout from '~/vue_shared/components/callout.vue'; describe('Configure Feature Flags Modal', () => { const mockEvent = { preventDefault: jest.fn() }; @@ -36,8 +35,8 @@ describe('Configure Feature Flags Modal', () => { const findGlModal = () => wrapper.find(GlModal); const findPrimaryAction = () => findGlModal().props('actionPrimary'); const findProjectNameInput = () => wrapper.find('#project_name_verification'); - const findDangerCallout = () => - wrapper.findAll(Callout).filter(c => c.props('category') === 'danger'); + const findDangerGlAlert = () => + wrapper.findAll(GlAlert).filter(c => c.props('variant') === 'danger'); describe('idle', () => { afterEach(() => wrapper.destroy()); @@ -86,10 +85,10 @@ describe('Configure Feature Flags Modal', () => { ); }); - it('should display one and only one danger callout', () => { - const dangerCallout = findDangerCallout(); - expect(dangerCallout.length).toBe(1); - expect(dangerCallout.at(0).props('message')).toMatch(/Regenerating the instance ID/); + it('should display one and only one danger alert', () => { + const dangerGlAlert = findDangerGlAlert(); + expect(dangerGlAlert.length).toBe(1); + expect(dangerGlAlert.at(0).text()).toMatch(/Regenerating the instance ID/); }); it('should display a message asking to fill the project name', () => { @@ -130,7 +129,7 @@ describe('Configure Feature Flags Modal', () => { }); it('should not display regenerating instance ID', async () => { - expect(findDangerCallout().exists()).toBe(false); + expect(findDangerGlAlert().exists()).toBe(false); }); it('should disable the project name input', async () => { diff --git a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js index 6a394251060..f8e25925774 100644 --- a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js @@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter'; import { GlToggle, GlAlert } from '@gitlab/ui'; import { TEST_HOST } from 'spec/test_constants'; import { mockTracking } from 'helpers/tracking_helper'; -import { LEGACY_FLAG, NEW_VERSION_FLAG, NEW_FLAG_ALERT } from '~/feature_flags/constants'; +import { LEGACY_FLAG, NEW_VERSION_FLAG } from '~/feature_flags/constants'; import Form from '~/feature_flags/components/form.vue'; import createStore from '~/feature_flags/store/edit'; import EditFeatureFlag from '~/feature_flags/components/edit_feature_flag.vue'; @@ -37,9 +37,6 @@ describe('Edit feature flag form', () => { showUserCallout: true, userCalloutId, userCalloutsPath, - glFeatures: { - featureFlagsNewVersion: true, - }, ...opts, }, }); @@ -151,33 +148,4 @@ describe('Edit feature flag form', () => { }); }); }); - - describe('without new version flags', () => { - beforeEach(() => factory({ glFeatures: { featureFlagsNewVersion: false } })); - - it('should alert users that feature flags are changing soon', () => { - expect(findAlert().text()).toBe(NEW_FLAG_ALERT); - }); - }); - - describe('dismissing new version alert', () => { - beforeEach(() => { - factory({ glFeatures: { featureFlagsNewVersion: false } }); - mock.onPost(userCalloutsPath, { feature_name: userCalloutId }).reply(200); - findAlert().vm.$emit('dismiss'); - return wrapper.vm.$nextTick(); - }); - - afterEach(() => { - mock.restore(); - }); - - it('should hide the alert', () => { - expect(findAlert().exists()).toBe(false); - }); - - it('should send the dismissal event', () => { - expect(mock.history.post.length).toBe(1); - }); - }); }); diff --git a/spec/frontend/feature_flags/components/feature_flags_tab_spec.js b/spec/frontend/feature_flags/components/feature_flags_tab_spec.js index bc90c5ceb2d..23cc7045d1f 100644 --- a/spec/frontend/feature_flags/components/feature_flags_tab_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_tab_spec.js @@ -12,6 +12,7 @@ const DEFAULT_PROPS = { errorTitle: 'test title', emptyState: true, emptyTitle: 'test empty', + emptyDescription: 'empty description', }; const DEFAULT_PROVIDE = { @@ -115,9 +116,7 @@ describe('feature_flags/components/feature_flags_tab.vue', () => { it('should show an empty state if it is empty', () => { expect(emptyState.text()).toContain(DEFAULT_PROPS.emptyTitle); - expect(emptyState.text()).toContain( - 'Feature flags allow you to configure your code into different flavors by dynamically toggling certain functionality.', - ); + expect(emptyState.text()).toContain(DEFAULT_PROPS.emptyDescription); expect(emptyState.props('svgPath')).toBe(DEFAULT_PROVIDE.errorStateSvgPath); expect(emptyStateLink.attributes('href')).toBe(DEFAULT_PROVIDE.featureFlagsHelpPagePath); expect(emptyStateLink.text()).toBe('More information'); diff --git a/spec/frontend/feature_flags/components/new_feature_flag_spec.js b/spec/frontend/feature_flags/components/new_feature_flag_spec.js index dbc6e03d922..e317ac4b092 100644 --- a/spec/frontend/feature_flags/components/new_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/new_feature_flag_spec.js @@ -1,17 +1,11 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; -import MockAdapter from 'axios-mock-adapter'; import { GlAlert } from '@gitlab/ui'; import { TEST_HOST } from 'spec/test_constants'; import Form from '~/feature_flags/components/form.vue'; import createStore from '~/feature_flags/store/new'; import NewFeatureFlag from '~/feature_flags/components/new_feature_flag.vue'; -import { - ROLLOUT_STRATEGY_ALL_USERS, - DEFAULT_PERCENT_ROLLOUT, - NEW_FLAG_ALERT, -} from '~/feature_flags/constants'; -import axios from '~/lib/utils/axios_utils'; +import { ROLLOUT_STRATEGY_ALL_USERS, DEFAULT_PERCENT_ROLLOUT } from '~/feature_flags/constants'; import { allUsersStrategy } from '../mock_data'; const userCalloutId = 'feature_flags_new_version'; @@ -42,9 +36,6 @@ describe('New feature flag form', () => { userCalloutsPath, environmentsEndpoint: 'environments.json', projectId: '8', - glFeatures: { - featureFlagsNewVersion: true, - }, ...opts, }, }); @@ -58,8 +49,6 @@ describe('New feature flag form', () => { wrapper.destroy(); }); - const findAlert = () => wrapper.find(GlAlert); - describe('with error', () => { it('should render the error', () => { store.dispatch('receiveCreateFeatureFlagError', { message: ['The name is required'] }); @@ -101,36 +90,4 @@ describe('New feature flag form', () => { expect(strategies).toEqual([allUsersStrategy]); }); - - describe('without new version flags', () => { - beforeEach(() => factory({ glFeatures: { featureFlagsNewVersion: false } })); - - it('should alert users that feature flags are changing soon', () => { - expect(findAlert().text()).toBe(NEW_FLAG_ALERT); - }); - }); - - describe('dismissing new version alert', () => { - let mock; - - beforeEach(() => { - mock = new MockAdapter(axios); - mock.onPost(userCalloutsPath, { feature_name: userCalloutId }).reply(200); - factory({ glFeatures: { featureFlagsNewVersion: false } }); - findAlert().vm.$emit('dismiss'); - return wrapper.vm.$nextTick(); - }); - - afterEach(() => { - mock.restore(); - }); - - it('should hide the alert', () => { - expect(findAlert().exists()).toBe(false); - }); - - it('should send the dismissal event', () => { - expect(mock.history.post.length).toBe(1); - }); - }); }); |