diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/frontend/feature_flags | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/frontend/feature_flags')
3 files changed, 23 insertions, 12 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 84e71ffd204..27ec6a7280f 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 @@ -32,8 +32,9 @@ describe('Configure Feature Flags Modal', () => { }); }; - const findGlModal = () => wrapper.find(GlModal); + const findGlModal = () => wrapper.findComponent(GlModal); const findPrimaryAction = () => findGlModal().props('actionPrimary'); + const findSecondaryAction = () => findGlModal().props('actionSecondary'); const findProjectNameInput = () => wrapper.find('#project_name_verification'); const findDangerGlAlert = () => wrapper.findAll(GlAlert).filter((c) => c.props('variant') === 'danger'); @@ -42,18 +43,18 @@ describe('Configure Feature Flags Modal', () => { afterEach(() => wrapper.destroy()); beforeEach(factory); - it('should have Primary and Cancel actions', () => { - expect(findGlModal().props('actionCancel').text).toBe('Close'); - expect(findPrimaryAction().text).toBe('Regenerate instance ID'); + it('should have Primary and Secondary actions', () => { + expect(findPrimaryAction().text).toBe('Close'); + expect(findSecondaryAction().text).toBe('Regenerate instance ID'); }); - it('should default disable the primary action', async () => { - const [{ disabled }] = findPrimaryAction().attributes; + it('should default disable the primary action', () => { + const [{ disabled }] = findSecondaryAction().attributes; expect(disabled).toBe(true); }); it('should emit a `token` event when clicking on the Primary action', async () => { - findGlModal().vm.$emit('primary', mockEvent); + findGlModal().vm.$emit('secondary', mockEvent); await wrapper.vm.$nextTick(); expect(wrapper.emitted('token')).toEqual([[]]); expect(mockEvent.preventDefault).toHaveBeenCalled(); @@ -112,10 +113,10 @@ describe('Configure Feature Flags Modal', () => { afterEach(() => wrapper.destroy()); beforeEach(factory); - it('should enable the primary action', async () => { + it('should enable the secondary action', async () => { findProjectNameInput().vm.$emit('input', provide.projectName); await wrapper.vm.$nextTick(); - const [{ disabled }] = findPrimaryAction().attributes; + const [{ disabled }] = findSecondaryAction().attributes; expect(disabled).toBe(false); }); }); @@ -124,8 +125,8 @@ describe('Configure Feature Flags Modal', () => { afterEach(() => wrapper.destroy()); beforeEach(factory.bind(null, { canUserRotateToken: false })); - it('should not display the primary action', async () => { - expect(findPrimaryAction()).toBe(null); + it('should not display the primary action', () => { + expect(findSecondaryAction()).toBe(null); }); it('should not display regenerating instance ID', 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 e2717b98ea9..2fd8e524e7a 100644 --- a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js @@ -150,5 +150,12 @@ describe('Edit feature flag form', () => { label: 'feature_flag_toggle', }); }); + + it('should render the toggle with a visually hidden label', () => { + expect(wrapper.find(GlToggle).props()).toMatchObject({ + label: 'Feature flag status', + labelPosition: 'hidden', + }); + }); }); }); diff --git a/spec/frontend/feature_flags/components/feature_flags_table_spec.js b/spec/frontend/feature_flags/components/feature_flags_table_spec.js index 8f4d39d4a11..816bc9b9707 100644 --- a/spec/frontend/feature_flags/components/feature_flags_table_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_table_spec.js @@ -129,7 +129,10 @@ describe('Feature flag table', () => { it('should have a toggle', () => { expect(toggle.exists()).toBe(true); - expect(toggle.props('value')).toBe(true); + expect(toggle.props()).toMatchObject({ + label: FeatureFlagsTable.i18n.toggleLabel, + value: true, + }); }); it('should trigger a toggle event', () => { |