Skip to content
Snippets Groups Projects
Commit d83c5120 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent a72a9af0
No related branches found
No related tags found
No related merge requests found
Showing
with 100 additions and 37 deletions
Loading
Loading
@@ -177,7 +177,7 @@ module Banzai
collection.where(id: to_query).each { |row| cache[row.id] = row }
end
 
cache.values_at(*ids).compact
ids.uniq.map { |id| cache[id] }.compact
else
collection.where(id: ids)
end
Loading
Loading
Loading
Loading
@@ -216,6 +216,8 @@ describe('ClusterFormDropdown', () => {
 
$(dropdownEl).trigger('shown.bs.dropdown');
 
expect(vm.find(DropdownSearchInput).props('focused')).toBe(true);
return vm.vm.$nextTick(() => {
expect(vm.find(DropdownSearchInput).props('focused')).toBe(true);
});
});
});
Loading
Loading
@@ -197,7 +197,9 @@ describe('EksClusterConfigurationForm', () => {
it('sets RoleDropdown hasErrors to true when loading roles failed', () => {
rolesState.loadingItemsError = new Error();
 
expect(findRoleDropdown().props('hasErrors')).toEqual(true);
return Vue.nextTick().then(() => {
expect(findRoleDropdown().props('hasErrors')).toEqual(true);
});
});
 
it('sets isLoadingRegions to RegionDropdown loading property', () => {
Loading
Loading
@@ -215,7 +217,9 @@ describe('EksClusterConfigurationForm', () => {
it('sets loadingRegionsError to RegionDropdown error property', () => {
regionsState.loadingItemsError = new Error();
 
expect(findRegionDropdown().props('hasErrors')).toEqual(true);
return Vue.nextTick().then(() => {
expect(findRegionDropdown().props('hasErrors')).toEqual(true);
});
});
 
it('disables KeyPairDropdown when no region is selected', () => {
Loading
Loading
@@ -245,7 +249,9 @@ describe('EksClusterConfigurationForm', () => {
it('sets KeyPairDropdown hasErrors to true when loading key pairs fails', () => {
keyPairsState.loadingItemsError = new Error();
 
expect(findKeyPairDropdown().props('hasErrors')).toEqual(true);
return Vue.nextTick().then(() => {
expect(findKeyPairDropdown().props('hasErrors')).toEqual(true);
});
});
 
it('disables VpcDropdown when no region is selected', () => {
Loading
Loading
@@ -275,7 +281,9 @@ describe('EksClusterConfigurationForm', () => {
it('sets VpcDropdown hasErrors to true when loading vpcs fails', () => {
vpcsState.loadingItemsError = new Error();
 
expect(findVpcDropdown().props('hasErrors')).toEqual(true);
return Vue.nextTick().then(() => {
expect(findVpcDropdown().props('hasErrors')).toEqual(true);
});
});
 
it('disables SubnetDropdown when no vpc is selected', () => {
Loading
Loading
@@ -305,7 +313,9 @@ describe('EksClusterConfigurationForm', () => {
it('sets SubnetDropdown hasErrors to true when loading subnets fails', () => {
subnetsState.loadingItemsError = new Error();
 
expect(findSubnetDropdown().props('hasErrors')).toEqual(true);
return Vue.nextTick().then(() => {
expect(findSubnetDropdown().props('hasErrors')).toEqual(true);
});
});
 
it('disables SecurityGroupDropdown when no vpc is selected', () => {
Loading
Loading
@@ -335,7 +345,9 @@ describe('EksClusterConfigurationForm', () => {
it('sets SecurityGroupDropdown hasErrors to true when loading security groups fails', () => {
securityGroupsState.loadingItemsError = new Error();
 
expect(findSecurityGroupDropdown().props('hasErrors')).toEqual(true);
return Vue.nextTick().then(() => {
expect(findSecurityGroupDropdown().props('hasErrors')).toEqual(true);
});
});
 
describe('when region is selected', () => {
Loading
Loading
import { shallowMount } from '@vue/test-utils';
import Icon from '~/vue_shared/components/icon.vue';
import DiffStats from '~/diffs/components/diff_stats.vue';
 
describe('diff_stats', () => {
Loading
Loading
@@ -22,9 +23,16 @@ describe('diff_stats', () => {
diffFilesLength: 300,
},
});
const additions = wrapper.find('icon-stub[name="file-addition"]').element.parentNode;
const deletions = wrapper.find('icon-stub[name="file-deletion"]').element.parentNode;
const filesChanged = wrapper.find('icon-stub[name="doc-code"]').element.parentNode;
const findIcon = name =>
wrapper
.findAll(Icon)
.filter(c => c.attributes('name') === name)
.at(0).element.parentNode;
const additions = findIcon('file-addition');
const deletions = findIcon('file-deletion');
const filesChanged = findIcon('doc-code');
 
expect(additions.textContent).toContain('100');
expect(deletions.textContent).toContain('200');
Loading
Loading
import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import { GlLoadingIcon, GlLink, GlBadge } from '@gitlab/ui';
import { GlLoadingIcon, GlLink, GlBadge, GlFormInput } from '@gitlab/ui';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
import Stacktrace from '~/error_tracking/components/stacktrace.vue';
import ErrorDetails from '~/error_tracking/components/error_details.vue';
Loading
Loading
@@ -14,6 +14,11 @@ describe('ErrorDetails', () => {
let actions;
let getters;
 
const findInput = name => {
const inputs = wrapper.findAll(GlFormInput).filter(c => c.attributes('name') === name);
return inputs.length ? inputs.at(0) : inputs;
};
function mountComponent() {
wrapper = shallowMount(ErrorDetails, {
stubs: { LoadingButton },
Loading
Loading
@@ -136,15 +141,15 @@ describe('ErrorDetails', () => {
});
 
it('should send sentry_issue_identifier', () => {
const sentryErrorIdInput = wrapper.find(
'glforminput-stub[name="issue[sentry_issue_attributes][sentry_issue_identifier]"',
const sentryErrorIdInput = findInput(
'issue[sentry_issue_attributes][sentry_issue_identifier]',
);
expect(sentryErrorIdInput.attributes('value')).toBe('129381');
});
 
it('should set the form values with title and description', () => {
const csrfTokenInput = wrapper.find('glforminput-stub[name="authenticity_token"]');
const issueTitleInput = wrapper.find('glforminput-stub[name="issue[title]"]');
const csrfTokenInput = findInput('authenticity_token');
const issueTitleInput = findInput('issue[title]');
const issueDescriptionInput = wrapper.find('input[name="issue[description]"]');
expect(csrfTokenInput.attributes('value')).toBe('fakeToken');
expect(issueTitleInput.attributes('value')).toContain(wrapper.vm.issueTitle);
Loading
Loading
Loading
Loading
@@ -57,7 +57,9 @@ describe('error tracking settings app', () => {
it('disables the button when saving', () => {
store.state.settingsLoading = true;
 
expect(wrapper.find('.js-error-tracking-button').attributes('disabled')).toBeTruthy();
return wrapper.vm.$nextTick(() => {
expect(wrapper.find('.js-error-tracking-button').attributes('disabled')).toBeTruthy();
});
});
});
});
import { shallowMount } from '@vue/test-utils';
import MRPopover from '~/mr_popover/components/mr_popover';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
 
describe('MR Popover', () => {
let wrapper;
Loading
Loading
@@ -23,7 +24,9 @@ describe('MR Popover', () => {
it('shows skeleton-loader while apollo is loading', () => {
wrapper.vm.$apollo.loading = true;
 
expect(wrapper.element).toMatchSnapshot();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.element).toMatchSnapshot();
});
});
 
describe('loaded state', () => {
Loading
Loading
@@ -58,7 +61,7 @@ describe('MR Popover', () => {
});
 
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.contains('ciicon-stub')).toBe(false);
expect(wrapper.contains(CiIcon)).toBe(false);
});
});
});
Loading
Loading
import { shallowMount } from '@vue/test-utils';
import { STATUS_SUCCESS } from '~/reports/constants';
import ReportItem from '~/reports/components/report_item.vue';
import IssueStatusIcon from '~/reports/components/issue_status_icon.vue';
import { componentNames } from '~/reports/components/issue_body';
 
describe('ReportItem', () => {
Loading
Loading
@@ -15,7 +16,7 @@ describe('ReportItem', () => {
},
});
 
expect(wrapper.find('issuestatusicon-stub').exists()).toBe(false);
expect(wrapper.find(IssueStatusIcon).exists()).toBe(false);
});
 
it('shows status icon when unspecified', () => {
Loading
Loading
@@ -27,7 +28,7 @@ describe('ReportItem', () => {
},
});
 
expect(wrapper.find('issuestatusicon-stub').exists()).toBe(true);
expect(wrapper.find(IssueStatusIcon).exists()).toBe(true);
});
});
});
Loading
Loading
@@ -66,39 +66,51 @@ describe('Repository last commit component', () => {
it('renders commit widget', () => {
factory();
 
expect(vm.element).toMatchSnapshot();
return vm.vm.$nextTick(() => {
expect(vm.element).toMatchSnapshot();
});
});
 
it('renders short commit ID', () => {
factory();
 
expect(vm.find('.label-monospace').text()).toEqual('12345678');
return vm.vm.$nextTick(() => {
expect(vm.find('.label-monospace').text()).toEqual('12345678');
});
});
 
it('hides pipeline components when pipeline does not exist', () => {
factory(createCommitData({ pipeline: null }));
 
expect(vm.find('.js-commit-pipeline').exists()).toBe(false);
return vm.vm.$nextTick(() => {
expect(vm.find('.js-commit-pipeline').exists()).toBe(false);
});
});
 
it('renders pipeline components', () => {
factory();
 
expect(vm.find('.js-commit-pipeline').exists()).toBe(true);
return vm.vm.$nextTick(() => {
expect(vm.find('.js-commit-pipeline').exists()).toBe(true);
});
});
 
it('hides author component when author does not exist', () => {
factory(createCommitData({ author: null }));
 
expect(vm.find('.js-user-link').exists()).toBe(false);
expect(vm.find(UserAvatarLink).exists()).toBe(false);
return vm.vm.$nextTick(() => {
expect(vm.find('.js-user-link').exists()).toBe(false);
expect(vm.find(UserAvatarLink).exists()).toBe(false);
});
});
 
it('does not render description expander when description is null', () => {
factory(createCommitData({ description: null }));
 
expect(vm.find('.text-expander').exists()).toBe(false);
expect(vm.find('.commit-row-description').exists()).toBe(false);
return vm.vm.$nextTick(() => {
expect(vm.find('.text-expander').exists()).toBe(false);
expect(vm.find('.commit-row-description').exists()).toBe(false);
});
});
 
it('expands commit description when clicking expander', () => {
Loading
Loading
@@ -113,6 +125,8 @@ describe('Repository last commit component', () => {
it('renders the signature HTML as returned by the backend', () => {
factory(createCommitData({ signatureHtml: '<button>Verified</button>' }));
 
expect(vm.element).toMatchSnapshot();
return vm.vm.$nextTick().then(() => {
expect(vm.element).toMatchSnapshot();
});
});
});
Loading
Loading
@@ -7,6 +7,11 @@ describe('Commit component', () => {
let props;
let wrapper;
 
const findIcon = name => {
const icons = wrapper.findAll(Icon).filter(c => c.attributes('name') === name);
return icons.length ? icons.at(0) : icons;
};
const findUserAvatar = () => wrapper.find(UserAvatarLink);
 
const createComponent = propsData => {
Loading
Loading
@@ -71,7 +76,7 @@ describe('Commit component', () => {
});
 
it('should render a tag icon if it represents a tag', () => {
expect(wrapper.find('icon-stub[name="tag"]').exists()).toBe(true);
expect(findIcon('tag').exists()).toBe(true);
});
 
it('should render a link to the ref url', () => {
Loading
Loading
@@ -89,7 +94,7 @@ describe('Commit component', () => {
});
 
it('should render icon for commit', () => {
expect(wrapper.find('icon-stub[name="commit"]').exists()).toBe(true);
expect(findIcon('commit').exists()).toBe(true);
});
 
describe('Given commit title and author props', () => {
Loading
Loading
@@ -162,7 +167,7 @@ describe('Commit component', () => {
 
expect(refEl.attributes('title')).toBe(props.commitRef.name);
 
expect(wrapper.find('icon-stub[name="branch"]').exists()).toBe(true);
expect(findIcon('branch').exists()).toBe(true);
});
});
 
Loading
Loading
@@ -195,7 +200,7 @@ describe('Commit component', () => {
 
expect(refEl.attributes('title')).toBe(props.mergeRequestRef.title);
 
expect(wrapper.find('icon-stub[name="git-merge"]').exists()).toBe(true);
expect(findIcon('git-merge').exists()).toBe(true);
});
});
 
Loading
Loading
Loading
Loading
@@ -49,7 +49,9 @@ describe('DropdownSearchInputComponent', () => {
 
wrapper.setProps({ focused: true });
 
expect(inputEl.focus).toHaveBeenCalled();
return wrapper.vm.$nextTick().then(() => {
expect(inputEl.focus).toHaveBeenCalled();
});
});
});
});
Loading
Loading
@@ -147,9 +147,12 @@ describe('UserAvatarList', () => {
 
it('with collapse clicked, it renders avatars up to breakpoint', () => {
clickButton();
const links = wrapper.findAll(UserAvatarLink);
 
expect(links.length).toEqual(TEST_BREAKPOINT);
return wrapper.vm.$nextTick(() => {
const links = wrapper.findAll(UserAvatarLink);
expect(links.length).toEqual(TEST_BREAKPOINT);
});
});
});
});
Loading
Loading
Loading
Loading
@@ -312,6 +312,12 @@ describe Banzai::ReferenceParser::BaseParser do
expect(subject.collection_objects_for_ids(Project, [project.id]))
.to eq([project])
end
it 'will not overflow the stack' do
ids = 1.upto(1_000_000).to_a
expect { subject.collection_objects_for_ids(User, ids) }.not_to raise_error
end
end
end
 
Loading
Loading
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment