From 48aff82709769b098321c738f3444b9bdaa694c6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 21 Oct 2020 07:08:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-5-stable-ee --- .../components/strategies/users_with_id_spec.js | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 spec/frontend/feature_flags/components/strategies/users_with_id_spec.js (limited to 'spec/frontend/feature_flags/components/strategies/users_with_id_spec.js') diff --git a/spec/frontend/feature_flags/components/strategies/users_with_id_spec.js b/spec/frontend/feature_flags/components/strategies/users_with_id_spec.js new file mode 100644 index 00000000000..460df6ef2ec --- /dev/null +++ b/spec/frontend/feature_flags/components/strategies/users_with_id_spec.js @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils'; +import { GlFormTextarea } from '@gitlab/ui'; +import UsersWithId from '~/feature_flags/components/strategies/users_with_id.vue'; +import { usersWithIdStrategy } from '../../mock_data'; + +const DEFAULT_PROPS = { + strategy: usersWithIdStrategy, +}; + +describe('~/feature_flags/components/users_with_id.vue', () => { + let wrapper; + let textarea; + + const factory = (props = {}) => mount(UsersWithId, { propsData: { ...DEFAULT_PROPS, ...props } }); + + beforeEach(() => { + wrapper = factory(); + textarea = wrapper.find(GlFormTextarea); + }); + + afterEach(() => { + if (wrapper?.destroy) { + wrapper.destroy(); + } + + wrapper = null; + }); + + it('should display the current value of the parameters', () => { + expect(textarea.element.value).toBe(usersWithIdStrategy.parameters.userIds); + }); + + it('should emit a change event when the IDs change', () => { + textarea.setValue('4,5,6'); + + expect(wrapper.emitted('change')).toEqual([[{ parameters: { userIds: '4,5,6' } }]]); + }); +}); -- cgit v1.2.1