diff options
Diffstat (limited to 'spec/frontend')
3 files changed, 50 insertions, 18 deletions
diff --git a/spec/frontend/ci/pipeline_editor/components/validate/ci_validate_spec.js b/spec/frontend/ci/pipeline_editor/components/validate/ci_validate_spec.js index f2818277c59..b66b44e5f06 100644 --- a/spec/frontend/ci/pipeline_editor/components/validate/ci_validate_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/validate/ci_validate_spec.js @@ -1,5 +1,12 @@ import Vue from 'vue'; -import { GlAlert, GlDisclosureDropdown, GlIcon, GlLoadingIcon, GlPopover } from '@gitlab/ui'; +import { + GlAlert, + GlDisclosureDropdown, + GlEmptyState, + GlIcon, + GlLoadingIcon, + GlPopover, +} from '@gitlab/ui'; import VueApollo from 'vue-apollo'; import MockAdapter from 'axios-mock-adapter'; @@ -70,7 +77,7 @@ describe('Pipeline Editor Validate Tab', () => { const findCta = () => wrapper.findByTestId('simulate-pipeline-button'); const findDisabledCtaTooltip = () => wrapper.findByTestId('cta-tooltip'); const findHelpIcon = () => wrapper.findComponent(GlIcon); - const findIllustration = () => wrapper.findByRole('img'); + const findEmptyState = () => wrapper.findComponent(GlEmptyState); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); const findPipelineSource = () => wrapper.findComponent(GlDisclosureDropdown); const findPopover = () => wrapper.findComponent(GlPopover); @@ -283,7 +290,7 @@ describe('Pipeline Editor Validate Tab', () => { it('returns to init state', async () => { // init state - expect(findIllustration().exists()).toBe(true); + expect(findEmptyState().exists()).toBe(true); expect(findCiLintResults().exists()).toBe(false); // mutations should have successful results @@ -294,7 +301,7 @@ describe('Pipeline Editor Validate Tab', () => { await findCancelBtn().vm.$emit('click'); // should still render init state - expect(findIllustration().exists()).toBe(true); + expect(findEmptyState().exists()).toBe(true); expect(findCiLintResults().exists()).toBe(false); }); }); diff --git a/spec/frontend/content_editor/services/markdown_serializer_spec.js b/spec/frontend/content_editor/services/markdown_serializer_spec.js index 4dcbbfee64a..c329a12bcc4 100644 --- a/spec/frontend/content_editor/services/markdown_serializer_spec.js +++ b/spec/frontend/content_editor/services/markdown_serializer_spec.js @@ -152,19 +152,26 @@ describe('markdownSerializer', () => { expect(serialize(paragraph(italic('italics')))).toBe('_italics_'); }); - it('correctly serializes code blocks wrapped by italics and bold marks', () => { - const codeBlockContent = 'code block'; - - expect(serialize(paragraph(italic(code(codeBlockContent))))).toBe(`_\`${codeBlockContent}\`_`); - expect(serialize(paragraph(code(italic(codeBlockContent))))).toBe(`_\`${codeBlockContent}\`_`); - expect(serialize(paragraph(bold(code(codeBlockContent))))).toBe(`**\`${codeBlockContent}\`**`); - expect(serialize(paragraph(code(bold(codeBlockContent))))).toBe(`**\`${codeBlockContent}\`**`); - expect(serialize(paragraph(strike(code(codeBlockContent))))).toBe( - `~~\`${codeBlockContent}\`~~`, - ); - expect(serialize(paragraph(code(strike(codeBlockContent))))).toBe( - `~~\`${codeBlockContent}\`~~`, - ); + it.each` + input | output + ${'code'} | ${'`code`'} + ${'code `with` backticks'} | ${'``code `with` backticks``'} + ${'this is `inline-code`'} | ${'`` this is `inline-code` ``'} + ${'`inline-code` in markdown'} | ${'`` `inline-code` in markdown ``'} + ${'```js'} | ${'`` ```js ``'} + `('correctly serializes inline code ("$input")', ({ input, output }) => { + expect(serialize(paragraph(code(input)))).toBe(output); + }); + + it('correctly serializes inline code wrapped by italics and bold marks', () => { + const content = 'code'; + + expect(serialize(paragraph(italic(code(content))))).toBe(`_\`${content}\`_`); + expect(serialize(paragraph(code(italic(content))))).toBe(`_\`${content}\`_`); + expect(serialize(paragraph(bold(code(content))))).toBe(`**\`${content}\`**`); + expect(serialize(paragraph(code(bold(content))))).toBe(`**\`${content}\`**`); + expect(serialize(paragraph(strike(code(content))))).toBe(`~~\`${content}\`~~`); + expect(serialize(paragraph(code(strike(content))))).toBe(`~~\`${content}\`~~`); }); it('correctly serializes inline diff', () => { diff --git a/spec/frontend/webhooks/components/form_url_app_spec.js b/spec/frontend/webhooks/components/form_url_app_spec.js index cbeff184e9d..fe8bba68610 100644 --- a/spec/frontend/webhooks/components/form_url_app_spec.js +++ b/spec/frontend/webhooks/components/form_url_app_spec.js @@ -1,5 +1,5 @@ import { nextTick } from 'vue'; -import { GlFormGroup, GlFormRadio, GlFormRadioGroup, GlLink } from '@gitlab/ui'; +import { GlFormGroup, GlFormRadio, GlFormRadioGroup, GlLink, GlAlert } from '@gitlab/ui'; import { scrollToElement } from '~/lib/utils/common_utils'; import FormUrlApp from '~/webhooks/components/form_url_app.vue'; @@ -30,6 +30,7 @@ describe('FormUrlApp', () => { const findFormUrlPreview = () => wrapper.findByTestId('form-url-preview'); const findUrlMaskSection = () => wrapper.findByTestId('url-mask-section'); const findFormEl = () => document.querySelector('.js-webhook-form'); + const findAlert = () => wrapper.findComponent(GlAlert); const submitForm = () => findFormEl().dispatchEvent(new Event('submit')); describe('template', () => { @@ -156,6 +157,23 @@ describe('FormUrlApp', () => { }); }); + describe('token will be cleared warning', () => { + beforeEach(() => { + createComponent({ initialUrl: 'url' }); + }); + + it('is hidden when URL has not changed', () => { + expect(findAlert().exists()).toBe(false); + }); + + it('is displayed when URL has changed', async () => { + findFormUrl().vm.$emit('input', 'another_url'); + await nextTick(); + + expect(findAlert().exists()).toBe(true); + }); + }); + describe('validations', () => { const inputRequiredText = FormUrlApp.i18n.inputRequired; |