debian-mirror-gitlab/spec/frontend/issues/show/components/locked_warning_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-03-04 22:38:38 +05:30
import { GlAlert, GlLink } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { sprintf } from '~/locale';
2023-04-23 21:23:45 +05:30
import { TYPE_EPIC, TYPE_ISSUE } from '~/issues/constants';
2023-03-04 22:38:38 +05:30
import LockedWarning, { i18n } from '~/issues/show/components/locked_warning.vue';
describe('LockedWarning component', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = mountExtended(LockedWarning, {
propsData: props,
});
};
const findAlert = () => wrapper.findComponent(GlAlert);
const findLink = () => wrapper.findComponent(GlLink);
2023-04-23 21:23:45 +05:30
describe.each([TYPE_ISSUE, TYPE_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);
});
2023-06-20 00:43:36 +05:30
it(`displays correct message`, () => {
2023-04-23 21:23:45 +05:30
expect(alert.text()).toMatchInterpolatedText(sprintf(i18n.alertMessage, { issuableType }));
});
2023-06-20 00:43:36 +05:30
it(`displays a link with correct text`, () => {
2023-04-23 21:23:45 +05:30
expect(link.exists()).toBe(true);
expect(link.text()).toBe(`the ${issuableType}`);
});
});
2023-03-04 22:38:38 +05:30
});