diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 18:13:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 18:13:11 +0300 |
commit | 74015980b5259072bbf27b432b9b08fda9d27945 (patch) | |
tree | f1bae954429c9a1e0f1f99fd3dccb5be7adfb93e /spec/frontend/vue_shared/components/design_management | |
parent | 5343536f2bb402bc767db2d015e45ac87189d7c3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/design_management')
-rw-r--r-- | spec/frontend/vue_shared/components/design_management/__snapshots__/design_note_pin_spec.js.snap | 55 | ||||
-rw-r--r-- | spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js | 42 |
2 files changed, 97 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/design_management/__snapshots__/design_note_pin_spec.js.snap b/spec/frontend/vue_shared/components/design_management/__snapshots__/design_note_pin_spec.js.snap new file mode 100644 index 00000000000..eb0adb0bebd --- /dev/null +++ b/spec/frontend/vue_shared/components/design_management/__snapshots__/design_note_pin_spec.js.snap @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Design note pin component should match the snapshot of note with index 1`] = ` +<button + aria-label="Comment '1' position" + class="gl-display-flex gl-align-items-center gl-justify-content-center gl-font-sm js-image-badge design-note-pin gl-absolute" + style="left: 10px; top: 10px;" + type="button" +> + + 1 + +</button> +`; + +exports[`Design note pin component should match the snapshot of note without index 1`] = ` +<button + aria-label="Comment form position" + class="gl-display-flex gl-align-items-center gl-justify-content-center gl-font-sm btn-transparent comment-indicator gl-absolute" + style="left: 10px; top: 10px;" + type="button" +> + <gl-icon-stub + name="image-comment-dark" + size="24" + /> +</button> +`; + +exports[`Design note pin component should match the snapshot when pin is resolved 1`] = ` +<button + aria-label="Comment form position" + class="gl-display-flex gl-align-items-center gl-justify-content-center gl-font-sm btn-transparent comment-indicator resolved gl-absolute" + style="left: 10px; top: 10px;" + type="button" +> + <gl-icon-stub + name="image-comment-dark" + size="24" + /> +</button> +`; + +exports[`Design note pin component should match the snapshot when position is absent 1`] = ` +<button + aria-label="Comment form position" + class="gl-display-flex gl-align-items-center gl-justify-content-center gl-font-sm btn-transparent comment-indicator" + type="button" +> + <gl-icon-stub + name="image-comment-dark" + size="24" + /> +</button> +`; diff --git a/spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js b/spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js new file mode 100644 index 00000000000..984a28c93d6 --- /dev/null +++ b/spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js @@ -0,0 +1,42 @@ +import { shallowMount } from '@vue/test-utils'; +import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue'; + +describe('Design note pin component', () => { + let wrapper; + + function createComponent(propsData = {}) { + wrapper = shallowMount(DesignNotePin, { + propsData: { + position: { + left: '10px', + top: '10px', + }, + ...propsData, + }, + }); + } + + afterEach(() => { + wrapper.destroy(); + }); + + it('should match the snapshot of note without index', () => { + createComponent(); + expect(wrapper.element).toMatchSnapshot(); + }); + + it('should match the snapshot of note with index', () => { + createComponent({ label: 1 }); + expect(wrapper.element).toMatchSnapshot(); + }); + + it('should match the snapshot when pin is resolved', () => { + createComponent({ isResolved: true }); + expect(wrapper.element).toMatchSnapshot(); + }); + + it('should match the snapshot when position is absent', () => { + createComponent({ position: null }); + expect(wrapper.element).toMatchSnapshot(); + }); +}); |