diff options
Diffstat (limited to 'spec/frontend/feature_flags/components/edit_feature_flag_spec.js')
-rw-r--r-- | spec/frontend/feature_flags/components/edit_feature_flag_spec.js | 19 |
1 files changed, 11 insertions, 8 deletions
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 a754c682356..e2717b98ea9 100644 --- a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js @@ -1,13 +1,13 @@ -import Vuex from 'vuex'; +import { GlToggle, GlAlert } from '@gitlab/ui'; import { createLocalVue, shallowMount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import { GlToggle, GlAlert } from '@gitlab/ui'; -import { TEST_HOST } from 'spec/test_constants'; +import Vuex from 'vuex'; import { mockTracking } from 'helpers/tracking_helper'; -import { LEGACY_FLAG, NEW_VERSION_FLAG } from '~/feature_flags/constants'; +import { TEST_HOST } from 'spec/test_constants'; +import EditFeatureFlag from '~/feature_flags/components/edit_feature_flag.vue'; import Form from '~/feature_flags/components/form.vue'; +import { LEGACY_FLAG, NEW_VERSION_FLAG } from '~/feature_flags/constants'; import createStore from '~/feature_flags/store/edit'; -import EditFeatureFlag from '~/feature_flags/components/edit_feature_flag.vue'; import axios from '~/lib/utils/axios_utils'; const localVue = createLocalVue(); @@ -75,6 +75,8 @@ describe('Edit feature flag form', () => { }); const findAlert = () => wrapper.find(GlAlert); + const findWarningGlAlert = () => + wrapper.findAll(GlAlert).filter((c) => c.props('variant') === 'warning'); it('should display the iid', () => { expect(wrapper.find('h3').text()).toContain('^5'); @@ -88,7 +90,7 @@ describe('Edit feature flag form', () => { expect(wrapper.find(GlToggle).props('value')).toBe(true); }); - it('should not alert users that feature flags are changing soon', () => { + it('should alert users the flag is read only', () => { expect(findAlert().text()).toContain('GitLab is moving to a new way of managing feature flags'); }); @@ -96,8 +98,9 @@ describe('Edit feature flag form', () => { it('should render the error', () => { store.dispatch('receiveUpdateFeatureFlagError', { message: ['The name is required'] }); return wrapper.vm.$nextTick(() => { - expect(wrapper.find('.alert-danger').exists()).toEqual(true); - expect(wrapper.find('.alert-danger').text()).toContain('The name is required'); + const warningGlAlert = findWarningGlAlert(); + expect(warningGlAlert.at(1).exists()).toEqual(true); + expect(warningGlAlert.at(1).text()).toContain('The name is required'); }); }); }); |