diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-01 15:10:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-01 15:10:18 +0300 |
commit | 3a5bee787984a139396c64372b6e14c4cb26efc1 (patch) | |
tree | 495ae8868be3aa62c7446bd81c398ee7e098cc64 /spec/frontend/integrations | |
parent | 58c42f2f454c5223062b08a47c5add4e52ad677f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/integrations')
-rw-r--r-- | spec/frontend/integrations/edit/components/trigger_fields_spec.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/frontend/integrations/edit/components/trigger_fields_spec.js b/spec/frontend/integrations/edit/components/trigger_fields_spec.js index c329ca8522f..082eeea30f1 100644 --- a/spec/frontend/integrations/edit/components/trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/trigger_fields_spec.js @@ -1,5 +1,6 @@ import { GlFormGroup, GlFormCheckbox, GlFormInput } from '@gitlab/ui'; import { mountExtended } from 'helpers/vue_test_utils_helper'; +import { placeholderForType } from 'jh_else_ce/integrations/constants'; import TriggerFields from '~/integrations/edit/components/trigger_fields.vue'; @@ -28,6 +29,50 @@ describe('TriggerFields', () => { const findAllGlFormCheckboxes = () => wrapper.findAllComponents(GlFormCheckbox); const findAllGlFormInputs = () => wrapper.findAllComponents(GlFormInput); + describe('placeholder text on the event fields and default values', () => { + const dummyFieldPlaceholder = '#foo'; + const integrationTypes = { + INTEGRATION_TYPE_SLACK: 'slack', + INTEGRATION_TYPE_SLACK_APPLICATION: 'gitlab_slack_application', + INTEGRATION_TYPE_MATTERMOST: 'mattermost', + INTEGRATION_TYPE_NON_EXISTING: 'non_existing', + }; + it.each` + integrationType | fieldPlaceholder | expectedPlaceholder + ${integrationTypes.INTEGRATION_TYPE_SLACK} | ${undefined} | ${placeholderForType[integrationTypes.INTEGRATION_TYPE_SLACK]} + ${integrationTypes.INTEGRATION_TYPE_SLACK} | ${''} | ${placeholderForType[integrationTypes.INTEGRATION_TYPE_SLACK]} + ${integrationTypes.INTEGRATION_TYPE_SLACK} | ${dummyFieldPlaceholder} | ${dummyFieldPlaceholder} + ${integrationTypes.INTEGRATION_TYPE_SLACK_APPLICATION} | ${undefined} | ${placeholderForType[integrationTypes.INTEGRATION_TYPE_SLACK_APPLICATION]} + ${integrationTypes.INTEGRATION_TYPE_SLACK_APPLICATION} | ${''} | ${placeholderForType[integrationTypes.INTEGRATION_TYPE_SLACK_APPLICATION]} + ${integrationTypes.INTEGRATION_TYPE_SLACK_APPLICATION} | ${dummyFieldPlaceholder} | ${dummyFieldPlaceholder} + ${integrationTypes.INTEGRATION_TYPE_MATTERMOST} | ${undefined} | ${placeholderForType[integrationTypes.INTEGRATION_TYPE_MATTERMOST]} + ${integrationTypes.INTEGRATION_TYPE_MATTERMOST} | ${''} | ${placeholderForType[integrationTypes.INTEGRATION_TYPE_MATTERMOST]} + ${integrationTypes.INTEGRATION_TYPE_MATTERMOST} | ${dummyFieldPlaceholder} | ${dummyFieldPlaceholder} + ${integrationTypes.INTEGRATION_TYPE_NON_EXISTING} | ${undefined} | ${undefined} + ${integrationTypes.INTEGRATION_TYPE_NON_EXISTING} | ${''} | ${undefined} + ${integrationTypes.INTEGRATION_TYPE_NON_EXISTING} | ${dummyFieldPlaceholder} | ${dummyFieldPlaceholder} + `( + 'passed down correct placeholder for "$integrationType" type and "$fieldPlaceholder" placeholder on the field', + ({ integrationType, fieldPlaceholder, expectedPlaceholder }) => { + createComponent({ + type: integrationType, + events: [ + { + field: { + name: 'foo', + value: '', + placeholder: fieldPlaceholder, + }, + }, + ], + }); + const field = wrapper.findComponent(GlFormInput); + + expect(field.attributes('placeholder')).toBe(expectedPlaceholder); + }, + ); + }); + describe.each([true, false])('template, isInheriting = `%p`', (isInheriting) => { it('renders a label with text "Trigger"', () => { createComponent(); |