diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-20 21:07:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-20 21:07:04 +0300 |
commit | 3b7f1f7e093053f42674f950236b9733a08507cd (patch) | |
tree | a957a067b82d600cdce89a38d2e11b26d9d3bfcf /spec/frontend/users | |
parent | 58af7e4529e1762dea281938952bbba918d92cb9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/users')
-rw-r--r-- | spec/frontend/users/profile/actions/components/user_actions_app_spec.js | 31 |
1 files changed, 28 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..c2ae3d8364f 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 @@ -6,11 +6,13 @@ 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 +21,25 @@ 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('shows copy user id action', () => { @@ -35,4 +47,17 @@ 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'); + }); }); |