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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-15 09:09:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-15 09:09:57 +0300
commit4b41b57abf3ad9c2e0e81b3804cb01af6f879349 (patch)
treefc8919c5c45d52d860b0f267fdab23c787243659 /spec/frontend/issuable
parent08e3d715127256b53529a7719b80569aa0d8bc52 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/issuable')
-rw-r--r--spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_block_spec.js.snap70
-rw-r--r--spec/frontend/issuable/linked_resources/components/resource_links_block_spec.js35
2 files changed, 105 insertions, 0 deletions
diff --git a/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_block_spec.js.snap b/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_block_spec.js.snap
new file mode 100644
index 00000000000..24586744ad6
--- /dev/null
+++ b/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_block_spec.js.snap
@@ -0,0 +1,70 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`ResourceLinksBlock with defaults renders correct component 1`] = `
+<div
+ class="gl-mt-5"
+ id="resource-links"
+>
+ <div
+ class="card card-slim gl-overflow-hidden"
+ >
+ <div
+ class="card-header gl-display-flex gl-justify-content-space-between panel-empty-heading border-bottom-0"
+ >
+ <h3
+ class="card-title h5 position-relative gl-my-0 gl-display-flex gl-align-items-center gl-h-7"
+ >
+ <gl-link-stub
+ aria-hidden="true"
+ class="anchor position-absolute gl-text-decoration-none"
+ href="#resource-links"
+ id="user-content-resource-links"
+ />
+ Linked resources
+ <gl-link-stub
+ aria-label="Read more about linked resources"
+ class="gl-display-flex gl-align-items-center gl-ml-2 gl-text-gray-500"
+ data-testid="help-link"
+ href="/help/user/project/issues/linked_resources"
+ target="_blank"
+ >
+ <gl-icon-stub
+ name="question"
+ size="12"
+ />
+ </gl-link-stub>
+
+ <div
+ class="gl-display-inline-flex"
+ >
+ <div
+ class="gl-display-inline-flex gl-mx-5"
+ >
+ <span
+ class="gl-display-inline-flex gl-align-items-center"
+ >
+ <gl-icon-stub
+ class="gl-mr-2 gl-text-gray-500"
+ name="link"
+ size="16"
+ />
+
+ 0
+
+ </span>
+ </div>
+
+ <gl-button-stub
+ aria-label="Add a resource link"
+ buttontextclasses=""
+ category="primary"
+ icon="plus"
+ size="medium"
+ variant="default"
+ />
+ </div>
+ </h3>
+ </div>
+ </div>
+</div>
+`;
diff --git a/spec/frontend/issuable/linked_resources/components/resource_links_block_spec.js b/spec/frontend/issuable/linked_resources/components/resource_links_block_spec.js
new file mode 100644
index 00000000000..c17ca1a3287
--- /dev/null
+++ b/spec/frontend/issuable/linked_resources/components/resource_links_block_spec.js
@@ -0,0 +1,35 @@
+import { GlButton } from '@gitlab/ui';
+import { shallowMount } from '@vue/test-utils';
+import ResourceLinksBlock from '~/linked_resources/components/resource_links_block.vue';
+
+describe('ResourceLinksBlock', () => {
+ let wrapper;
+
+ const findResourceLinkAddButton = () => wrapper.find(GlButton);
+ const helpPath = '/help/user/project/issues/linked_resources';
+
+ describe('with defaults', () => {
+ it('renders correct component', () => {
+ wrapper = shallowMount(ResourceLinksBlock, {
+ propsData: {
+ helpPath,
+ canAddResourceLinks: true,
+ },
+ });
+
+ expect(wrapper.element).toMatchSnapshot();
+ });
+ });
+
+ describe('with canAddResourceLinks=false', () => {
+ it('does not show the add button', () => {
+ wrapper = shallowMount(ResourceLinksBlock, {
+ propsData: {
+ canAddResourceLinks: false,
+ },
+ });
+
+ expect(findResourceLinkAddButton().exists()).toBe(false);
+ });
+ });
+});