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:
Diffstat (limited to 'spec/frontend/users/profile/actions/components/user_actions_app_spec.js')
-rw-r--r--spec/frontend/users/profile/actions/components/user_actions_app_spec.js38
1 files changed, 38 insertions, 0 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
new file mode 100644
index 00000000000..d27962440ee
--- /dev/null
+++ b/spec/frontend/users/profile/actions/components/user_actions_app_spec.js
@@ -0,0 +1,38 @@
+import { GlDisclosureDropdown } from '@gitlab/ui';
+import { mountExtended } from 'helpers/vue_test_utils_helper';
+import UserActionsApp from '~/users/profile/actions/components/user_actions_app.vue';
+
+describe('User Actions App', () => {
+ let wrapper;
+
+ const USER_ID = 'test-id';
+
+ const createWrapper = (propsData = {}) => {
+ wrapper = mountExtended(UserActionsApp, {
+ propsData: {
+ userId: USER_ID,
+ ...propsData,
+ },
+ });
+ };
+
+ const findDropdown = () => wrapper.findComponent(GlDisclosureDropdown);
+ const findActions = () => wrapper.findAllByTestId('disclosure-dropdown-item');
+ const findAction = (position = 0) => findActions().at(position);
+
+ it('shows dropdown', () => {
+ createWrapper();
+ expect(findDropdown().exists()).toBe(true);
+ });
+
+ it('shows actions correctly', () => {
+ createWrapper();
+ expect(findActions()).toHaveLength(1);
+ });
+
+ it('shows copy user id action', () => {
+ createWrapper();
+ expect(findAction().text()).toBe(`Copy user ID: ${USER_ID}`);
+ expect(findAction().findComponent('button').attributes('data-clipboard-text')).toBe(USER_ID);
+ });
+});