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>2023-08-18 13:50:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
commitdb384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch)
tree34beaef37df5f47ccbcf5729d7583aae093cffa0 /spec/frontend/users/profile/actions
parent54fd7b1bad233e3944434da91d257fa7f63c3996 (diff)
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'spec/frontend/users/profile/actions')
-rw-r--r--spec/frontend/users/profile/actions/components/user_actions_app_spec.js58
1 files changed, 55 insertions, 3 deletions
diff --git a/spec/frontend/users/profile/actions/components/user_actions_app_spec.js b/spec/frontend/users/profile/actions/components/user_actions_app_spec.js
index d27962440ee..a33474375e6 100644
--- a/spec/frontend/users/profile/actions/components/user_actions_app_spec.js
+++ b/spec/frontend/users/profile/actions/components/user_actions_app_spec.js
@@ -1,16 +1,19 @@
import { GlDisclosureDropdown } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import UserActionsApp from '~/users/profile/actions/components/user_actions_app.vue';
+import AbuseCategorySelector from '~/abuse_reports/components/abuse_category_selector.vue';
describe('User Actions App', () => {
let wrapper;
const USER_ID = 'test-id';
+ const DEFAULT_SUBSCRIPTION_PATH = '';
const createWrapper = (propsData = {}) => {
wrapper = mountExtended(UserActionsApp, {
propsData: {
userId: USER_ID,
+ rssSubscriptionPath: DEFAULT_SUBSCRIPTION_PATH,
...propsData,
},
});
@@ -19,15 +22,34 @@ describe('User Actions App', () => {
const findDropdown = () => wrapper.findComponent(GlDisclosureDropdown);
const findActions = () => wrapper.findAllByTestId('disclosure-dropdown-item');
const findAction = (position = 0) => findActions().at(position);
+ const findSubscriptionLink = () => wrapper.findByTestId('user-profile-rss-subscription-link');
it('shows dropdown', () => {
createWrapper();
expect(findDropdown().exists()).toBe(true);
});
- it('shows actions correctly', () => {
- createWrapper();
- expect(findActions()).toHaveLength(1);
+ describe('shows user action items', () => {
+ it('should show items without RSS subscriptions', () => {
+ createWrapper();
+ expect(findActions()).toHaveLength(1);
+ });
+
+ it('should show items with RSS subscriptions', () => {
+ createWrapper({
+ rssSubscriptionPath: '/test/path',
+ });
+ expect(findActions()).toHaveLength(2);
+ });
+
+ it('should show items with report abuse', () => {
+ createWrapper({
+ rssSubscriptionPath: '/test/path',
+ reportedUserId: 1,
+ reportedFromUrl: '/report/path',
+ });
+ expect(findActions()).toHaveLength(3);
+ });
});
it('shows copy user id action', () => {
@@ -35,4 +57,34 @@ describe('User Actions App', () => {
expect(findAction().text()).toBe(`Copy user ID: ${USER_ID}`);
expect(findAction().findComponent('button').attributes('data-clipboard-text')).toBe(USER_ID);
});
+
+ it('shows subscription link when subscription url was presented', () => {
+ const testSubscriptionPath = '/test/path';
+
+ createWrapper({
+ rssSubscriptionPath: testSubscriptionPath,
+ });
+
+ const rssLink = findSubscriptionLink();
+ expect(rssLink.exists()).toBe(true);
+ expect(rssLink.attributes('href')).toBe(testSubscriptionPath);
+ expect(rssLink.text()).toBe('Subscribe');
+ });
+
+ it('shows report abuse action when reported user id was presented', () => {
+ const reportUrl = '/path/to/report';
+ const reportUserId = 1;
+ createWrapper({
+ rssSubscriptionPath: '/test/path',
+ reportedUserId: reportUserId,
+ reportedFromUrl: reportUrl,
+ });
+ const abuseCategorySelector = wrapper.findComponent(AbuseCategorySelector);
+ expect(abuseCategorySelector.exists()).toBe(true);
+ expect(abuseCategorySelector.props()).toEqual({
+ reportedUserId: reportUserId,
+ reportedFromUrl: reportUrl,
+ showDrawer: false,
+ });
+ });
});