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:
-rw-r--r--GITLAB_PAGES_VERSION2
-rw-r--r--app/assets/javascripts/design_management/components/design_notes/design_discussion.vue1
-rw-r--r--app/assets/javascripts/design_management/components/design_notes/design_note.vue62
-rw-r--r--data/removals/16_0/16-00-JWT-limit-setting.yml21
-rw-r--r--doc/api/geo_nodes.md2
-rw-r--r--doc/api/geo_sites.md4
-rw-r--r--doc/ci/large_repositories/index.md24
-rw-r--r--doc/ci/runners/saas/linux_saas_runner.md118
-rw-r--r--doc/development/pipelines/performance.md9
-rw-r--r--doc/update/removals.md12
-rw-r--r--qa/gdk/Dockerfile.gdk4
-rw-r--r--qa/qa/page/merge_request/show.rb7
-rw-r--r--spec/frontend/design_management/components/design_notes/__snapshots__/design_note_spec.js.snap2
-rw-r--r--spec/frontend/design_management/components/design_notes/design_note_spec.js34
14 files changed, 118 insertions, 184 deletions
diff --git a/GITLAB_PAGES_VERSION b/GITLAB_PAGES_VERSION
index 286d9d0b2b8..e47ba742fe5 100644
--- a/GITLAB_PAGES_VERSION
+++ b/GITLAB_PAGES_VERSION
@@ -1 +1 @@
-6c557b2169b961d9f5b8ba5f9acc6636071c5421
+f7184fef92c2dd87ef4306b265f9325b58ebf152
diff --git a/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue b/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
index 680a101b118..40c2a0eb23d 100644
--- a/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
+++ b/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
@@ -311,7 +311,6 @@ export default {
:loading="isResolving"
category="tertiary"
data-testid="resolve-button"
- size="small"
@click.stop="toggleResolvedStatus"
/>
</template>
diff --git a/app/assets/javascripts/design_management/components/design_notes/design_note.vue b/app/assets/javascripts/design_management/components/design_notes/design_note.vue
index b92a2392948..46ae87a36e4 100644
--- a/app/assets/javascripts/design_management/components/design_notes/design_note.vue
+++ b/app/assets/javascripts/design_management/components/design_notes/design_note.vue
@@ -3,8 +3,7 @@ import {
GlAvatar,
GlAvatarLink,
GlButton,
- GlDropdown,
- GlDropdownItem,
+ GlDisclosureDropdown,
GlLink,
GlTooltipDirective,
} from '@gitlab/ui';
@@ -29,8 +28,7 @@ export default {
GlAvatar,
GlAvatarLink,
GlButton,
- GlDropdown,
- GlDropdownItem,
+ GlDisclosureDropdown,
GlLink,
TimeAgoTooltip,
TimelineEntryItem,
@@ -83,15 +81,38 @@ export default {
id: this.note.id,
};
},
- isEditButtonVisible() {
- return !this.isEditing && this.adminPermissions;
- },
- isMoreActionsButtonVisible() {
+ isEditingAndHasPermissions() {
return !this.isEditing && this.adminPermissions;
},
adminPermissions() {
return this.note.userPermissions.adminNote;
},
+ dropdownItems() {
+ return [
+ {
+ text: this.$options.i18n.editCommentLabel,
+ action: () => {
+ this.isEditing = true;
+ },
+ extraAttrs: {
+ 'data-testid': 'delete-note-button',
+ 'data-qa-selector': 'delete_design_note_button',
+ class: 'gl-sm-display-none!',
+ },
+ },
+ {
+ text: this.$options.i18n.deleteCommentText,
+ action: () => {
+ this.$emit('delete-note', this.note);
+ },
+ extraAttrs: {
+ 'data-testid': 'delete-note-button',
+ 'data-qa-selector': 'delete_design_note_button',
+ class: 'gl-text-red-500!',
+ },
+ },
+ ];
+ },
},
methods: {
hideForm() {
@@ -138,43 +159,34 @@ export default {
</gl-link>
</span>
</div>
- <div class="gl-display-flex gl-align-items-baseline">
+ <div class="gl-display-flex gl-align-items-baseline gl-mt-n2 gl-mr-n2">
<slot name="resolve-discussion"></slot>
<gl-button
- v-if="isEditButtonVisible"
+ v-if="isEditingAndHasPermissions"
v-gl-tooltip
+ class="gl-display-none gl-sm-display-inline-flex!"
:aria-label="$options.i18n.editCommentLabel"
:title="$options.i18n.editCommentLabel"
category="tertiary"
data-testid="note-edit"
icon="pencil"
- size="small"
@click="isEditing = true"
/>
- <gl-dropdown
- v-if="isMoreActionsButtonVisible"
+ <gl-disclosure-dropdown
+ v-if="isEditingAndHasPermissions"
v-gl-tooltip.hover
- class="gl-display-none gl-sm-display-inline-flex! gl-ml-3"
+ toggle-class="btn-sm"
icon="ellipsis_v"
category="tertiary"
data-qa-selector="design_discussion_actions_ellipsis_dropdown"
data-testid="more-actions-dropdown"
- :text="$options.i18n.moreActionsLabel"
text-sr-only
:title="$options.i18n.moreActionsLabel"
:aria-label="$options.i18n.moreActionsLabel"
no-caret
left
- >
- <gl-dropdown-item
- variant="danger"
- data-qa-selector="delete_design_note_button"
- data-testid="delete-note-button"
- @click="$emit('delete-note', note)"
- >
- {{ $options.i18n.deleteCommentText }}
- </gl-dropdown-item>
- </gl-dropdown>
+ :items="dropdownItems"
+ />
</div>
</div>
<template v-if="!isEditing">
diff --git a/data/removals/16_0/16-00-JWT-limit-setting.yml b/data/removals/16_0/16-00-JWT-limit-setting.yml
new file mode 100644
index 00000000000..d8e3ccb359a
--- /dev/null
+++ b/data/removals/16_0/16-00-JWT-limit-setting.yml
@@ -0,0 +1,21 @@
+#
+# REQUIRED FIELDS
+#
+- title: "Secure JWT token setting is removed" # (required) Clearly explain the change. For example, "The `confidential` field for a `Note` is removed" or "CI/CD job names are limited to 250 characters."
+ announcement_milestone: "15.9" # (required) The milestone when this feature was deprecated.
+ removal_milestone: "16.0" # (required) The milestone when this feature is being removed.
+ breaking_change: true # (required) Change to false if this is not a breaking change.
+ reporter: jocelynjane # (required) GitLab username of the person reporting the removal
+ stage: verify # (required) String value of the stage that the feature was created in. e.g., Growth
+ issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/366798 # (required) Link to the deprecation issue in GitLab
+ body: | # (required) Do not modify this line, instead modify the lines below.
+ As part of [the deprecation of old versions of JSON web tokens](https://docs.gitlab.com/ee/update/deprecations.html#old-versions-of-json-web-tokens-are-deprecated), the **Limit JSON Web Token (JWT)** project setting has been removed. This setting was a temporary solution to help users transition to [ID tokens](https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html), as a way to switch between the old and new tokens, but the setting is no longer needed. In GitLab 16.0 and later, you can simply start using ID tokens in any job. When you use the `id_tokens` keyword in a job, that job uses only ID tokens and the old `CI_JOB_JWT*` tokens are not available. In jobs that do not use the `id_tokens` keyword, the old behavior remains unchanged.
+
+ The old `CI_JOB_JWT*` tokens will be completely removed in GitLab 16.5, so you must switch to ID tokens before that release.
+#
+# OPTIONAL FIELDS
+#
+ tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate]
+ documentation_url: # (optional) This is a link to the current documentation page
+ image_url: # (optional) This is a link to a thumbnail image depicting the feature
+ video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
diff --git a/doc/api/geo_nodes.md b/doc/api/geo_nodes.md
index 1445e9768c1..b9d4f93d841 100644
--- a/doc/api/geo_nodes.md
+++ b/doc/api/geo_nodes.md
@@ -192,8 +192,6 @@ Example response:
Updates settings of an existing Geo node.
-_This can only be run against a primary Geo node._
-
```plaintext
PUT /geo_nodes/:id
```
diff --git a/doc/api/geo_sites.md b/doc/api/geo_sites.md
index 40410cdf540..ff06f668514 100644
--- a/doc/api/geo_sites.md
+++ b/doc/api/geo_sites.md
@@ -179,9 +179,9 @@ Example response:
}
```
-## Edit a primary Geo site
+## Edit a Geo site
-Updates settings of an existing primary Geo site.
+Updates settings of an existing Geo site.
```plaintext
PUT /geo_sites/:id
diff --git a/doc/ci/large_repositories/index.md b/doc/ci/large_repositories/index.md
index f728e9b9e17..4b17f3354aa 100644
--- a/doc/ci/large_repositories/index.md
+++ b/doc/ci/large_repositories/index.md
@@ -245,19 +245,11 @@ concurrent = 4
This makes the cloning configuration to be part of the given runner
and does not require us to update each `.gitlab-ci.yml`.
-## Git fetch caching or pre-clone step
-
-For very active repositories with a large number of references and files, you can either (or both):
-
-- Consider using the [Gitaly pack-objects cache](../../administration/gitaly/configure_gitaly.md#pack-objects-cache) instead of a
- pre-clone step. This is easier to set up and it benefits all repositories on your GitLab server, unlike the pre-clone step that
- must be configured per-repository. The pack-objects cache also automatically works for forks. On GitLab.com, where the pack-objects cache is
- enabled on all Gitaly servers, we found that we no longer need a pre-clone step for `gitlab-org/gitlab` development.
-- Optimize your CI/CD jobs by seeding repository data in a pre-clone step with the
- [`pre_clone_script`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section) of GitLab Runner. See
- [SaaS runners on Linux](../runners/saas/linux_saas_runner.md#pre-clone-script-deprecated) for details.
- Besides speeding up pipelines in large and active projects,
- seeding the repository data also helps avoid
- `429 Too many requests` errors from Cloudflare.
- This error can occur if you have many runners behind a single,
- IP address using NAT, that pulls from GitLab.com.
+## Git fetch caching step
+
+For very active repositories with a large number of references and files, consider using the
+[Gitaly pack-objects cache](../../administration/gitaly/configure_gitaly.md#pack-objects-cache).
+The pack-objects cache:
+
+- Benefits all repositories on your GitLab server.
+- Automatically works for forks.
diff --git a/doc/ci/runners/saas/linux_saas_runner.md b/doc/ci/runners/saas/linux_saas_runner.md
index e693c6ae5c1..f1ae1a368bc 100644
--- a/doc/ci/runners/saas/linux_saas_runner.md
+++ b/doc/ci/runners/saas/linux_saas_runner.md
@@ -101,123 +101,15 @@ SaaS runner instances are provisioned with a 25 GB storage volume. The underlyin
is shared by the operating system, the Docker image, and a copy of your cloned repository.
This means that the available free disk space that your jobs can use is **less than 25 GB**.
-## RAM disk (tmpfs)
+<!--- start_remove The following content will be removed on remove_date: '2023-08-22' -->
-If your workloads generate a lot of disk input/output, you can run them from a RAM disk instead.
+## Pre-clone script (removed)
-Add a `tmpfs` mount point as part of your CI job, and ensure that these operations run from that location:
-
-```yaml
-myjob:
- before_script:
- - mkdir -p mount/point
- - mount -t tmpfs -o size=1G tmpfs mount/point
-```
-
-`tmpfs` stores any data written in RAM, and is paged out to swap if necessary, which generates input/output.
-To avoid this I/O, ensure that the combined memory needed by the workload plus the data written to `tmpfs` does not exceed
-the amount of RAM in the [runner machine type](#machine-types-available-for-private-projects-x86-64)
-selected for the job.
-
-The `free` command can be used to observe the state of memory use and potentially help explain why jobs
-intermittently run slowly or fail.
-
-```yaml
- script:
- - run_tests --workdir mount/point/
- - free
-```
-
-If `buff/cache` is lower than normal or there is any swap used, this suggests that the server was under
-memory pressure. In the following example, `Swap: used` is not zero, and additionally
-compares `buff/cache` to a job which ran without any issues.
-
-```plaintext
- total used free shared buff/cache available
-Mem: 4396380 334028 3678404 3884 383948 3799128
-Swap: 1048572 69632 978940
-```
-
-## Pre-clone script (deprecated)
-
-WARNING:
This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/391896) in GitLab 15.9
-and is planned for removal in 16.0. Use [`pre_get_sources_script`](../../../ci/yaml/index.md#hookspre_get_sources_script) instead. This change is a breaking change.
-With SaaS runners on Linux, you can run commands in a CI/CD
-job before the runner attempts to run `git init` and `git fetch` to
-download a GitLab repository. The
-[`pre_clone_script`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section)
-can be used for:
-
-- Seeding the build directory with repository data
-- Sending a request to a server
-- Downloading assets from a CDN
-- Any other commands that must run before the `git init`
-
-To use this feature, define a [CI/CD variable](../../../ci/variables/index.md) called
-`CI_PRE_CLONE_SCRIPT` that contains a bash script.
-
-NOTE:
-The `CI_PRE_CLONE_SCRIPT` variable does not work on GitLab SaaS Windows or macOS runners.
-
-### Pre-clone script example
-
-This example was used in the `gitlab-org/gitlab` project until November 2021.
-The project no longer uses this optimization because the
-[pack-objects cache](../../../administration/gitaly/configure_gitaly.md#pack-objects-cache)
-lets Gitaly serve the full CI/CD fetch traffic. See [Git fetch caching](../../../development/pipelines/performance.md#git-fetch-caching).
-
-The `CI_PRE_CLONE_SCRIPT` was defined as a project CI/CD variable:
-
-```shell
-(
- echo "Downloading archived master..."
- wget -O /tmp/gitlab.tar.gz https://storage.googleapis.com/gitlab-ci-git-repo-cache/project-278964/gitlab-master-shallow.tar.gz
-
- if [ ! -f /tmp/gitlab.tar.gz ]; then
- echo "Repository cache not available, cloning a new directory..."
- exit
- fi
-
- rm -rf $CI_PROJECT_DIR
- echo "Extracting tarball into $CI_PROJECT_DIR..."
- mkdir -p $CI_PROJECT_DIR
- cd $CI_PROJECT_DIR
- tar xzf /tmp/gitlab.tar.gz
- rm -f /tmp/gitlab.tar.gz
- chmod a+w $CI_PROJECT_DIR
-)
-```
-
-The first step of the script downloads `gitlab-master.tar.gz` from Google Cloud Storage.
-There was a [GitLab CI/CD job named `cache-repo`](https://gitlab.com/gitlab-org/gitlab/-/blob/5fb40526c8c8aaafc5f92eab36d5bbddaca3893d/.gitlab/ci/cache-repo.gitlab-ci.yml)
-that was responsible for keeping that archive up-to-date. Every two hours on a scheduled pipeline,
-it did the following:
-
-1. Create a fresh clone of the `gitlab-org/gitlab` repository on GitLab.com.
-1. Save the data as a `.tar.gz`.
-1. Upload it into the Google Cloud Storage bucket.
-
-When a job ran with this configuration, the output looked similar to:
-
-```shell
-$ eval "$CI_PRE_CLONE_SCRIPT"
-Downloading archived master...
-Extracting tarball into /builds/gitlab-org/gitlab...
-Fetching changes...
-Reinitialized existing Git repository in /builds/gitlab-org/gitlab/.git/
-```
-
-The `Reinitialized existing Git repository` message shows that
-the pre-clone step worked. The runner runs `git init`, which
-overwrites the Git configuration with the appropriate settings to fetch
-from the GitLab repository.
-
-`CI_REPO_CACHE_CREDENTIALS` must contain the Google Cloud service account
-JSON for uploading to the `gitlab-ci-git-repo-cache` bucket.
+and [removed](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29405) in 16.0.
+Use [`pre_get_sources_script`](../../../ci/yaml/index.md#hookspre_get_sources_script) instead.
-This bucket should be located in the same continent as the
-runner, or [you can incur network egress charges](https://cloud.google.com/storage/pricing).
+<!--- end_remove -->
## `config.toml`
diff --git a/doc/development/pipelines/performance.md b/doc/development/pipelines/performance.md
index d0eef0c86bd..b31d239eb6b 100644
--- a/doc/development/pipelines/performance.md
+++ b/doc/development/pipelines/performance.md
@@ -139,12 +139,3 @@ and `compile-production-assets` jobs to:
This task is responsible for deciding if assets need to be compiled or not.
It [compares the `HEAD` `SHA256` hexdigest from `$GITLAB_ASSETS_HASH` with the `master` hexdigest from `cached-assets-hash.txt`](https://gitlab.com/gitlab-org/gitlab/-/blob/c023191ef412e868ae957f3341208a41ca678403/lib/tasks/gitlab/assets.rake#L86).
1. If the hashes are the same, we don't compile anything. If they're different, we compile the assets.
-
-## Pre-clone step
-
-NOTE:
-We no longer use this optimization for `gitlab-org/gitlab` because the [pack-objects cache](../../administration/gitaly/configure_gitaly.md#pack-objects-cache)
-allows Gitaly to serve the full CI/CD fetch traffic now. See [Git fetch caching](#git-fetch-caching).
-
-The pre-clone step works by using the `CI_PRE_CLONE_SCRIPT` variable
-[defined by GitLab.com shared runners](../../ci/runners/saas/linux_saas_runner.md#pre-clone-script-deprecated).
diff --git a/doc/update/removals.md b/doc/update/removals.md
index 9a2a3ac55fa..91af9d21a20 100644
--- a/doc/update/removals.md
+++ b/doc/update/removals.md
@@ -627,6 +627,18 @@ From GitLab 15.9, all Release links are external. The `external` field of the `R
From GitLab 15.9, all Release links are external. The `external` field in the Releases and Release link APIs was deprecated in 15.9, and removed in GitLab 16.0.
+### Secure JWT token setting is removed
+
+<div class="deprecation-notes">
+- Announced in: GitLab <span class="milestone">15.9</span>
+- This is a [breaking change](https://docs.gitlab.com/ee/development/deprecation_guidelines/). Review the details carefully before upgrading.
+- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/366798).
+</div>
+
+As part of [the deprecation of old versions of JSON web tokens](https://docs.gitlab.com/ee/update/deprecations.html#old-versions-of-json-web-tokens-are-deprecated), the **Limit JSON Web Token (JWT)** project setting has been removed. This setting was a temporary solution to help users transition to [ID tokens](https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html), as a way to switch between the old and new tokens, but the setting is no longer needed. In GitLab 16.0 and later, you can simply start using ID tokens in any job. When you use the `id_tokens` keyword in a job, that job uses only ID tokens and the old `CI_JOB_JWT*` tokens are not available. In jobs that do not use the `id_tokens` keyword, the old behavior remains unchanged.
+
+The old `CI_JOB_JWT*` tokens will be completely removed in GitLab 16.5, so you must switch to ID tokens before that release.
+
### Secure scanning `_DISABLED` variables now require the value `"true"`
<div class="deprecation-notes">
diff --git a/qa/gdk/Dockerfile.gdk b/qa/gdk/Dockerfile.gdk
index a9863446e8e..6952267ad9c 100644
--- a/qa/gdk/Dockerfile.gdk
+++ b/qa/gdk/Dockerfile.gdk
@@ -4,7 +4,7 @@
ARG BASE_TAG=master
-FROM registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-slim-ruby-3.0-golang-1.19-rust-1.65-node-16.14-postgresql-12:rubygems-3.4-git-2.36-lfs-2.9-yarn-1.22 as gdk-base
+FROM registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-slim-ruby-3.0-golang-1.19-rust-1.65-node-16.14-postgresql-13:rubygems-3.4-git-2.36-lfs-2.9-yarn-1.22 as gdk-base
RUN set -eux; \
groupadd gdk -g 1000; \
@@ -26,7 +26,7 @@ RUN set -eux; \
libpcre2-8-0 \
libpcre2-dev \
libpcre2-posix2 \
- && apt-get install -y --no-install-recommends postgresql-12; \
+ && apt-get install -y --no-install-recommends postgresql-13; \
apt-get autoclean -y
# Clone GDK and install system dependencies, purge system git
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb
index e10db796f8e..d5d8c52a0e3 100644
--- a/qa/qa/page/merge_request/show.rb
+++ b/qa/qa/page/merge_request/show.rb
@@ -201,13 +201,6 @@ module QA
def click_diffs_tab
# Do not wait for spinner due to https://gitlab.com/gitlab-org/gitlab/-/issues/398584
click_element(:diffs_tab, skip_finished_loading_check: true)
-
- # If the diff isn't available when we navigate to the Changes tab
- # we must reload the page. https://gitlab.com/gitlab-org/gitlab/-/issues/398557
- wait_until(reload: true, skip_finished_loading_check_on_refresh: true) do
- QA::Runtime::Logger.debug('Ensuring that diff has loaded async')
- has_element?(:file_tree_button, skip_finished_loading_check: true, wait: 5)
- end
end
def click_pipeline_link
diff --git a/spec/frontend/design_management/components/design_notes/__snapshots__/design_note_spec.js.snap b/spec/frontend/design_management/components/design_notes/__snapshots__/design_note_spec.js.snap
index 3b407d11041..e6369c39816 100644
--- a/spec/frontend/design_management/components/design_notes/__snapshots__/design_note_spec.js.snap
+++ b/spec/frontend/design_management/components/design_notes/__snapshots__/design_note_spec.js.snap
@@ -67,7 +67,7 @@ exports[`Design note component should match the snapshot 1`] = `
</div>
<div
- class="gl-display-flex gl-align-items-baseline"
+ class="gl-display-flex gl-align-items-baseline gl-mt-n2 gl-mr-n2"
>
<!---->
diff --git a/spec/frontend/design_management/components/design_notes/design_note_spec.js b/spec/frontend/design_management/components/design_notes/design_note_spec.js
index 6f5b282fa3b..fc8309c3e28 100644
--- a/spec/frontend/design_management/components/design_notes/design_note_spec.js
+++ b/spec/frontend/design_management/components/design_notes/design_note_spec.js
@@ -1,6 +1,6 @@
import { ApolloMutation } from 'vue-apollo';
import { nextTick } from 'vue';
-import { GlAvatar, GlAvatarLink, GlDropdown } from '@gitlab/ui';
+import { GlAvatar, GlAvatarLink, GlDisclosureDropdown, GlDisclosureDropdownItem } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import DesignNote from '~/design_management/components/design_notes/design_note.vue';
import DesignReplyForm from '~/design_management/components/design_notes/design_reply_form.vue';
@@ -38,8 +38,10 @@ describe('Design note component', () => {
const findReplyForm = () => wrapper.findComponent(DesignReplyForm);
const findEditButton = () => wrapper.findByTestId('note-edit');
const findNoteContent = () => wrapper.findByTestId('note-text');
- const findDropdown = () => wrapper.findComponent(GlDropdown);
- const findDeleteNoteButton = () => wrapper.find('[data-testid="delete-note-button"]');
+ const findDropdown = () => wrapper.findComponent(GlDisclosureDropdown);
+ const findDropdownItems = () => findDropdown().findAllComponents(GlDisclosureDropdownItem);
+ const findEditDropdownItem = () => findDropdownItems().at(0);
+ const findDeleteDropdownItem = () => findDropdownItems().at(1);
function createComponent(props = {}, data = { isEditing: false }) {
wrapper = shallowMountExtended(DesignNote, {
@@ -61,6 +63,8 @@ describe('Design note component', () => {
},
stubs: {
ApolloMutation,
+ GlDisclosureDropdown,
+ GlDisclosureDropdownItem,
},
});
}
@@ -151,6 +155,23 @@ describe('Design note component', () => {
);
});
+ it('should open an edit form on edit button click', async () => {
+ createComponent({
+ note: {
+ ...note,
+ userPermissions: {
+ adminNote: true,
+ },
+ },
+ });
+
+ findEditDropdownItem().find('button').trigger('click');
+
+ await nextTick();
+ expect(findReplyForm().exists()).toBe(true);
+ expect(findNoteContent().exists()).toBe(false);
+ });
+
it('should not render note content and should render reply form', () => {
expect(findNoteContent().exists()).toBe(false);
expect(findReplyForm().exists()).toBe(true);
@@ -174,7 +195,7 @@ describe('Design note component', () => {
});
});
- describe('when user has a permission to delete note', () => {
+ describe('when user has admin permissions', () => {
it('should display a dropdown', () => {
createComponent({
note: {
@@ -186,6 +207,9 @@ describe('Design note component', () => {
});
expect(findDropdown().exists()).toBe(true);
+ expect(findEditDropdownItem().exists()).toBe(true);
+ expect(findDeleteDropdownItem().exists()).toBe(true);
+ expect(findDropdown().props('items')[0].extraAttrs.class).toBe('gl-sm-display-none!');
});
});
@@ -203,7 +227,7 @@ describe('Design note component', () => {
},
});
- findDeleteNoteButton().vm.$emit('click');
+ findDeleteDropdownItem().find('button').trigger('click');
expect(wrapper.emitted()).toEqual({ 'delete-note': [[{ ...payload }]] });
});