Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vue_shared/components/confirm_modal_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/confirm_modal_spec.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/frontend/vue_shared/components/confirm_modal_spec.js b/spec/frontend/vue_shared/components/confirm_modal_spec.js
index 8456ca9d125..96ccf56cbc6 100644
--- a/spec/frontend/vue_shared/components/confirm_modal_spec.js
+++ b/spec/frontend/vue_shared/components/confirm_modal_spec.js
@@ -62,7 +62,7 @@ describe('vue_shared/components/confirm_modal', () => {
wrapper.vm.modalAttributes = MOCK_MODAL_DATA.modalAttributes;
});
- it('renders GlModal wtih data', () => {
+ it('renders GlModal with data', () => {
expect(findModal().exists()).toBeTruthy();
expect(findModal().attributes()).toEqual(
expect.objectContaining({
@@ -72,6 +72,24 @@ describe('vue_shared/components/confirm_modal', () => {
);
});
});
+
+ describe.each`
+ desc | attrs | expectation
+ ${'when message is simple text'} | ${{}} | ${`<div>${MOCK_MODAL_DATA.modalAttributes.message}</div>`}
+ ${'when message has html'} | ${{ messageHtml: '<p>Header</p><ul onhover="alert(1)"><li>First</li></ul>' }} | ${'<p>Header</p><ul><li>First</li></ul>'}
+ `('$desc', ({ attrs, expectation }) => {
+ beforeEach(() => {
+ createComponent();
+ wrapper.vm.modalAttributes = {
+ ...MOCK_MODAL_DATA.modalAttributes,
+ ...attrs,
+ };
+ });
+
+ it('renders message', () => {
+ expect(findForm().element.innerHTML).toContain(expectation);
+ });
+ });
});
describe('methods', () => {