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')
-rw-r--r--spec/frontend/monitoring/components/dashboards_dropdown_spec.js7
-rw-r--r--spec/frontend/notes/components/comment_form_spec.js10
-rw-r--r--spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js8
-rw-r--r--spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js24
-rw-r--r--spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js47
5 files changed, 35 insertions, 61 deletions
diff --git a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js
index 3ccaa2d28ac..b769faa2d16 100644
--- a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js
+++ b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js
@@ -1,4 +1,4 @@
-import { GlDropdownItem, GlIcon } from '@gitlab/ui';
+import { GlDropdownItem, GlIcon, GlSearchBoxByType } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue';
@@ -38,9 +38,8 @@ describe('DashboardsDropdown', () => {
const findSearchInput = () => wrapper.findComponent({ ref: 'monitorDashboardsDropdownSearch' });
const findNoItemsMsg = () => wrapper.findComponent({ ref: 'monitorDashboardsDropdownMsg' });
const findStarredListDivider = () => wrapper.findComponent({ ref: 'starredListDivider' });
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- const setSearchTerm = (searchTerm) => wrapper.setData({ searchTerm });
+ const setSearchTerm = (searchTerm) =>
+ wrapper.findComponent(GlSearchBoxByType).vm.$emit('input', searchTerm);
beforeEach(() => {
mockDashboards = dashboardGitResponse;
diff --git a/spec/frontend/notes/components/comment_form_spec.js b/spec/frontend/notes/components/comment_form_spec.js
index 6c774a1ecd0..0179d2afa9e 100644
--- a/spec/frontend/notes/components/comment_form_spec.js
+++ b/spec/frontend/notes/components/comment_form_spec.js
@@ -327,9 +327,8 @@ describe('issue_comment_form component', () => {
jest.spyOn(wrapper.vm, 'stopPolling');
jest.spyOn(wrapper.vm, 'saveNote').mockResolvedValue();
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- await wrapper.setData({ note: 'hello world' });
+ findMarkdownEditor().vm.$emit('input', 'hello world');
+ await nextTick();
await findCommentButton().trigger('click');
@@ -459,9 +458,8 @@ describe('issue_comment_form component', () => {
it('should enable comment button if it has note', async () => {
mountComponent();
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- await wrapper.setData({ note: 'Foo' });
+ findMarkdownEditor().vm.$emit('input', 'Foo');
+ await nextTick();
expect(findCommentTypeDropdown().props('disabled')).toBe(false);
});
diff --git a/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js b/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js
index 7f6ecbac748..784a8dec975 100644
--- a/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js
+++ b/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js
@@ -13,8 +13,8 @@ describe('ServiceDeskRoot', () => {
let spy;
const provideData = {
- customEmail: 'custom.email@example.com',
- customEmailEnabled: true,
+ serviceDeskEmail: 'custom.email@example.com',
+ serviceDeskEmailEnabled: true,
endpoint: '/gitlab-org/gitlab-test/service_desk',
initialIncomingEmail: 'servicedeskaddress@example.com',
initialIsEnabled: true,
@@ -52,8 +52,8 @@ describe('ServiceDeskRoot', () => {
wrapper = createComponent();
expect(wrapper.findComponent(ServiceDeskSetting).props()).toEqual({
- customEmail: provideData.customEmail,
- customEmailEnabled: provideData.customEmailEnabled,
+ serviceDeskEmail: provideData.serviceDeskEmail,
+ serviceDeskEmailEnabled: provideData.serviceDeskEmailEnabled,
incomingEmail: provideData.initialIncomingEmail,
initialOutgoingName: provideData.outgoingName,
initialProjectKey: provideData.projectKey,
diff --git a/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js b/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
index 5631927cc2f..260fd200f03 100644
--- a/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
+++ b/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
@@ -134,26 +134,26 @@ describe('ServiceDeskSetting', () => {
});
});
- describe('with customEmail', () => {
- describe('customEmail is different than incomingEmail', () => {
+ describe('with serviceDeskEmail', () => {
+ describe('serviceDeskEmail is different than incomingEmail', () => {
const incomingEmail = 'foo@bar.com';
- const customEmail = 'custom@bar.com';
+ const serviceDeskEmail = 'servicedesk@bar.com';
beforeEach(() => {
wrapper = createComponent({
- props: { incomingEmail, customEmail },
+ props: { incomingEmail, serviceDeskEmail },
});
});
- it('should see custom email', () => {
- expect(findIncomingEmail().element.value).toEqual(customEmail);
+ it('should see service desk email', () => {
+ expect(findIncomingEmail().element.value).toEqual(serviceDeskEmail);
});
});
describe('project suffix', () => {
it('input is hidden', () => {
wrapper = createComponent({
- props: { customEmailEnabled: false },
+ props: { serviceDeskEmailEnabled: false },
});
const input = wrapper.findByTestId('project-suffix');
@@ -163,7 +163,7 @@ describe('ServiceDeskSetting', () => {
it('input is enabled', () => {
wrapper = createComponent({
- props: { customEmailEnabled: true },
+ props: { serviceDeskEmailEnabled: true },
});
const input = wrapper.findByTestId('project-suffix');
@@ -174,7 +174,7 @@ describe('ServiceDeskSetting', () => {
it('shows error when value contains uppercase or special chars', async () => {
wrapper = createComponent({
- props: { email: 'foo@bar.com', customEmailEnabled: true },
+ props: { email: 'foo@bar.com', serviceDeskEmailEnabled: true },
});
const input = wrapper.findByTestId('project-suffix');
@@ -189,16 +189,16 @@ describe('ServiceDeskSetting', () => {
});
});
- describe('customEmail is the same as incomingEmail', () => {
+ describe('serviceDeskEmail is the same as incomingEmail', () => {
const email = 'foo@bar.com';
beforeEach(() => {
wrapper = createComponent({
- props: { incomingEmail: email, customEmail: email },
+ props: { incomingEmail: email, serviceDeskEmail: email },
});
});
- it('should see custom email', () => {
+ it('should see service desk email', () => {
expect(findIncomingEmail().element.value).toEqual(email);
});
});
diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js
index c0cb17f0d16..00a412d9de8 100644
--- a/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js
+++ b/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js
@@ -125,46 +125,23 @@ describe('FilteredSearchBarRoot', () => {
});
describe('sortDirectionIcon', () => {
- it('returns string "sort-lowest" when `selectedSortDirection` is "ascending"', () => {
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- wrapper.setData({
- selectedSortDirection: SORT_DIRECTION.ascending,
- });
-
- expect(wrapper.vm.sortDirectionIcon).toBe('sort-lowest');
- });
-
- it('returns string "sort-highest" when `selectedSortDirection` is "descending"', () => {
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- wrapper.setData({
- selectedSortDirection: SORT_DIRECTION.descending,
+ it('renders `sort-highest` descending icon by default', () => {
+ expect(findGlButton().props('icon')).toBe('sort-highest');
+ expect(findGlButton().attributes()).toMatchObject({
+ 'aria-label': 'Sort direction: Descending',
+ title: 'Sort direction: Descending',
});
-
- expect(wrapper.vm.sortDirectionIcon).toBe('sort-highest');
});
- });
- describe('sortDirectionTooltip', () => {
- it('returns string "Sort direction: Ascending" when `selectedSortDirection` is "ascending"', () => {
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- wrapper.setData({
- selectedSortDirection: SORT_DIRECTION.ascending,
- });
-
- expect(wrapper.vm.sortDirectionTooltip).toBe('Sort direction: Ascending');
- });
+ it('renders `sort-lowest` ascending icon when the sort button is clicked', async () => {
+ findGlButton().vm.$emit('click');
+ await nextTick();
- it('returns string "Sort direction: Descending" when `selectedSortDirection` is "descending"', () => {
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- wrapper.setData({
- selectedSortDirection: SORT_DIRECTION.descending,
+ expect(findGlButton().props('icon')).toBe('sort-lowest');
+ expect(findGlButton().attributes()).toMatchObject({
+ 'aria-label': 'Sort direction: Ascending',
+ title: 'Sort direction: Ascending',
});
-
- expect(wrapper.vm.sortDirectionTooltip).toBe('Sort direction: Descending');
});
});