From c2f65d6e6f569415fe60e40aec5be6458d6a99bb Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 18 Nov 2022 06:10:50 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../edit/components/dynamic_field_spec.js | 2 +- .../issues/show/components/locked_warning_spec.js | 55 ++++++++++++++++++++++ spec/frontend/popovers/components/popovers_spec.js | 3 +- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 spec/frontend/issues/show/components/locked_warning_spec.js (limited to 'spec/frontend') diff --git a/spec/frontend/integrations/edit/components/dynamic_field_spec.js b/spec/frontend/integrations/edit/components/dynamic_field_spec.js index 5af0e272285..68f65a3ef6e 100644 --- a/spec/frontend/integrations/edit/components/dynamic_field_spec.js +++ b/spec/frontend/integrations/edit/components/dynamic_field_spec.js @@ -204,7 +204,7 @@ describe('DynamicField', () => { }); expect(findGlFormGroup().find('small').html()).toContain( - '[1 3 4]', + '[1 3 4', ); }); }); diff --git a/spec/frontend/issues/show/components/locked_warning_spec.js b/spec/frontend/issues/show/components/locked_warning_spec.js new file mode 100644 index 00000000000..08f0338d41b --- /dev/null +++ b/spec/frontend/issues/show/components/locked_warning_spec.js @@ -0,0 +1,55 @@ +import { GlAlert, GlLink } from '@gitlab/ui'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; +import { sprintf } from '~/locale'; +import { IssuableType } from '~/issues/constants'; +import LockedWarning, { i18n } from '~/issues/show/components/locked_warning.vue'; + +describe('LockedWarning component', () => { + let wrapper; + + const createComponent = (props = {}) => { + wrapper = mountExtended(LockedWarning, { + propsData: props, + }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + const findAlert = () => wrapper.findComponent(GlAlert); + const findLink = () => wrapper.findComponent(GlLink); + + describe.each([IssuableType.Issue, IssuableType.Epic])( + 'with issuableType set to %s', + (issuableType) => { + let alert; + let link; + beforeEach(() => { + createComponent({ issuableType }); + alert = findAlert(); + link = findLink(); + }); + + afterEach(() => { + alert = null; + link = null; + }); + + it('displays a non-closable alert', () => { + expect(alert.exists()).toBe(true); + expect(alert.props('dismissible')).toBe(false); + }); + + it(`displays correct message`, async () => { + expect(alert.text()).toMatchInterpolatedText(sprintf(i18n.alertMessage, { issuableType })); + }); + + it(`displays a link with correct text`, async () => { + expect(link.exists()).toBe(true); + expect(link.text()).toBe(`the ${issuableType}`); + }); + }, + ); +}); diff --git a/spec/frontend/popovers/components/popovers_spec.js b/spec/frontend/popovers/components/popovers_spec.js index eba6b95214d..1299e7277d1 100644 --- a/spec/frontend/popovers/components/popovers_spec.js +++ b/spec/frontend/popovers/components/popovers_spec.js @@ -57,12 +57,13 @@ describe('popovers/components/popovers.vue', () => { describe('supports HTML content', () => { const svgIcon = ''; + const escapedSvgIcon = ''; it.each` description | content | render ${'renders html content correctly'} | ${'HTML'} | ${'HTML'} ${'removes any unsafe content'} | ${''} | ${''} - ${'renders svg icons correctly'} | ${svgIcon} | ${svgIcon} + ${'renders svg icons correctly'} | ${svgIcon} | ${escapedSvgIcon} `('$description', async ({ content, render }) => { await buildWrapper(createPopoverTarget({ content, html: true })); -- cgit v1.2.3