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/sidebar')
-rw-r--r--spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js2
-rw-r--r--spec/frontend/sidebar/components/participants/sidebar_participants_widget_spec.js10
-rw-r--r--spec/frontend/sidebar/sidebar_labels_spec.js2
-rw-r--r--spec/frontend/sidebar/sidebar_mediator_spec.js17
-rw-r--r--spec/frontend/sidebar/sidebar_store_spec.js39
-rw-r--r--spec/frontend/sidebar/track_invite_members_spec.js2
6 files changed, 15 insertions, 57 deletions
diff --git a/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js b/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js
index 8504684d23a..39f63b2a9f4 100644
--- a/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js
+++ b/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js
@@ -206,7 +206,7 @@ describe('Sidebar assignees widget', () => {
status: null,
},
],
- id: 1,
+ id: 'gid://gitlab/Issue/1',
},
],
]);
diff --git a/spec/frontend/sidebar/components/participants/sidebar_participants_widget_spec.js b/spec/frontend/sidebar/components/participants/sidebar_participants_widget_spec.js
index 57b9a10b23e..859e63b3df6 100644
--- a/spec/frontend/sidebar/components/participants/sidebar_participants_widget_spec.js
+++ b/spec/frontend/sidebar/components/participants/sidebar_participants_widget_spec.js
@@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils';
-import Vue from 'vue';
+import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
@@ -45,6 +45,14 @@ describe('Sidebar Participants Widget', () => {
expect(findParticipants().props('loading')).toBe(true);
});
+ it('emits toggleSidebar event when participants child component emits toggleSidebar', async () => {
+ createComponent();
+ findParticipants().vm.$emit('toggleSidebar');
+
+ await nextTick();
+ expect(wrapper.emitted('toggleSidebar')).toEqual([[]]);
+ });
+
describe('when participants are loaded', () => {
beforeEach(() => {
createComponent({
diff --git a/spec/frontend/sidebar/sidebar_labels_spec.js b/spec/frontend/sidebar/sidebar_labels_spec.js
index ab08a1e65e2..7455f684380 100644
--- a/spec/frontend/sidebar/sidebar_labels_spec.js
+++ b/spec/frontend/sidebar/sidebar_labels_spec.js
@@ -156,7 +156,7 @@ describe('sidebar labels', () => {
variables: {
input: {
iid: defaultProps.iid,
- labelIds: [toLabelGid(27), toLabelGid(28), toLabelGid(29), toLabelGid(40)],
+ labelIds: [toLabelGid(29), toLabelGid(28), toLabelGid(27), toLabelGid(40)],
operationMode: MutationOperationMode.Replace,
projectPath: defaultProps.projectPath,
},
diff --git a/spec/frontend/sidebar/sidebar_mediator_spec.js b/spec/frontend/sidebar/sidebar_mediator_spec.js
index 019ded87093..cb84c142d55 100644
--- a/spec/frontend/sidebar/sidebar_mediator_spec.js
+++ b/spec/frontend/sidebar/sidebar_mediator_spec.js
@@ -63,8 +63,6 @@ describe('Sidebar mediator', () => {
expect(mediator.store.assignees).toEqual(mockData.assignees);
expect(mediator.store.humanTimeEstimate).toEqual(mockData.human_time_estimate);
expect(mediator.store.humanTotalTimeSpent).toEqual(mockData.human_total_time_spent);
- expect(mediator.store.participants).toEqual(mockData.participants);
- expect(mediator.store.subscribed).toEqual(mockData.subscribed);
expect(mediator.store.timeEstimate).toEqual(mockData.time_estimate);
expect(mediator.store.totalTimeSpent).toEqual(mockData.total_time_spent);
});
@@ -117,19 +115,4 @@ describe('Sidebar mediator', () => {
urlSpy.mockRestore();
});
});
-
- it('toggle subscription', () => {
- mediator.store.setSubscribedState(false);
- mock.onPost(mediatorMockData.toggleSubscriptionEndpoint).reply(200, {});
- const spy = jest
- .spyOn(mediator.service, 'toggleSubscription')
- .mockReturnValue(Promise.resolve());
-
- return mediator.toggleSubscription().then(() => {
- expect(spy).toHaveBeenCalled();
- expect(mediator.store.subscribed).toEqual(true);
-
- spy.mockRestore();
- });
- });
});
diff --git a/spec/frontend/sidebar/sidebar_store_spec.js b/spec/frontend/sidebar/sidebar_store_spec.js
index 7b73dc868b7..3930dabfcfa 100644
--- a/spec/frontend/sidebar/sidebar_store_spec.js
+++ b/spec/frontend/sidebar/sidebar_store_spec.js
@@ -16,17 +16,6 @@ const ANOTHER_ASSINEE = {
avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
};
-const PARTICIPANT = {
- id: 1,
- state: 'active',
- username: 'marcene',
- name: 'Allie Will',
- web_url: 'foo.com',
- avatar_url: 'gravatar.com/avatar/xxx',
-};
-
-const PARTICIPANT_LIST = [PARTICIPANT, { ...PARTICIPANT, id: 2 }, { ...PARTICIPANT, id: 3 }];
-
describe('Sidebar store', () => {
let testContext;
@@ -113,28 +102,6 @@ describe('Sidebar store', () => {
expect(testContext.store.changing).toBe(true);
});
- it('sets participants data', () => {
- expect(testContext.store.participants.length).toEqual(0);
-
- testContext.store.setParticipantsData({
- participants: PARTICIPANT_LIST,
- });
-
- expect(testContext.store.isFetching.participants).toEqual(false);
- expect(testContext.store.participants.length).toEqual(PARTICIPANT_LIST.length);
- });
-
- it('sets subcriptions data', () => {
- expect(testContext.store.subscribed).toEqual(null);
-
- testContext.store.setSubscriptionsData({
- subscribed: true,
- });
-
- expect(testContext.store.isFetching.subscriptions).toEqual(false);
- expect(testContext.store.subscribed).toEqual(true);
- });
-
it('set assigned data', () => {
const users = {
assignees: UsersMockHelper.createNumberRandomUsers(3),
@@ -147,11 +114,11 @@ describe('Sidebar store', () => {
});
it('sets fetching state', () => {
- expect(testContext.store.isFetching.participants).toEqual(true);
+ expect(testContext.store.isFetching.assignees).toEqual(true);
- testContext.store.setFetchingState('participants', false);
+ testContext.store.setFetchingState('assignees', false);
- expect(testContext.store.isFetching.participants).toEqual(false);
+ expect(testContext.store.isFetching.assignees).toEqual(false);
});
it('sets loading state', () => {
diff --git a/spec/frontend/sidebar/track_invite_members_spec.js b/spec/frontend/sidebar/track_invite_members_spec.js
index 6c96e4cfc76..5946e3320c4 100644
--- a/spec/frontend/sidebar/track_invite_members_spec.js
+++ b/spec/frontend/sidebar/track_invite_members_spec.js
@@ -10,7 +10,7 @@ describe('Track user dropdown open', () => {
document.body.innerHTML = `
<div id="dummy-wrapper-element">
<div class="js-sidebar-assignee-dropdown">
- <div class="js-invite-members-track" data-track-event="_track_event_" data-track-label="_track_label_">
+ <div class="js-invite-members-track" data-track-action="_track_event_" data-track-label="_track_label_">
</div>
</div>
</div>