summaryrefslogtreecommitdiff
path: root/spec/frontend/sidebar/lock
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/sidebar/lock')
-rw-r--r--spec/frontend/sidebar/lock/__snapshots__/edit_form_spec.js.snap79
-rw-r--r--spec/frontend/sidebar/lock/edit_form_spec.js12
2 files changed, 84 insertions, 7 deletions
diff --git a/spec/frontend/sidebar/lock/__snapshots__/edit_form_spec.js.snap b/spec/frontend/sidebar/lock/__snapshots__/edit_form_spec.js.snap
new file mode 100644
index 00000000000..18d4df297df
--- /dev/null
+++ b/spec/frontend/sidebar/lock/__snapshots__/edit_form_spec.js.snap
@@ -0,0 +1,79 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Edit Form Dropdown In issue page when locked the appropriate warning text is rendered 1`] = `
+<div
+ class="dropdown-menu sidebar-item-warning-message"
+ data-testid="warning-text"
+>
+ <p
+ class="text"
+ >
+ <gl-sprintf-stub
+ message="Unlock this %{issuableDisplayName}? %{strongStart}Everyone%{strongEnd} will be able to comment."
+ />
+ </p>
+
+ <edit-form-buttons-stub
+ islocked="true"
+ issuabledisplayname="issue"
+ />
+</div>
+`;
+
+exports[`Edit Form Dropdown In issue page when unlocked the appropriate warning text is rendered 1`] = `
+<div
+ class="dropdown-menu sidebar-item-warning-message"
+ data-testid="warning-text"
+>
+ <p
+ class="text"
+ >
+ <gl-sprintf-stub
+ message="Lock this %{issuableDisplayName}? Only %{strongStart}project members%{strongEnd} will be able to comment."
+ />
+ </p>
+
+ <edit-form-buttons-stub
+ issuabledisplayname="issue"
+ />
+</div>
+`;
+
+exports[`Edit Form Dropdown In merge request page when locked the appropriate warning text is rendered 1`] = `
+<div
+ class="dropdown-menu sidebar-item-warning-message"
+ data-testid="warning-text"
+>
+ <p
+ class="text"
+ >
+ <gl-sprintf-stub
+ message="Unlock this %{issuableDisplayName}? %{strongStart}Everyone%{strongEnd} will be able to comment."
+ />
+ </p>
+
+ <edit-form-buttons-stub
+ islocked="true"
+ issuabledisplayname="merge request"
+ />
+</div>
+`;
+
+exports[`Edit Form Dropdown In merge request page when unlocked the appropriate warning text is rendered 1`] = `
+<div
+ class="dropdown-menu sidebar-item-warning-message"
+ data-testid="warning-text"
+>
+ <p
+ class="text"
+ >
+ <gl-sprintf-stub
+ message="Lock this %{issuableDisplayName}? Only %{strongStart}project members%{strongEnd} will be able to comment."
+ />
+ </p>
+
+ <edit-form-buttons-stub
+ issuabledisplayname="merge request"
+ />
+</div>
+`;
diff --git a/spec/frontend/sidebar/lock/edit_form_spec.js b/spec/frontend/sidebar/lock/edit_form_spec.js
index 6a86ab14d90..b1c3bfe3ef5 100644
--- a/spec/frontend/sidebar/lock/edit_form_spec.js
+++ b/spec/frontend/sidebar/lock/edit_form_spec.js
@@ -38,18 +38,16 @@ describe('Edit Form Dropdown', () => {
});
describe.each`
- isLocked | lockStatusText | lockAction | warningText
- ${false} | ${'unlocked'} | ${'Lock'} | ${'Only project members will be able to comment.'}
- ${true} | ${'locked'} | ${'Unlock'} | ${'Everyone will be able to comment.'}
- `('when $lockStatusText', ({ isLocked, lockAction, warningText }) => {
+ isLocked | lockStatusText
+ ${false} | ${'unlocked'}
+ ${true} | ${'locked'}
+ `('when $lockStatusText', ({ isLocked }) => {
beforeEach(() => {
createComponent({ props: { isLocked } });
});
it(`the appropriate warning text is rendered`, () => {
- expect(findWarningText().text()).toContain(
- `${lockAction} this ${issuableDisplayName}? ${warningText}`,
- );
+ expect(findWarningText().element).toMatchSnapshot();
});
});
});